-
-
Notifications
You must be signed in to change notification settings - Fork 7
/
nixpkgs-check.nix
56 lines (52 loc) · 1.51 KB
/
nixpkgs-check.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
{
lib,
runCommand,
nixpkgs-vet,
initNix,
nixpkgs,
nix,
nixVersions,
lixVersions,
}:
let
# Given an attrset, return only the values that both eval and are derivations.
#
# We do this to avoid encoding information about which names are in present in the attrset.
# For instance, `nixVersions` contains `nix_2_10`, which throws, and `lixVersions` does not
# contain `minimum` or `git`, but `nixVersions` does.
#
# Let's just map over those attrsets and return what's useful from there.
derivationsFromAttrset =
attrset:
lib.filterAttrs (
name: value:
let
eval = builtins.tryEval value;
in
eval.success && lib.isDerivation eval.value
) attrset;
mkNixpkgsCheck =
name: nix:
runCommand "test-nixpkgs-vet-with-${nix.name}"
{
nativeBuildInputs = [
nixpkgs-vet
nix
];
env.NIXPKGS_VET_NIX_PACKAGE = lib.getBin nix;
passthru = {
# Allow running against all other Nix versions.
nixVersions = lib.mapAttrs mkNixpkgsCheck (derivationsFromAttrset nixVersions);
# Allow running against all other Lix versions.
lixVersions = lib.mapAttrs mkNixpkgsCheck (derivationsFromAttrset lixVersions);
};
}
''
${initNix}
# This is what nixpkgs-vet uses
export NIXPKGS_VET_NIX_PACKAGE=${lib.getBin nix}
${nixpkgs-vet}/bin/.nixpkgs-vet-wrapped --base "${nixpkgs}" "${nixpkgs}"
touch $out
'';
in
mkNixpkgsCheck nix.name nix