diff --git a/user/home-manager.nix b/user/home-manager.nix new file mode 100644 index 0000000..9c8452a --- /dev/null +++ b/user/home-manager.nix @@ -0,0 +1,28 @@ +{ pkgs, lib, ... }: +{ + programs.home-manager.enable = true; + + systemd.user.services.home-manager-expire = { + Unit = { + Description = "Remove old home-manager generations"; + }; + Service = { + Type = "oneshot"; + ExecStart = pkgs.writeShellScript "home-manager-expire" '' + ${lib.getExe pkgs.home-manager} expire-generations 7d + ''; + }; + }; + systemd.user.timers.home-manager-expire = { + Unit = { + Description = "Remove old home-manager generations"; + }; + Timer = { + OnCalendar = "daily"; + Unit = "home-manager-expire.service"; + }; + Install = { + WantedBy = [ "timers.target" ]; + }; + }; +} diff --git a/user/home.nix b/user/home.nix index 271ceee..31e3871 100644 --- a/user/home.nix +++ b/user/home.nix @@ -9,6 +9,7 @@ { imports = [ ./dummy.nix + ./home-manager.nix ./waybar ./helix.nix ./kakoune @@ -58,8 +59,6 @@ home.username = "lelgenio"; home.homeDirectory = "/home/lelgenio"; - # Let Home Manager install and manage itself. - programs.home-manager.enable = true; home.packages = with pkgs; [ terminal