31 lines
843 B
Nix
31 lines
843 B
Nix
{
|
|
config,
|
|
inputs,
|
|
lib,
|
|
...
|
|
}:
|
|
let
|
|
users = lib.attrsets.filterAttrs (_: config: config.isNormalUser) config.users.users;
|
|
in
|
|
{
|
|
programs.fuse.userAllowOther = lib.mkIf (users != [ ]) true;
|
|
|
|
systemd.tmpfiles.rules = lib.mkIf (users != [ ]) (
|
|
[
|
|
"d /persist/home 0755 root root -"
|
|
"d /cache/home 0755 root root -"
|
|
]
|
|
++ lib.attrsets.mapAttrsToList (user: config: "d /persist${config.home} 0700 ${user} users -") users
|
|
++ lib.attrsets.mapAttrsToList (user: config: "d /cache${config.home} 0700 ${user} users -") users
|
|
);
|
|
|
|
home-manager.users = lib.attrsets.mapAttrs (user: config: {
|
|
imports = [ inputs.impermanence.nixosModules.home-manager.impermanence ];
|
|
|
|
home.persistence = {
|
|
"/persist${config.home}".allowOther = true;
|
|
"/cache${config.home}".allowOther = true;
|
|
};
|
|
}) users;
|
|
}
|