refactor: move rm-target service and timer to separate file
This commit is contained in:
parent
4ebfaca007
commit
0f61393bf3
2 changed files with 27 additions and 24 deletions
26
user/rm-target.nix
Normal file
26
user/rm-target.nix
Normal 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" ];
|
||||
};
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue