Skip to content

Commit f25fb0d

Browse files
committed
nixos-rebuild-ng: fix eval flags for nix.build_remote_flake
1 parent a376797 commit f25fb0d

File tree

4 files changed

+24
-24
lines changed

4 files changed

+24
-24
lines changed

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

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -43,19 +43,19 @@ def get_parser() -> tuple[argparse.ArgumentParser, dict[str, argparse.ArgumentPa
4343
common_build_flags.add_argument("--print-build-logs", "-L", action="store_true")
4444
common_build_flags.add_argument("--show-trace", action="store_true")
4545

46-
flake_build_flags = argparse.ArgumentParser(add_help=False)
47-
flake_build_flags.add_argument("--accept-flake-config", action="store_true")
48-
flake_build_flags.add_argument("--refresh", action="store_true")
49-
flake_build_flags.add_argument("--impure", action="store_true")
50-
flake_build_flags.add_argument("--offline", action="store_true")
51-
flake_build_flags.add_argument("--no-net", action="store_true")
52-
flake_build_flags.add_argument("--recreate-lock-file", action="store_true")
53-
flake_build_flags.add_argument("--no-update-lock-file", action="store_true")
54-
flake_build_flags.add_argument("--no-write-lock-file", action="store_true")
55-
flake_build_flags.add_argument("--no-registries", action="store_true")
56-
flake_build_flags.add_argument("--commit-lock-file", action="store_true")
57-
flake_build_flags.add_argument("--update-input")
58-
flake_build_flags.add_argument("--override-input", nargs=2)
46+
flake_common_flags = argparse.ArgumentParser(add_help=False)
47+
flake_common_flags.add_argument("--accept-flake-config", action="store_true")
48+
flake_common_flags.add_argument("--refresh", action="store_true")
49+
flake_common_flags.add_argument("--impure", action="store_true")
50+
flake_common_flags.add_argument("--offline", action="store_true")
51+
flake_common_flags.add_argument("--no-net", action="store_true")
52+
flake_common_flags.add_argument("--recreate-lock-file", action="store_true")
53+
flake_common_flags.add_argument("--no-update-lock-file", action="store_true")
54+
flake_common_flags.add_argument("--no-write-lock-file", action="store_true")
55+
flake_common_flags.add_argument("--no-registries", action="store_true")
56+
flake_common_flags.add_argument("--commit-lock-file", action="store_true")
57+
flake_common_flags.add_argument("--update-input")
58+
flake_common_flags.add_argument("--override-input", nargs=2)
5959

6060
classic_build_flags = argparse.ArgumentParser(add_help=False)
6161
classic_build_flags.add_argument("--no-build-output", "-Q", action="store_true")
@@ -74,7 +74,7 @@ def get_parser() -> tuple[argparse.ArgumentParser, dict[str, argparse.ArgumentPa
7474
sub_parsers = {
7575
"common_flags": common_flags,
7676
"common_build_flags": common_build_flags,
77-
"flake_build_flags": flake_build_flags,
77+
"flake_common_flags": flake_common_flags,
7878
"classic_build_flags": classic_build_flags,
7979
"copy_flags": copy_flags,
8080
}
@@ -327,7 +327,8 @@ def execute(argv: list[str]) -> None:
327327
common_flags = vars(args_groups["common_flags"])
328328
common_build_flags = common_flags | vars(args_groups["common_build_flags"])
329329
build_flags = common_build_flags | vars(args_groups["classic_build_flags"])
330-
flake_build_flags = common_build_flags | vars(args_groups["flake_build_flags"])
330+
flake_common_flags = common_flags | vars(args_groups["flake_common_flags"])
331+
flake_build_flags = common_build_flags | flake_common_flags
331332
copy_flags = common_flags | vars(args_groups["copy_flags"])
332333

333334
if args.upgrade or args.upgrade_all:
@@ -410,9 +411,9 @@ def execute(argv: list[str]) -> None:
410411
attr,
411412
flake,
412413
build_host,
414+
eval_flags=flake_common_flags,
413415
flake_build_flags=flake_build_flags,
414416
copy_flags=copy_flags,
415-
build_flags=build_flags,
416417
)
417418
case (_, False, None, Flake(_)):
418419
path_to_config = nix.build_flake(

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
@@ -128,9 +128,9 @@ def build_remote_flake(
128128
attr: str,
129129
flake: Flake,
130130
build_host: Remote,
131-
flake_build_flags: Args | None = None,
131+
eval_flags: Args | None = None,
132132
copy_flags: Args | None = None,
133-
build_flags: Args | None = None,
133+
flake_build_flags: Args | None = None,
134134
) -> Path:
135135
r = run_wrapper(
136136
[
@@ -139,7 +139,7 @@ def build_remote_flake(
139139
"eval",
140140
"--raw",
141141
flake.to_attr(attr, "drvPath"),
142-
*dict_to_flags(flake_build_flags),
142+
*dict_to_flags(eval_flags),
143143
],
144144
stdout=PIPE,
145145
)
@@ -152,7 +152,7 @@ def build_remote_flake(
152152
"build",
153153
f"{drv}^*",
154154
"--print-out-paths",
155-
*dict_to_flags(build_flags),
155+
*dict_to_flags(flake_build_flags),
156156
],
157157
remote=build_host,
158158
stdout=PIPE,

pkgs/by-name/ni/nixos-rebuild-ng/src/tests/test_main.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,6 @@ def run_side_effect(args: list[str], **kwargs: Any) -> CompletedProcess[str]:
349349
"eval",
350350
"--raw",
351351
"/path/to/config#nixosConfigurations.hostname.config.system.build.toplevel.drvPath",
352-
"--no-link",
353352
],
354353
check=True,
355354
stdout=PIPE,
@@ -372,7 +371,7 @@ def run_side_effect(args: list[str], **kwargs: Any) -> CompletedProcess[str]:
372371
"build",
373372
f"'{config_path}^*'",
374373
"--print-out-paths",
375-
"--no-out-link",
374+
"--no-link",
376375
],
377376
check=True,
378377
stdout=PIPE,

pkgs/by-name/ni/nixos-rebuild-ng/src/tests/test_nix.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,9 +174,9 @@ def test_build_remote_flake(mock_run: Any, monkeypatch: Any) -> None:
174174
"config.system.build.toplevel",
175175
flake,
176176
build_host,
177-
flake_build_flags={"flake": True},
177+
eval_flags={"flake": True},
178178
copy_flags={"copy": True},
179-
build_flags={"build": True},
179+
flake_build_flags={"build": True},
180180
) == Path("/path/to/file")
181181
mock_run.assert_has_calls(
182182
[

0 commit comments

Comments
 (0)