Update the home-manager cleanup systemd unit

This commit is contained in:
albert 2025-01-29 11:26:38 -08:00
parent bba426e844
commit 22c66acd25
Signed by: albert
GPG key ID: 3895DD267CA11BA9
2 changed files with 5 additions and 3 deletions
home-manager/common

View file

@ -1,17 +1,18 @@
{ pkgs, ... }: {
systemd.user.services.cleanup-generations = {
systemd.user.services.cleanup-home-manager = {
Unit = {
Description = "Cleanup old home-manager generations";
};
Service = {
Type = "oneshot";
ExecStart = "${pkgs.writeShellScript "cleanup-generations" ''
Environment = "PATH=${pkgs.home-manager}/bin:${pkgs.gawk}/bin:${pkgs.findutils}/bin:${pkgs.coreutils}/bin:$PATH";
ExecStart = "${pkgs.writeShellScript "cleanup-home-manager" ''
home-manager generations | tail -n +6 | awk '{print $5}' | xargs -I {} home-manager remove-generations {}
''}";
};
};
systemd.user.timers.cleanup-generations = {
systemd.user.timers.cleanup-home-manager = {
Unit = {
Description = "Timer for cleaning up old home-manager generations";
};

View file

@ -20,6 +20,7 @@
"shift+right=next_tab"
"shift+left=previous_tab"
"shift+up=toggle_tab_overview"
"ctrl+t=new_tab"
];
};
};