-
Notifications
You must be signed in to change notification settings - Fork 4
/
flake.nix
56 lines (51 loc) · 1.49 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
56
{
inputs = {
flake-utils.url = "github:numtide/flake-utils";
nixpkgs-matrix = {
type = "indirect";
id = "nixpkgs-matrix";
};
};
outputs = { nixpkgs-matrix, flake-utils, ... }:
flake-utils.lib.eachSystem ([
"x86_64-linux"
"x86_64-windows"
"x86_64-darwin"
"aarch64-darwin"
]) (system:
let
pkgs = nixpkgs-matrix.legacyPackages.${system};
shell = { ci ? false }:
with pkgs;
pkgs.mkShell {
nativeBuildInputs = [ nodejs_20 shellcheck jq ];
# Don't set rpath for native addons
NIX_DONT_SET_RPATH = true;
NIX_NO_SELF_RPATH = true;
RUST_SRC_PATH = "${rustPlatform.rustLibSrc}";
shellHook = ''
echo "Entering $(npm pkg get name)"
set -o allexport
. <(pk secrets env Polykey)
set +o allexport
set -v
${lib.optionalString ci ''
set -o errexit
set -o nounset
set -o pipefail
shopt -s inherit_errexit
''}
mkdir --parents "$(pwd)/tmp"
# Built executables and NPM executables
export PATH="$(pwd)/dist/bin:$(npm root)/.bin:$PATH"
npm install --ignore-scripts
set +v
'';
};
in {
devShells = {
default = shell { ci = false; };
ci = shell { ci = true; };
};
});
}