refactor: move rm-target service and timer to separate file

This commit is contained in:
Leonardo Eugênio 2025-03-26 21:58:24 -03:00
parent 4ebfaca007
commit 0f61393bf3
No known key found for this signature in database
GPG key ID: 2F8F21CE8721456B
2 changed files with 27 additions and 24 deletions

26
user/rm-target.nix Normal file
View file

@ -0,0 +1,26 @@
{ pkgs, lib, ... }:
{
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" ];
};
};
}