-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
60 lines (54 loc) · 1.57 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
57
58
59
60
{
description = "A prisma test project";
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
outputs = inputs:
let
nameValuePair = name: value: { inherit name value; };
genAttrs = names: f: builtins.listToAttrs (map (n: nameValuePair n (f n)) names);
forAllSystems = genAttrs [
"x86_64-linux"
"x86_64-darwin"
"i686-linux"
"aarch64-linux"
"aarch64-darwin"
];
pkgsFor = pkgs: sys:
import pkgs {
system = sys;
config = { allowUnfree = true; };
};
in rec {
devShell = forAllSystems (system:
let
pkgs = (pkgsFor inputs.nixpkgs system);
in
pkgs.mkShell {
nativeBuildInputs = [ pkgs.bashInteractive ];
buildInputs = with pkgs; [
nodePackages.node2nix
];
}
);
overlay = final: prev: {
prismaPackages = import ./default.nix {
pkgs = prev;
};
};
packages = forAllSystems (system:
let
pkgs = import inputs.nixpkgs {
inherit system;
config = { allowUnfree = true; };
};
node2nix = pkgs.nodePackages.node2nix;
in import ./default.nix {
inherit pkgs;
} // {
updatePackages = pkgs.writeShellScriptBin "updatePackages" ''
set -eu -o pipefail
rm -f ./node-env.nix
${node2nix}/bin/node2nix -i node-packages.json -o node-packages.nix -c default.nix --pkg-name nodejs-14_x
'';
});
};
}