summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorMalo Bourgon <mbourgon@gmail.com>2022-08-14 14:44:59 -0700
committerMalo Bourgon <mbourgon@gmail.com>2022-08-16 17:41:13 -0700
commitc027fb5ee5df3c33f9a2ce088b30100cdf3fa028 (patch)
tree80e59f08c1ec1f052e52af20d937f96f1bb3ae3c /modules
parentf75b461ae2da5de249359b17996805199e919ca7 (diff)
Update `nix.gc` module with same indenting/formatting as NixOS module
Diffstat (limited to 'modules')
-rw-r--r--modules/services/nix-gc/default.nix62
1 files changed, 38 insertions, 24 deletions
diff --git a/modules/services/nix-gc/default.nix b/modules/services/nix-gc/default.nix
index 57b3e22..d7b90da 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.user = mkOption {
- type = types.nullOr types.str;
- default = null;
- description = "User that runs the garbage collector.";
- };
+ nix.gc = {
- nix.gc.interval = mkOption {
- type = types.attrs;
- default = { Hour = 3; Minute = 15; };
- description = "The time interval at which the garbage collector will run.";
- };
+ 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 <filename>nix-collect-garbage</filename> when the
+ garbage collector is run automatically.
+ '';
+ };
- nix.gc.options = mkOption {
- type = types.str;
- default = "";
- example = "--max-freed $((64 * 1024**3))";
- description = ''
- Options given to <filename>nix-collect-garbage</filename> when the
- garbage collector is run automatically.
- '';
};
+
};
+
+ ###### implementation
+
config = mkIf cfg.automatic {
launchd.daemons.nix-gc = {