-
Notifications
You must be signed in to change notification settings - Fork 0
/
default.nix
60 lines (55 loc) · 1.2 KB
/
default.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
{ lib
, darwin
, system
, naersk
, targetPlatform
, pkg-config
, libiconv
, rustfmt
, cargo
, rustc
, openssl
, # , llvmPackages # Optional
# , protobuf # Optional
}:
let
cargoToml = builtins.fromTOML (builtins.readFile ./Cargo.toml);
optionalItems = cond: items: if cond then items else [ ];
in
naersk.lib."${targetPlatform.system}".buildPackage {
pname = cargoToml.package.name;
version = cargoToml.package.version;
src = ./.;
buildInputs = [
cargo
rustc
rustfmt
pkg-config
libiconv
openssl
] ++ (optionalItems (system == "aarch64-darwin") [
darwin.apple_sdk.frameworks.SystemConfiguration
]);
checkInputs = [
cargo
rustc
];
doCheck = true;
CARGO_BUILD_INCREMENTAL = "false";
RUST_BACKTRACE = "full";
copyLibs = true;
# Optional things you might need:
#
# If you depend on `libclang`:
# LIBCLANG_PATH = "${llvmPackages.libclang}/lib";
#
# If you depend on protobuf:
# PROTOC = "${protobuf}/bin/protoc";
# PROTOC_INCLUDE = "${protobuf}/include";
meta = with lib; {
description = cargoToml.package.description;
homepage = cargoToml.package.homepage;
license = with licenses; [ mit asl20 ];
maintainers = [ ];
};
}