-
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #79 from philiptaron/issue-78/fix-inherit-io-issue
Allow nixpkgs-check-by-name to work with recent Nix versions
- Loading branch information
Showing
6 changed files
with
209 additions
and
52 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,4 +20,5 @@ relative-path = "1.9.3" | |
textwrap = "0.16.1" | ||
|
||
[dev-dependencies] | ||
pretty_assertions = "1.4.0" | ||
temp-env = "0.3.6" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
{ | ||
lib, | ||
runCommand, | ||
nixpkgs-check-by-name, | ||
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-check-by-name-with-${nix.name}" | ||
{ | ||
nativeBuildInputs = [ | ||
nixpkgs-check-by-name | ||
nix | ||
]; | ||
|
||
env.NIX_CHECK_BY_NAME_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-check-by-name uses | ||
export NIX_CHECK_BY_NAME_NIX_PACKAGE=${lib.getBin nix} | ||
${nixpkgs-check-by-name}/bin/.nixpkgs-check-by-name-wrapped --base "${nixpkgs}" "${nixpkgs}" | ||
touch $out | ||
''; | ||
in | ||
mkNixpkgsCheck nix.name nix |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters