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.
This commit is contained in:
Thiago Kenji Okada
2025-12-01 13:31:13 +00:00
parent 9db474c5ae
commit b302bf69ab
5 changed files with 3 additions and 14 deletions
-1
View File
@@ -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 = ''
+1 -3
View File
@@ -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
@@ -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
@@ -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)
@@ -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"