-
Notifications
You must be signed in to change notification settings - Fork 1
/
flake.nix
55 lines (50 loc) · 1.56 KB
/
flake.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
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
foundry.url =
"github:shazow/foundry.nix/monthly"; # Use monthly branch for permanent releases
};
outputs = { self, nixpkgs, foundry }:
let
eachSystem = systems: f:
let
op = attrs: system:
let
ret = f system;
op = attrs: key:
let
appendSystem = key: system: ret: { ${system} = ret.${key}; };
in attrs // {
${key} = (attrs.${key} or { })
// (appendSystem key system ret);
};
in builtins.foldl' op attrs (builtins.attrNames ret);
in builtins.foldl' op { } systems;
defaultSystems = [ "x86_64-linux" "aarch64-darwin" ];
in eachSystem defaultSystems (system:
let
pkgs = import nixpkgs {
inherit system;
overlays = [ foundry.overlay ];
};
in {
devShell = with pkgs;
mkShell {
buildInputs = [
nodejs
yarn
# From the foundry overlay
# Note: Can also be referenced without overlaying as: foundry.defaultPackage.${system}
foundry-bin
# ... any other dependencies we need
solc
# to view code coverage
lcov
];
# Decorative prompt override so we know when we're in a dev shell
shellHook = ''
export PS1="[dev] $PS1"
'';
};
});
}