-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathflake.nix
63 lines (59 loc) · 1.84 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
61
62
63
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
systems.url = "github:nix-systems/default";
};
outputs = { self, nixpkgs, systems }:
let
eachSystem = callback: nixpkgs.lib.genAttrs (import systems) (system: callback (pkgs system));
pkgs = system: nixpkgs.legacyPackages.${system};
in
{
packages = eachSystem (pkgs: {
default = pkgs.callPackage ./packages/git-format-staged.nix { };
# When npm dependencies change we need to update the dependencies hash
# in test/test.nix
update-npm-deps-hash = pkgs.writeShellApplication {
name = "update-npm-deps-hash";
runtimeInputs = with pkgs; [ prefetch-npm-deps nix gnused ];
text = ''
hash=$(prefetch-npm-deps package-lock.json 2>/dev/null)
echo "updated npm dependency hash: $hash" >&2
sed -i "s|sha256-[A-Za-z0-9+/=]\+|$hash|" test/test.nix
'';
};
});
devShells = eachSystem (pkgs: {
default = pkgs.mkShell {
nativeBuildInputs = with pkgs; [
nodejs
python3
];
};
});
# Run tests against maintained Python versions.
#
# Run tests with,
#
# $ nix flake check --print-build-logs
#
checks = eachSystem (pkgs:
let
python_versions = with pkgs; [
python313
python312 # Python 3.12
python311
python310
python39 # Python 3.9
python38
];
in
builtins.listToAttrs (builtins.map
(python3: rec {
name = builtins.replaceStrings [ "." ] [ "_" ] "test-python_${python3.version}";
value = pkgs.callPackage ./test/test.nix { inherit name python3; };
})
python_versions)
);
};
}