nix: check fallback paths#266347
Conversation
lovesegfault
left a comment
There was a problem hiding this comment.
Please redeem these free beverage tickets when we see each other again: 🎟️ 🎟️
Thank you!!
6448881 to
c8b8ab8
Compare
Co-authored-by: Artturi <Artturin@artturin.com>
| addFallbackPathsCheck = pkg: addTestsShallowly | ||
| { nix-fallback-paths = | ||
| runCommand "test-nix-fallback-paths-version-equals-nix-stable" { | ||
| paths = lib.concatStringsSep "\n" (builtins.attrValues (import ../../../../nixos/modules/installer/tools/nix-fallback-paths.nix)); | ||
| } '' | ||
| if [[ "" != $(grep -v 'nix-${pkg.version}$' <<< "$paths") ]]; then | ||
| echo "nix-fallback-paths not up to date with nixVersions.stable (nix-${pkg.version})" | ||
| echo "The following paths are not up to date:" | ||
| grep -v 'nix-${pkg.version}$' <<< "$paths" | ||
| echo | ||
| echo "Fix it by running in nixpkgs:" | ||
| echo | ||
| echo "curl https://releases.nixos.org/nix/nix-${pkg.version}/fallback-paths.nix >nixos/modules/installer/tools/nix-fallback-paths.nix" | ||
| echo | ||
| exit 1 | ||
| else | ||
| echo "nix-fallback-paths versions up to date" | ||
| touch $out | ||
| fi | ||
| ''; | ||
| } | ||
| pkg; |
There was a problem hiding this comment.
This is nixos-specific; it belongs in nixos/ not in nixpkgs/pkgs/.
There was a problem hiding this comment.
It'll have to be added to the nix attribute in any case, just like we add nixosTests.
In my opinion it's ok to keep the definition here because I can't think of a other place to put it.
There was a problem hiding this comment.
It'll have to be added to the nix attribute in any case, just like we add nixosTests.
That can be done in the nixos module for nix.
I can't think of a other place to put it.
I can: in nixos/. These "fallback paths" are meaningless on non-NixOS uses of nixpkgs.
There was a problem hiding this comment.
The file is used by nixos-rebuild and nix upgrade-nix https://nixos.org/manual/nix/stable/command-ref/new-cli/nix3-upgrade-nix.html#description
The test has to be attached to nixVersions.stable in some way for ofborg to run it
There was a problem hiding this comment.
The file is used by
nixos-rebuild
Like I said, it's nixos-specific.
The test has to be attached to nixVersions.stable in some way for ofborg to run it
ofborg runs plenty of tests from other parts of the tree, like lib, etc.
It is accepted for the tests attribute to use NixOS. Suggested change is non-trivial and doesn't leverage existing solutions as much. The architectural rules can be changed, but that's beyond the scope of this change.
💩 |
Description of changes
Add a test for ofborg to run. Detects out of date fallback paths by comparing versions.
#266264 (comment)
Free @lovesegfault to do cool things instead of nagging about fallback paths.
Things done
nix.conf? (See Nix manual)sandbox = relaxedsandbox = truenix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/)