1
0
Fork 0
mirror of https://github.com/nix-community/home-manager.git synced 2024-12-14 11:57:55 +00:00

home-environment: use per-user profile path in /etc

Before the profile directory value would point directly to the build
output in the Nix store. Unfortunately this would cause an infinite
loop if the user's configuration directly or indirectly refers to the
profile directory value.

Fixes #1188
This commit is contained in:
Robert Helgesson 2020-06-17 23:33:13 +02:00
parent 1a8ab9d9de
commit a49ce0e9ed
No known key found for this signature in database
GPG key ID: 36BDAA14C2797E89
3 changed files with 5 additions and 1 deletions

View file

@ -402,7 +402,7 @@ in
home.profileDirectory =
if config.submoduleSupport.enable
&& config.submoduleSupport.externalPackageInstall
then config.home.path
then "/etc/profiles/per-user/${cfg.username}"
else cfg.homeDirectory + "/.nix-profile";
home.sessionVariables =

View file

@ -72,6 +72,8 @@ in
}) cfg.users
);
environment.pathsToLink = mkIf cfg.useUserPackages [ "/etc/profile.d" ];
system.activationScripts.postActivation.text =
concatStringsSep "\n" (mapAttrsToList (username: usercfg: ''
echo Activating home-manager configuration for ${username}

View file

@ -88,6 +88,8 @@ in {
(mapAttrs (username: usercfg: { packages = [ usercfg.home.path ]; })
cfg.users);
environment.pathsToLink = mkIf cfg.useUserPackages [ "/etc/profile.d" ];
systemd.services = mapAttrs' (_: usercfg:
let username = usercfg.home.username;
in nameValuePair ("home-manager-${utils.escapeSystemdPath username}") {