forked from TryGhost/Ghost
-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
49 lines (44 loc) · 1.31 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
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
systems.url = "github:nix-systems/default";
};
outputs = {
systems,
nixpkgs,
...
} @ inputs: let
yarn_overlay = final: prev: {
yarn = prev.yarn.overrideAttrs(finalAttrs: prevAttrs: {
# This is to make sure that yarn runs the correct node version
# https://github.com/NixOS/nixpkgs/issues/145634#issuecomment-1627476963
installPhase = prevAttrs.installPhase + ''
ln -fs $out/libexec/yarn/bin/yarn $out/bin/yarn
ln -fs $out/libexec/yarn/bin/yarn.js $out/bin/yarn.js
ln -fs $out/libexec/yarn/bin/yarn $out/bin/yarnpkg
'';
});
};
# This gives us a central place to set the node version
node_overlay = final: prev: {
nodejs = prev.nodejs-18_x;
};
eachSystem = f:
nixpkgs.lib.genAttrs (import systems) (
system:
f ((nixpkgs.legacyPackages.${system}.extend yarn_overlay).extend node_overlay)
);
in {
devShells = eachSystem (pkgs: {
default = pkgs.mkShell {
buildInputs = with pkgs; [
nodejs
yarn
];
shellHook = ''
echo "node `${pkgs.nodejs}/bin/node --version`"
'';
};
});
};
}