From bd82507edd860c453471c46957cbbe3c9fd01b5c Mon Sep 17 00:00:00 2001 From: Robert Helgesson Date: Thu, 31 Jul 2025 00:31:48 +0200 Subject: [PATCH] home-manager: re-enable gcroot handling for NixOS module It was a bit too ambitious to also remove production of the gcroot, we need it to keep track of the currently active Home Manager configuration. Fixes #7583 --- nixos/default.nix | 6 ------ tests/integration/nixos/basics.nix | 11 +++++------ 2 files changed, 5 insertions(+), 12 deletions(-) diff --git a/nixos/default.nix b/nixos/default.nix index 25defb1a6..793b02fa0 100644 --- a/nixos/default.nix +++ b/nixos/default.nix @@ -36,12 +36,6 @@ in # Inherit glibcLocales setting from NixOS. i18n.glibcLocales = lib.mkDefault config.i18n.glibcLocales; - - # Legacy profile management is when the activation script - # generates GC root and home-manager profile. The modern way - # simply relies on the GC root that the system maintains, which - # should also protect the Home Manager activation package outputs. - home.activationGenerateGcRoot = cfg.enableLegacyProfileManagement; }; } ]; diff --git a/tests/integration/nixos/basics.nix b/tests/integration/nixos/basics.nix index 189aa7588..cb6db390a 100644 --- a/tests/integration/nixos/basics.nix +++ b/tests/integration/nixos/basics.nix @@ -82,16 +82,15 @@ logout_alice() - with subtest("no GC root and profile"): - # There should be no GC root and Home Manager profile since we are not + with subtest("no profile management"): + # There should be no Home Manager profile since we are not # using legacy profile management. - hmState = "/home/alice/.local/state/home-manager" - machine.succeed(f"test ! -e {hmState}") - hmProfile = "/home/alice/.local/state/nix/profiles/home-manager" machine.succeed(f"test ! -e {hmProfile}") + # There should be a gcroot, however since we want to keep track of which + # generation is currently enabled. hmGcroot = "/home/alice/.local/state/home-manager/gcroots/current-home" - machine.succeed(f"test ! -e {hmGcroot}") + machine.succeed(f"test -e {hmGcroot}") ''; }