Repository navigation
Expand file tree
/
Copy pathdefault.nix
More file actions
92 lines (91 loc) · 3.17 KB
/
Copy pathdefault.nix
File metadata and controls
92 lines (91 loc) · 3.17 KB
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
82
83
84
85
86
87
88
89
90
91
92
{ pkgs ? import <nixpkgs> { } }:
let
pkgs_with_overlay = pkgs.appendOverlays ([
(import (builtins.fetchTarball
"https://github.com/oxalica/rust-overlay/archive/master.tar.gz"))
(self: super: {
rust-stable = self.rust-bin.stable."1.99.0".default.override {
targets = [ "wasm32-unknown-unknown" ];
extensions = [ "rust-src" ];
};
rust-nightly = self.rust-bin.nightly."2026-07-25".default.override {
targets = [ "wasm32-wasip1" ];
extensions = [ "rust-src" ];
};
v8 = self.v8_8_x;
zlib-static =
(super.pkgsStatic.zlib.override ({ splitStaticOutput = true; })).static;
lzma-static = super.pkgsStatic.xz;
libunwind-static = super.pkgsStatic.libunwind;
openssl-static = super.pkgsStatic.openssl.override ({ static = true; });
libiconv-static = super.pkgsStatic.libiconvReal.override {
enableStatic = true;
enableShared = false;
};
# This is a fix for NixOS on darwin
cxx-wrapper = super.callPackage ./nix/cxx-wrapper.nix { };
})
]);
in let
pkgs = pkgs_with_overlay;
pkgsRust = pkgs.appendOverlays ([
(self: super: {
rust-stable = pkgs.rust-stable;
rust-bindgen = super.rust-bindgen.overrideAttrs (_: { doCheck = false; });
rustPlatform = (super.makeRustPlatform {
rustc = self.rust-stable;
cargo = self.rust-stable;
stdenv = self.llvmPackages.libcxxStdenv;
}) // {
importCargoLock = super.callPackage ./nix/import-cargo-lock.nix { cargo = self.rust-stable; };
};
# workaround for nixpkgs 23.11 for HOST_CC when invoking cargo.
rust = if super.rust ? envVars then
super.rust // { envVars = super.rust.envVars // { setEnv = ""; }; }
else
super.rust;
})
]);
sources = import ./nix/sources.nix { inherit (pkgs) fetchgit; };
motoko = import ./motoko.nix {
inherit pkgs;
sources = { inherit (sources) motoko libtommath musl-wasi; };
};
mainnet-canisters = import ./mainnet-canisters.nix { inherit pkgs sources; };
ic = import ./ic.nix {
inherit pkgs sources mainnet-canisters;
customRustPlatform = pkgsRust.rustPlatform;
moc = motoko.moc;
};
utils = import ./utils.nix {
inherit pkgs sources;
customRustPlatform = pkgsRust.rustPlatform;
};
icp-cli = import ./icp-cli.nix {
inherit pkgs;
src = sources.icp-cli;
customRustPlatform = pkgsRust.rustPlatform;
};
sdk = import ./sdk.nix {
inherit pkgs;
src = sources.sdk;
customRustPlatform = pkgsRust.rustPlatform;
};
depsOf = drvs:
pkgs.mkShell {
name = "deps-env";
nobuildPhase = "touch $out";
buildInputs = builtins.concatMap (drv: drv.buildInputs) drvs;
nativeBuildInputs = builtins.concatMap (drv: drv.nativeBuildInputs) drvs;
};
ic-no-shell = ic // {
shell = null;
wasm-binaries = null;
};
projects = { inherit motoko mainnet-canisters ic ic-no-shell icp-cli sdk utils; };
in with builtins;
let derivations = pkgs.lib.lists.foldr (a: b: a // b) { } (attrValues projects);
in projects // derivations // {
deps = depsOf (attrValues
(pkgs.lib.filterAttrs (_: value: pkgs.lib.isDerivation value) derivations));
}