mirror of
https://github.com/nix-community/home-manager
synced 2024-11-26 21:19:45 +01:00
nixos: only refer to users.users
if needed
Fixes a regression of GitHub issue #594. Before this commit, attempting to dynamically configure Home Manager with contents of nixos's users.users when using the nixos module would result in infinite recursion. PR #4368
This commit is contained in:
parent
a0ad98174c
commit
ca4126e3c5
1 changed files with 18 additions and 15 deletions
|
@ -94,7 +94,15 @@ in {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config = mkIf (cfg.users != { }) {
|
config = (mkMerge [
|
||||||
|
# Fix potential recursion when configuring home-manager users based on values in users.users #594
|
||||||
|
(mkIf (cfg.useUserPackages && cfg.users != { }) {
|
||||||
|
users.users =
|
||||||
|
(mapAttrs (username: usercfg: { packages = [ usercfg.home.path ]; })
|
||||||
|
cfg.users);
|
||||||
|
environment.pathsToLink = [ "/etc/profile.d" ];
|
||||||
|
})
|
||||||
|
(mkIf (cfg.users != { }) {
|
||||||
warnings = flatten (flip mapAttrsToList cfg.users (user: config:
|
warnings = flatten (flip mapAttrsToList cfg.users (user: config:
|
||||||
flip map config.warnings (warning: "${user} profile: ${warning}")));
|
flip map config.warnings (warning: "${user} profile: ${warning}")));
|
||||||
|
|
||||||
|
@ -103,11 +111,6 @@ in {
|
||||||
inherit (assertion) assertion;
|
inherit (assertion) assertion;
|
||||||
message = "${user} profile: ${assertion.message}";
|
message = "${user} profile: ${assertion.message}";
|
||||||
})));
|
})));
|
||||||
|
})
|
||||||
users.users = mkIf cfg.useUserPackages
|
]);
|
||||||
(mapAttrs (username: usercfg: { packages = [ usercfg.home.path ]; })
|
|
||||||
cfg.users);
|
|
||||||
|
|
||||||
environment.pathsToLink = mkIf cfg.useUserPackages [ "/etc/profile.d" ];
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue