39 lines
936 B
Nix
39 lines
936 B
Nix
{
|
|
pkgs,
|
|
lib,
|
|
config,
|
|
...
|
|
}: {
|
|
# This is a fix for https://github.com/nix-community/home-manager/issues/4672
|
|
systemd.user = {
|
|
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"];
|
|
};
|
|
};
|
|
}
|