From fc9367a9ec8ce3527291fc3bfc1b12c0260bc676 Mon Sep 17 00:00:00 2001 From: Emily Date: Mon, 10 Feb 2025 19:14:24 +0000 Subject: [PATCH] nix-gc: check for `nix.enable` This was added to Nixpkgs in eb8b70c020e6693b29634660fa173d7f14f882eb. --- modules/services/nix-gc/default.nix | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/modules/services/nix-gc/default.nix b/modules/services/nix-gc/default.nix index 44278e6..b8d5c4d 100644 --- a/modules/services/nix-gc/default.nix +++ b/modules/services/nix-gc/default.nix @@ -56,13 +56,18 @@ in ###### implementation - config = mkIf cfg.automatic { + config = { + assertions = [ + { + assertion = cfg.automatic -> config.nix.enable; + message = ''nix.gc.automatic requires nix.enable''; + } + ]; - launchd.daemons.nix-gc = { + launchd.daemons.nix-gc = mkIf cfg.automatic { command = "${config.nix.package}/bin/nix-collect-garbage ${cfg.options}"; serviceConfig.RunAtLoad = false; serviceConfig.StartCalendarInterval = cfg.interval; }; - }; }