Dmitriy Kholkin e965d93842
Some checks failed
Build ISO / build (push) Has been cancelled
huge cleanup and refactoring
2024-01-21 19:29:36 +03:00

33 lines
845 B
Nix

{ config, pkgs, lib, ... }:
let
dirsToClean = [
"Downloads"
];
olderThanDays = "14";
in {
home-manager.users.${config.mainuser} = {
xdg.enable = true;
xdg.userDirs.enable = true;
};
environment.sessionVariables = { DE = "generic"; };
systemd.user.services.cleanup-home-dirs = let
home-conf = config.home-manager.users.${config.mainuser};
directories = map (x: home-conf.home.homeDirectory + "/" + x) dirsToClean;
in {
serviceConfig.Type = "oneshot";
script = ''
${builtins.concatStringsSep "\n" (map (x:
"find ${
lib.escapeShellArg x
} -mtime +${olderThanDays} -exec rm -rv {} + -depth;")
directories)}
'';
wantedBy = [ "default.target" ];
};
persist.state.homeDirectories =
[ "Books" "Documents" "Downloads" "Music" "Pictures" "Videos" ];
}