diff --git a/profiles/workspace/xdg.nix b/profiles/workspace/xdg.nix index 853edc9..4f6d060 100644 --- a/profiles/workspace/xdg.nix +++ b/profiles/workspace/xdg.nix @@ -4,15 +4,24 @@ xdg.userDirs.enable = true; }; - environment.sessionVariables = { - DE = "generic"; + environment.sessionVariables = { DE = "generic"; }; + + systemd.user.services.cleanup-home-dirs = let + home-conf = config.home-manager.users.${config.mainuser}; + days = "30"; + folders = map (x: home-conf.home.homeDirectory + "/" + x) [ "Downloads" ]; + in { + serviceConfig.Type = "oneshot"; + script = '' + ${builtins.concatStringsSep "\n" (map (x: + "find ${ + lib.escapeShellArg x + } -mtime +${days} -exec rm -rv {} + -depth;") + folders)} + ''; + wantedBy = [ "default.target" ]; }; - persist.state.homeDirectories = [ - "Documents" - "Downloads" - "Music" - "Pictures" - "Videos" - ]; -} \ No newline at end of file + persist.state.homeDirectories = + [ "Documents" "Downloads" "Music" "Pictures" "Videos" ]; +}