39 lines
1 KiB
Nix
39 lines
1 KiB
Nix
{
|
|
pkgs,
|
|
lib,
|
|
config,
|
|
...
|
|
}: {
|
|
# This is a fix for https://github.com/nix-community/home-manager/issues/4672
|
|
systemd.user = lib.trace "Clean up HM systemd service configured. Has https://github.com/nix-community/home-manager/issues/4672 been fixed yet?" {
|
|
services = {
|
|
home-manager-profiles-cleanup = {
|
|
Unit.Description = "Clean up HM user profiles.";
|
|
|
|
Service = {
|
|
Type = "oneshot";
|
|
ExecStart = lib.getExe (pkgs.writeShellApplication {
|
|
name = "home-manager-profiles-cleanup-start-script";
|
|
text = ''
|
|
${lib.getExe config.nix.package} profile wipe-history \
|
|
--profile "${config.xdg.stateHome}/nix/profiles/home-manager" \
|
|
--older-than '30d'
|
|
'';
|
|
});
|
|
};
|
|
};
|
|
};
|
|
|
|
timers.home-manager-profiles-cleanup = {
|
|
Unit.Description = "Clean up HM user profiles.";
|
|
|
|
Timer = {
|
|
OnCalendar = "weekly";
|
|
Persistent = true;
|
|
};
|
|
|
|
Install.WantedBy = ["timers.target"];
|
|
};
|
|
};
|
|
}
|