From b302bf69ab49311bdd55557478278f1bf0cd3ffd Mon Sep 17 00:00:00 2001 From: Thiago Kenji Okada Date: Mon, 1 Dec 2025 13:31:13 +0000 Subject: [PATCH] nixos-rebuild-ng: drop withReexec option Different from `nixos-rebuild`, re-exec in `nixos-rebuild` should always work, so there shouldn't be much of an issue enabling it by default. --- nixos/modules/installer/tools/tools.nix | 1 - nixos/tests/installer.nix | 4 +--- pkgs/by-name/ni/nixos-rebuild-ng/package.nix | 7 ------- .../ni/nixos-rebuild-ng/src/nixos_rebuild/__init__.py | 4 ++-- .../ni/nixos-rebuild-ng/src/nixos_rebuild/constants.py | 1 - 5 files changed, 3 insertions(+), 14 deletions(-) diff --git a/nixos/modules/installer/tools/tools.nix b/nixos/modules/installer/tools/tools.nix index fa12f47489ff..fdaafc5f7070 100644 --- a/nixos/modules/installer/tools/tools.nix +++ b/nixos/modules/installer/tools/tools.nix @@ -70,7 +70,6 @@ let nixos-install = pkgs.nixos-install.override { }; nixos-rebuild-ng = pkgs.nixos-rebuild-ng.override { nix = config.nix.package; - withReexec = true; }; defaultFlakeTemplate = '' diff --git a/nixos/tests/installer.nix b/nixos/tests/installer.nix index ffd1680c5df8..cef75b350be5 100644 --- a/nixos/tests/installer.nix +++ b/nixos/tests/installer.nix @@ -726,9 +726,7 @@ let libxml2.bin libxslt.bin nixos-artwork.wallpapers.simple-dark-gray-bottom - (nixos-rebuild-ng.override { - withReexec = true; - }) + nixos-rebuild-ng ntp perlPackages.ConfigIniFiles perlPackages.FileSlurp diff --git a/pkgs/by-name/ni/nixos-rebuild-ng/package.nix b/pkgs/by-name/ni/nixos-rebuild-ng/package.nix index de9d27242dd7..466b349acb31 100644 --- a/pkgs/by-name/ni/nixos-rebuild-ng/package.nix +++ b/pkgs/by-name/ni/nixos-rebuild-ng/package.nix @@ -9,14 +9,12 @@ python3Packages, runCommand, scdoc, - withReexec ? false, withShellFiles ? true, # 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, # passthru.tests nixosTests, - nixos-rebuild-ng, }: let executable = "nixos-rebuild"; @@ -52,7 +50,6 @@ python3Packages.buildPythonApplication rec { postPatch = '' substituteInPlace nixos_rebuild/constants.py \ --subst-var-by executable ${executable} \ - --subst-var-by withReexec ${lib.boolToString withReexec} \ --subst-var-by withShellFiles ${lib.boolToString withShellFiles} ''; @@ -97,10 +94,6 @@ python3Packages.buildPythonApplication rec { }; tests = { - with_reexec = nixos-rebuild-ng.override { - withReexec = true; - }; - inherit (nixosTests) # FIXME: this test is disabled since it times out in @ofborg # nixos-rebuild-install-bootloader-ng diff --git a/pkgs/by-name/ni/nixos-rebuild-ng/src/nixos_rebuild/__init__.py b/pkgs/by-name/ni/nixos-rebuild-ng/src/nixos_rebuild/__init__.py index ce7108175f0c..e4fa5ef75a43 100644 --- a/pkgs/by-name/ni/nixos-rebuild-ng/src/nixos_rebuild/__init__.py +++ b/pkgs/by-name/ni/nixos-rebuild-ng/src/nixos_rebuild/__init__.py @@ -5,7 +5,7 @@ from subprocess import CalledProcessError, run from typing import Final, assert_never from . import nix, services -from .constants import EXECUTABLE, WITH_REEXEC, WITH_SHELL_FILES +from .constants import EXECUTABLE, WITH_SHELL_FILES from .models import Action, BuildAttr, Flake, GroupedNixArgs, Profile from .process import Remote from .utils import LogFormatter @@ -288,7 +288,7 @@ def execute(argv: list[str]) -> None: # Re-exec to a newer version of the script before building to ensure we get # the latest fixes - if WITH_REEXEC and can_run and not args.no_reexec: + if can_run and not args.no_reexec: services.reexec(argv, args, grouped_nix_args) profile = Profile.from_arg(args.profile_name) diff --git a/pkgs/by-name/ni/nixos-rebuild-ng/src/nixos_rebuild/constants.py b/pkgs/by-name/ni/nixos-rebuild-ng/src/nixos_rebuild/constants.py index 03d4bb79eb61..88f59111669f 100644 --- a/pkgs/by-name/ni/nixos-rebuild-ng/src/nixos_rebuild/constants.py +++ b/pkgs/by-name/ni/nixos-rebuild-ng/src/nixos_rebuild/constants.py @@ -7,5 +7,4 @@ from typing import Final EXECUTABLE: Final[str] = "@executable@" # Use either `== "true"` if the default (e.g.: `python -m nixos_rebuild`) is # `False` or `!= "false"` if the default is `True` -WITH_REEXEC: Final[bool] = "@withReexec@" == "true" WITH_SHELL_FILES: Final[bool] = "@withShellFiles@" == "true"