-
Notifications
You must be signed in to change notification settings - Fork 3
/
utils.nix
81 lines (72 loc) · 2.59 KB
/
utils.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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
{ pkgs, sources }:
with pkgs;
let
stdenv = llvmPackages.libcxxStdenv;
linker = callPackage ./nix/static-linker.nix { inherit stdenv; };
buildInputs = [ ] ++ lib.optionals stdenv.isDarwin
(with darwin.apple_sdk.frameworks; [ DiskArbitration Foundation ]);
mkDrv = { doCheck ? true, buildFeatures ? [ ]
, dontUseCargoParallelTests ? false, cargoPatches ? [ ]
, cargoBuildFlags ? "", postUnpack ? "", cargoLock ? null
, cargoSha256 ? null, outputHashes ? { } }:
name:
rustPlatform.buildRustPackage {
inherit name buildFeatures cargoPatches doCheck dontUseCargoParallelTests
cargoBuildFlags postUnpack cargoSha256;
src = sources."${name}";
buildInputs = [ openssl-static ] ++ lib.optionals stdenv.isDarwin
(with darwin.apple_sdk.frameworks; [ SystemConfiguration Security ]);
nativeBuildInputs = [ pkg-config cmake perl ];
cargoLock = if builtins.isNull cargoLock then
(if builtins.isNull cargoSha256 then {
lockFile = "${sources."${name}"}/Cargo.lock";
inherit outputHashes;
} else
null)
else
cargoLock;
RUSTFLAGS = [ "-Clinker=${linker}" "-Lnative=${libcxx}/lib" ];
};
in rec {
icx-proxy =
mkDrv { buildFeatures = [ "skip_body_verification" ]; } "icx-proxy";
idl2json = mkDrv { } "idl2json";
vessel = mkDrv { } "vessel";
ic-repl = mkDrv {
outputHashes = {
"ic-agent-0.38.2" = "sha256-eR6bWPsKZgjzY71WRbunuf8uaJmFn41ygzEpkQqsrgs=";
};
} "ic-repl";
ic-wasm = mkDrv {
buildFeatures = [ "exe" ];
dontUseCargoParallelTests = true;
} "ic-wasm";
candid = mkDrv {
cargoPatches = [ ./nix/candid.patch ];
dontUseCargoParallelTests = true;
} "candid";
cdk-rs = mkDrv { doCheck = false; } "cdk-rs";
agent-rs = mkDrv { doCheck = false; } "agent-rs";
dfx-extensions = (mkDrv {
doCheck = false;
postUnpack = ''
pushd $sourceRoot
rm extensions/{nns,sns}/build.rs
sed -i 's/^build =.*$//' extensions/{nns,sns}/Cargo.toml*
popd
'';
cargoBuildFlags = "--bin nns --bin sns";
outputHashes = {
"build-info-0.0.27" =
"sha256-SkwWwDNrTsntkNiCv6rsyTFGazhpRDnKtVzPpYLKF9U=";
"cycles-minting-canister-0.9.0" =
"sha256-NlMf9Ok7jEZuhLv7W7UxbRM/tK8YG4UWUm9qqfXJXOw=";
"dfx-core-0.0.1" = "sha256-34k78kmdjL9k52W2Fw0CYyd2j3uFzO1g+PsNug4jlUU=";
"ic-agent-0.36.0" = "sha256-/0znCHkzjINM8uHXSJgmw0Hk+ltbB1VVlBmrjJc5364=";
};
} "dfx-extensions").overrideAttrs (_: {
IC_ICRC1_ARCHIVE_WASM_PATH =
"../../ic-icrc1-0.9.0/wasm/ic-icrc1-archive.wasm.gz";
});
shell = ic-wasm;
}