nixos-rebuild-ng: add FLAKE_FLAGS to nix copy (#419594)

This commit is contained in:
Thiago Kenji Okada
2025-06-24 22:02:37 +01:00
committed by GitHub
4 changed files with 12 additions and 7 deletions
+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";
@@ -210,6 +210,7 @@ def copy_closure(
run_wrapper(
[
"nix",
*FLAKE_FLAGS,
"copy",
*dict_to_flags(copy_flags),
"--from",
@@ -688,6 +688,8 @@ def test_execute_nix_switch_build_target_host(
call(
[
"nix",
"--extra-experimental-features",
"nix-command flakes",
"copy",
"--from",
"ssh://user@build-host",
@@ -263,6 +263,8 @@ def test_copy_closure(monkeypatch: MonkeyPatch) -> None:
mock_run.assert_called_with(
[
"nix",
"--extra-experimental-features",
"nix-command flakes",
"copy",
"--copy-flag",
"--from",