Init nixVersions.minimum and fix lib tests for all Nix versions#234070
Init nixVersions.minimum and fix lib tests for all Nix versions#234070roberth merged 5 commits intoNixOS:masterfrom
nixVersions.minimum and fix lib tests for all Nix versions#234070Conversation
nixVersions.minimum and fix lib tests for all Nix versions
lib/tests/release.nix
Outdated
There was a problem hiding this comment.
Just recurseIntoAttrs would be nice. That way you can run all of them, or just the nix version you're interested in.
There was a problem hiding this comment.
Doesn't quite work without extra complexity because the part consuming this result uses it in buildInputs:
nixpkgs/pkgs/top-level/make-tarball.nix
Line 24 in 5f93f5f
which can't handle such recursive attribute sets:
$ nix-build pkgs/top-level/release.nix -A tarball
error: Dependency is not of a valid type: element 3 of buildInputs for nixpkgs-tarball-23.11pre1234.abcdef
(use '--show-trace' to show detailed location information)
(how have I never seen this error before :o)
There was a problem hiding this comment.
Maybe this has something useful?
I can't believe that this is not a solved problem!
There was a problem hiding this comment.
| if ! self ? ${attribute} then | |
| throw "The minimum supported Nix version is ${minver} (declared in lib/minver.nix), but pkgs.nixVersions.${attribute} does not exist." | |
| else | |
| nix; | |
| if self ? ${attribute} then | |
| nix | |
| else | |
| throw "The minimum supported Nix version is ${minver} (declared in lib/minver.nix), but pkgs.nixVersions.${attribute} does not exist."; |
There was a problem hiding this comment.
I think for code that performs validation, it's good for the error case to be in the then, even if that leads to a negation.
There was a problem hiding this comment.
| major = lib.versions.major minver; | |
| minor = lib.versions.minor minver; | |
| attribute = "nix_${major}_${minor}"; | |
| attribute = "nix_${lib.versions.major minver}_${lib.versions.minor minver}"; |
nit
There was a problem hiding this comment.
| # The minimum Nix version supported by Nixpkgs | |
| # The minimum Nix version supported by Nixpkgs | |
| # Note that some functionality *might* have been backported into this Nix version, | |
| # making this package an inaccurate representation of what features are available | |
| # in the actual lowest minver.nix *patch* version. |
We generally don't backport a lot, and probably 2.3.0(1?) is not relevant anymore anyway, but testing against this may give a false sense of security correctness.
There was a problem hiding this comment.
Good point, ideally we'd pin the first supported Nix version somehow. Don't want to go into that for now though, I applied this suggestion :)
roberth
left a comment
There was a problem hiding this comment.
Just the comment in the minimum version package. Otherwise lgtm.
Co-Authored-By: Robert Hensing <[email protected]>
The previous commits ensure that the tests also succeed with those versions
|
Backport to 23.05 needed? It still won't pass with latest Nix version, which seems problematic, e.g. NixOS/nix#8569 |
|
Backport failed for Please cherry-pick the changes locally. git fetch origin release-23.05
git worktree add -d .worktree/backport-234070-to-release-23.05 origin/release-23.05
cd .worktree/backport-234070-to-release-23.05
git checkout -b backport-234070-to-release-23.05
ancref=$(git merge-base 7d9999f2c178882a4656283c12a7501243626bf7 013acf2396f451c73b6cd6b0148df21cbaa4c165)
git cherry-pick -x $ancref..013acf2396f451c73b6cd6b0148df21cbaa4c165 |
|
(Apparently, parts of this were already backported in the PR shown above.) |
|
So at least this one? |
Description of changes
The
lib.filesystem.pathTypeimplementation now uses the newbuiltins.readFileTypewhen available (in Nix 2.14) since #224834. But the tests introduced in that same PR weren't verified to work with 2.14, discovered in #233439, so this PR fixes that:In addition, this PR fixes the tests for Nix version 2.3, since that's the minimum supported Nix version in Nixpkgs according to
lib/minver.nixAnd in order to ensure this doesn't happen again in the future, I created
nixVersions.minimumto point to the Nix version fromlib/minver.nix, and set up thelibtests to run with all ofnixVersions.minimum, the default one, andnixVersions.unstable.This work is sponsored by Antithesis ✨
Things done