diff --git a/modules/services/nix-gc/default.nix b/modules/services/nix-gc/default.nix
index 57b3e22d..d7b90da6 100644
--- a/modules/services/nix-gc/default.nix
+++ b/modules/services/nix-gc/default.nix
@@ -1,4 +1,6 @@
-{ config, lib, pkgs, ... }:
+# Based off: https://github.com/NixOS/nixpkgs/blob/master/nixos/modules/services/misc/nix-gc.nix
+# When making changes please try to keep it in sync.
+{ config, lib, ... }:
with lib;
@@ -7,36 +9,48 @@ let
in
{
+
+ ###### interface
+
options = {
- nix.gc.automatic = mkOption {
- type = types.bool;
- default = false;
- description = "Automatically run the garbage collector at a specific time.";
+
+ nix.gc = {
+
+ automatic = mkOption {
+ type = types.bool;
+ default = false;
+ description = "Automatically run the garbage collector at a specific time.";
+ };
+
+ user = mkOption {
+ type = types.nullOr types.str;
+ default = null;
+ description = "User that runs the garbage collector.";
+ };
+
+ interval = mkOption {
+ type = types.attrs;
+ default = { Hour = 3; Minute = 15; };
+ description = "The time interval at which the garbage collector will run.";
+ };
+
+ options = mkOption {
+ type = types.str;
+ default = "";
+ example = "--max-freed $((64 * 1024**3))";
+ description = ''
+ Options given to nix-collect-garbage when the
+ garbage collector is run automatically.
+ '';
+ };
+
};
- nix.gc.user = mkOption {
- type = types.nullOr types.str;
- default = null;
- description = "User that runs the garbage collector.";
- };
-
- nix.gc.interval = mkOption {
- type = types.attrs;
- default = { Hour = 3; Minute = 15; };
- description = "The time interval at which the garbage collector will run.";
- };
-
- nix.gc.options = mkOption {
- type = types.str;
- default = "";
- example = "--max-freed $((64 * 1024**3))";
- description = ''
- Options given to nix-collect-garbage when the
- garbage collector is run automatically.
- '';
- };
};
+
+ ###### implementation
+
config = mkIf cfg.automatic {
launchd.daemons.nix-gc = {