From 247436669ddbed2bc9981957c722bedc906f431e Mon Sep 17 00:00:00 2001 From: Qyriad Date: Wed, 22 Apr 2026 14:17:56 +0200 Subject: [PATCH] upgrade-nix: use --store local, so we don't kill our own access to the daemon [backport] Backported from https://gerrit.lix.systems/c/lix/+/5504, to fix https://git.lix.systems/lix-project/lix/issues/1207 Change-Id: Id7de28bf81eb122dd60755622b7816716a6a6964 --- doc/manual/rl-next/fix-upgrade-nix.md | 9 +++++++++ lix/nix/upgrade-nix.cc | 4 ++++ misc/upgrade-lix.sh | 3 +++ 3 files changed, 16 insertions(+) create mode 100644 doc/manual/rl-next/fix-upgrade-nix.md diff --git a/doc/manual/rl-next/fix-upgrade-nix.md b/doc/manual/rl-next/fix-upgrade-nix.md new file mode 100644 index 000000000..91f5f229f --- /dev/null +++ b/doc/manual/rl-next/fix-upgrade-nix.md @@ -0,0 +1,9 @@ +--- +synopsis: "Fix upgrade-nix breaking its own access to the daemon" +cls: [5504, 5567] +category: "Fixes" +issues: [fj#1189, fj#1207] +credits: [Qyriad] +--- + +`nix upgrade-nix`, and the helper script `misc/upgrade-lix.sh` now pass `--store local` to all Nix commands, so the upgrade process can make changes to the daemon without breaking further steps in the upgrade. diff --git a/lix/nix/upgrade-nix.cc b/lix/nix/upgrade-nix.cc index 6617b4818..cc3384f4a 100644 --- a/lix/nix/upgrade-nix.cc +++ b/lix/nix/upgrade-nix.cc @@ -141,6 +141,8 @@ struct CmdUpgradeNix : MixDryRun, EvalCommand // install the new one, in case the new and old versions aren't considered // to be "the same package" by nix-env's logic (e.g., if their pnames differ). Strings removeArgs = { + "--store", + "local", "--uninstall", oldNixEnv, "--profile", @@ -150,6 +152,8 @@ struct CmdUpgradeNix : MixDryRun, EvalCommand aio().blockOn(runProgram(newNixEnv, false, removeArgs)); Strings upgradeArgs = { + "--store", + "local", "--profile", this->profileDir, "--install", diff --git a/misc/upgrade-lix.sh b/misc/upgrade-lix.sh index 664e919ae..34689eed3 100755 --- a/misc/upgrade-lix.sh +++ b/misc/upgrade-lix.sh @@ -124,9 +124,12 @@ checkSystemdService set -x exec "$NIX" run \ + --store local \ --extra-experimental-features "nix-command flakes" \ "${SUBSTITUTER_ARGS[@]}" \ "${LIX_BASE}?ref=${LIX_REF}" \ + -- \ + --store local \ --extra-experimental-features "nix-command flakes" \ upgrade-nix \ "${SUBSTITUTER_ARGS[@]}"