Skip to content

Commit 2ff53fe

Browse files
authored
nixos-rebuild-ng: fix non-flake remote build evaluation (#381511)
2 parents 37af572 + 5485a05 commit 2ff53fe

File tree

6 files changed

+763
-552
lines changed

6 files changed

+763
-552
lines changed

pkgs/by-name/ni/nixos-rebuild-ng/src/nixos_rebuild/__init__.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -389,8 +389,6 @@ def execute(argv: list[str]) -> None:
389389

390390
dry_run = action == Action.DRY_BUILD
391391
no_link = action in (Action.SWITCH, Action.BOOT)
392-
build_flags |= {"no_out_link": no_link, "dry_run": dry_run}
393-
flake_build_flags |= {"no_link": no_link, "dry_run": dry_run}
394392
rollback = bool(args.rollback)
395393

396394
def validate_image_variant(variants: ImageVariants) -> None:
@@ -444,29 +442,32 @@ def validate_image_variant(variants: ImageVariants) -> None:
444442
flake,
445443
build_host,
446444
eval_flags=flake_common_flags,
447-
flake_build_flags=flake_build_flags,
445+
flake_build_flags=flake_build_flags
446+
| {"no_link": no_link, "dry_run": dry_run},
448447
copy_flags=copy_flags,
449448
)
450449
case (_, False, None, Flake(_)):
451450
path_to_config = nix.build_flake(
452451
attr,
453452
flake,
454-
flake_build_flags=flake_build_flags,
453+
flake_build_flags=flake_build_flags
454+
| {"no_link": no_link, "dry_run": dry_run},
455455
)
456456
case (_, False, Remote(_), None):
457457
path_to_config = nix.build_remote(
458458
attr,
459459
build_attr,
460460
build_host,
461-
instantiate_flags=common_flags,
461+
realise_flags=common_flags,
462+
instantiate_flags=build_flags,
462463
copy_flags=copy_flags,
463-
build_flags=build_flags,
464464
)
465465
case (_, False, None, None):
466466
path_to_config = nix.build(
467467
attr,
468468
build_attr,
469-
build_flags=build_flags,
469+
build_flags=build_flags
470+
| {"no_out_link": no_link, "dry_run": dry_run},
470471
)
471472
case never:
472473
# should never happen, but mypy is not smart enough to

pkgs/by-name/ni/nixos-rebuild-ng/src/nixos_rebuild/nix.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
from pathlib import Path
99
from string import Template
1010
from subprocess import PIPE, CalledProcessError
11-
from typing import Final
11+
from typing import Final, Literal
1212
from uuid import uuid4
1313

1414
from . import tmpdir
@@ -77,7 +77,7 @@ def build_remote(
7777
attr: str,
7878
build_attr: BuildAttr,
7979
build_host: Remote | None,
80-
build_flags: Args | None = None,
80+
realise_flags: Args | None = None,
8181
instantiate_flags: Args | None = None,
8282
copy_flags: Args | None = None,
8383
) -> Path:
@@ -112,7 +112,7 @@ def build_remote(
112112
drv,
113113
"--add-root",
114114
remote_tmpdir / uuid4().hex,
115-
*dict_to_flags(build_flags),
115+
*dict_to_flags(realise_flags),
116116
],
117117
remote=build_host,
118118
stdout=PIPE,
@@ -554,7 +554,7 @@ def set_profile(
554554

555555
def switch_to_configuration(
556556
path_to_config: Path,
557-
action: Action,
557+
action: Literal[Action.SWITCH, Action.BOOT, Action.TEST, Action.DRY_ACTIVATE],
558558
target_host: Remote | None,
559559
sudo: bool,
560560
install_bootloader: bool = False,

0 commit comments

Comments
 (0)