nixos-rebuild-ng: allow withNix218 to be overriden

`withNix218` controls if `nixos-rebuild-ng` is built with Nix 2.18+, so
it can use some features depending on newer version of Nix, for example
using `nix copy` instead of `nix-copy-closure` for more efficient copies
when both `--build-host` and `--target-host`. This is computed by
looking at the Nix derivation at compile time.

It is unlikely but it could happen that some specific use case an user
wants to use the Nix <2.18 path without actually using an older version
of Nix. For those cases we are exposing the `withNix218` as a derivation
parameter, so it can be overriden.
This commit is contained in:
Thiago Kenji Okada
2025-06-24 19:46:27 +01:00
parent 12e016d32d
commit 88fcdf4ef8
+7 -7
View File
@@ -15,6 +15,13 @@
# Very long tmp dirs lead to "too long for Unix domain socket"
# SSH ControlPath errors. Especially macOS sets long TMPDIR paths.
withTmpdir ? if stdenv.hostPlatform.isDarwin then "/tmp" else null,
# This version is kind of arbitrary, we use some features that were
# implemented in newer versions of Nix, but not necessary 2.18.
# However, Lix is a fork of Nix 2.18, so this looks like a good version
# to cut specific functionality.
# ATTN: This currently doesn't disambiguate between Nix and Lix, so using this
# in a conditional needs careful checking against both Nix implementations.
withNix218 ? lib.versionAtLeast nix.version "2.18",
# passthru.tests
nixosTests,
nixVersions,
@@ -23,13 +30,6 @@
}:
let
executable = if withNgSuffix then "nixos-rebuild-ng" else "nixos-rebuild";
# This version is kind of arbitrary, we use some features that were
# implemented in newer versions of Nix, but not necessary 2.18.
# However, Lix is a fork of Nix 2.18, so this looks like a good version
# to cut specific functionality.
# ATTN: This currently doesn't disambiguate between Nix and Lix, so using this
# in a conditional needs careful checking against both Nix implementations.
withNix218 = lib.versionAtLeast nix.version "2.18";
in
python3Packages.buildPythonApplication rec {
pname = "nixos-rebuild-ng";