mirror of
https://github.com/nix-community/home-manager.git
synced 2025-11-08 11:36:05 +01:00
home-manager: avoid profile management during activation
This commit deprecates profile management from the activation script. The profile management is instead the responsibility of the driving software, for example, the `home-manager` tool in the case of standalone installs. The legacy behavior is still available for backwards compatibility but may be removed in the future. The new behavior resolves (or moves us closer to resolving) a number of long standing open issues: - `home-manager switch --rollback`, which performs a rollback to the previous Home Manager generation before activating. While it was previously possible to accomplish this by activating an old generation, it did always create a new profile generation. This option has been implemented as part of this commit. - `home-manager switch --specialisation NAME`, which switches to the named specialisation. While it was previously possible to accomplish this by manually running the specialisation activate script, it did always create a new profile generation. This option has been implemented as part of this commit. - `home-manager switch --test`, which activates the configuration but does not create a new profile generation. This option has _not_ been implemented here since it relies on the current configuration being activated on login, which we do not currently do. - When using the "Home Manager as a NixOS module" installation method we previously created an odd `home-manager` per-user "shadow profile" for the user. This is no longer necessary. This has been implemented as part of this commit. Fixes #3450
This commit is contained in:
parent
e4bf85da68
commit
de448dcb57
21 changed files with 692 additions and 127 deletions
|
|
@ -36,6 +36,12 @@ 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;
|
||||
};
|
||||
}
|
||||
];
|
||||
|
|
@ -46,6 +52,7 @@ in
|
|||
_: usercfg:
|
||||
let
|
||||
username = usercfg.home.username;
|
||||
driverVersion = if cfg.enableLegacyProfileManagement then "0" else "1";
|
||||
in
|
||||
lib.nameValuePair "home-manager-${utils.escapeSystemdPath username}" {
|
||||
description = "Home Manager environment for ${username}";
|
||||
|
|
@ -94,7 +101,7 @@ in
|
|||
| ${sed} -En '/^(${exportedSystemdVariables})=/s/^/export /p'
|
||||
)"
|
||||
|
||||
exec "$1/activate"
|
||||
exec "$1/activate" --driver-version ${driverVersion}
|
||||
'';
|
||||
in
|
||||
"${setupEnv} ${usercfg.home.activationPackage}";
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue