-
-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow nixpkgs-check-by-name to work with recent Nix versions #79
Merged
infinisil
merged 3 commits into
NixOS:main
from
philiptaron:issue-78/fix-inherit-io-issue
Jul 26, 2024
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is slowing down CI by about 3.5 minutes. I opened #83 instead to allow running the test suite with different Nix versions, which this PR can make use of.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is way less important now that #83 is merged and the tool doesn't depend on the ambient version of Nix. I'm fine cutting them all, or going down to {minimum,stable,latest}.
That said, given that reviews are usually a matter of a week or more, 3.5 minutes more isn't an actual issue. Amdahl's law!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I decided to keep these in the CI run. The number of PRs that aren't you or I is quite low.