feat(users): cleanup old home-manager profiles
This commit is contained in:
parent
6d363ea446
commit
dc9251000e
|
@ -29,6 +29,7 @@ in {
|
|||
imports = [
|
||||
../modules/boilr.nix
|
||||
../modules/restic-backup.nix
|
||||
../modules/profiles-cleanup.nix
|
||||
];
|
||||
|
||||
config = {
|
||||
|
@ -48,6 +49,8 @@ in {
|
|||
};
|
||||
};
|
||||
|
||||
xdg.enable = true;
|
||||
|
||||
# Make sure firefox is my default browser
|
||||
programs.firefox.enable = true;
|
||||
|
||||
|
|
|
@ -118,6 +118,7 @@ in {
|
|||
./nb.nix
|
||||
../modules/restic-backup.nix
|
||||
../modules/colors.nix
|
||||
../modules/profiles-cleanup.nix
|
||||
];
|
||||
|
||||
config = {
|
||||
|
@ -208,6 +209,8 @@ in {
|
|||
};
|
||||
};
|
||||
|
||||
xdg.enable = true;
|
||||
|
||||
# Make sure firefox is my default browser
|
||||
programs.firefox.enable = true;
|
||||
|
||||
|
|
|
@ -18,7 +18,10 @@
|
|||
];
|
||||
}));
|
||||
in {
|
||||
imports = [../modules/restic-backup.nix];
|
||||
imports = [
|
||||
../modules/restic-backup.nix
|
||||
../modules/profiles-cleanup.nix
|
||||
];
|
||||
|
||||
config = {
|
||||
home.packages = with pkgs; [
|
||||
|
@ -46,6 +49,8 @@ in {
|
|||
programs.broot.enable = true;
|
||||
programs.fish.enable = true;
|
||||
|
||||
xdg.enable = true;
|
||||
|
||||
services.restic = {
|
||||
enable = true;
|
||||
paths = ["/home/marie/Uni" "/home/marie/Bilder" "/home/marie/Promotion"];
|
||||
|
|
38
users/modules/profiles-cleanup.nix
Normal file
38
users/modules/profiles-cleanup.nix
Normal file
|
@ -0,0 +1,38 @@
|
|||
{
|
||||
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"];
|
||||
};
|
||||
};
|
||||
}
|
Loading…
Reference in a new issue