Skip to content

Conversation

@crazazy
Copy link
Contributor

@crazazy crazazy commented Mar 26, 2021

Motivation for this change

Before this patch, if /etc/nixos/flake.nix existed, nixos-rebuild would
try to use flakes even if you had an unsupported version of nix. we now
do an additional version check to see if nix can use flakes in the first
place.

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.

Before this patch, if /etc/nixos/flake.nix existed, nixos-rebuild would
try to use flakes even if you had an unsupported version of nix. we now
do an additional version check to see if nix can use flakes in the first
place.
@Synthetica9
Copy link
Member

This is gonna cause a problem for nix 2.12.1-3 🤔

@ofborg ofborg bot added 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. labels Mar 26, 2021
@r-rmcgibbo
Copy link

Result of nixpkgs-review pr 117707 at 1594d24 run on x86_64-linux 1

1 package built successfully:
  • nixos-rebuild

@crazazy
Copy link
Contributor Author

crazazy commented Mar 26, 2021

This is gonna cause a problem for nix 2.12.1-3 thinking

As far as I am aware, after this we should be moving to 3.0
thought I might want to add another dot to the regex so that we dont accidentally check for a minor+hotfix combination yeah...

Previously, nixos-rebuild would mistakenly assume an old version in the
case nix hits 3.2.{1,2,3}
@crazazy crazazy changed the title [WIP] nixos-rebuild: Added a version check nixos-rebuild: Added a version check Mar 26, 2021
@stale
Copy link

stale bot commented Sep 23, 2021

I marked this as stale due to inactivity. → More info

@stale stale bot added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Sep 23, 2021
@wegank wegank added the 2.status: merge conflict This PR has merge conflicts with the target branch label Mar 20, 2024
@stale stale bot removed the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Mar 20, 2024
@wegank wegank added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Jul 4, 2024
@wamserma
Copy link
Member

I think this should not be a problem any more, as relevant Nix versions (2.1,2.2,2.3) have largely been retired and a rewrite of nixos-rebuild has landed in #354029.

@wamserma wamserma closed this Jul 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

2.status: merge conflict This PR has merge conflicts with the target branch 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants