storage: automatically cleanup old files

This commit is contained in:
lelgenio 2023-08-08 17:55:13 -03:00
parent edeab9f843
commit 27cc126d4a
2 changed files with 21 additions and 0 deletions

View file

@ -44,6 +44,7 @@
services.flatpak.enable = true; services.flatpak.enable = true;
virtualisation.docker.enable = true; virtualisation.docker.enable = true;
virtualisation.docker.autoPrune.enable = true; virtualisation.docker.autoPrune.enable = true;
virtualisation.docker.autoPrune.flags = [ "--all --volumes" ];
programs.firejail.enable = true; programs.firejail.enable = true;
security.rtkit.enable = true; security.rtkit.enable = true;

View file

@ -181,6 +181,26 @@
exec nicotine exec nicotine
''; '';
systemd.user.services.rm-target = {
Unit = {
Description = "Remove directories named 'target'";
};
Service = {
Type = "oneshot";
ExecStart = pkgs.writeShellScript "rm-target" ''
sudo ${pkgs.fd}/bin/fd -td -u '^\.?target$' "$HOME" -x rm -vrf --
'';
};
};
systemd.user.timers.rm-target = {
Unit = { Description = "Remove directories named 'target'"; };
Timer = {
OnCalendar = "weekly";
Unit = "rm-target.service";
};
Install = { WantedBy = [ "timers.target" ]; };
};
# This value determines the Home Manager release that your # This value determines the Home Manager release that your
# configuration is compatible with. This helps avoid breakage # configuration is compatible with. This helps avoid breakage
# when a new Home Manager release introduces backwards # when a new Home Manager release introduces backwards