summary refs log tree commit diff stats
path: root/user
diff options
context:
space:
mode:
authorAlan Pearce2023-04-02 20:26:42 +0200
committerAlan Pearce2023-04-02 20:26:42 +0200
commit74faf88c4f59a235c598cc9fdc76b2e07b9e4c39 (patch)
tree4508b2ec329ad256a38eb6f03ecfa34b4ee9c342 /user
parent843c2c669e0545eea3c2b7876aa6b83b24de03b6 (diff)
downloadnixfiles-74faf88c4f59a235c598cc9fdc76b2e07b9e4c39.tar.lz
nixfiles-74faf88c4f59a235c598cc9fdc76b2e07b9e4c39.tar.zst
nixfiles-74faf88c4f59a235c598cc9fdc76b2e07b9e4c39.zip
darwin: auto-expire old home-manager generations
Diffstat (limited to 'user')
-rw-r--r--user/settings/darwin.nix23
1 files changed, 23 insertions, 0 deletions
diff --git a/user/settings/darwin.nix b/user/settings/darwin.nix
index 740b4314..fb6cf196 100644
--- a/user/settings/darwin.nix
+++ b/user/settings/darwin.nix
@@ -42,6 +42,29 @@
 
   home.file.".hushlogin".text = "";
 
+  launchd.agents = {
+    home-manager-expire-generations = {
+      enable = true;
+
+      config = {
+        ProgramArguments = [
+          "${pkgs.home-manager}/bin/home-manager"
+          "expire-generations"
+          "-30 days"
+        ];
+        KeepAlive = false;
+        RunAtLoad = false;
+        StartCalendarInterval = [{
+          Hour = 12;
+          Minute = 00;
+          Weekday = 6; # Saturday
+        }];
+        ProcessType = "Background";
+        LowPriorityBackgroundIO = true;
+      };
+    };
+  };
+
   programs.zsh.shellAliases = {
     da = "darwin-rebuild";
     das = "darwin-rebuild switch";