Merge pull request #282320 from helsinki-systems/fix/nix-gc-unit-type
nixos/nix-gc: Minor module fixups
This commit is contained in:
commit
3ea482163b
1 changed files with 12 additions and 13 deletions
|
@ -1,7 +1,5 @@
|
|||
{ config, lib, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
cfg = config.nix.gc;
|
||||
in
|
||||
|
@ -14,14 +12,14 @@ in
|
|||
|
||||
nix.gc = {
|
||||
|
||||
automatic = mkOption {
|
||||
automatic = lib.mkOption {
|
||||
default = false;
|
||||
type = types.bool;
|
||||
type = lib.types.bool;
|
||||
description = lib.mdDoc "Automatically run the garbage collector at a specific time.";
|
||||
};
|
||||
|
||||
dates = mkOption {
|
||||
type = types.str;
|
||||
dates = lib.mkOption {
|
||||
type = lib.types.singleLineStr;
|
||||
default = "03:15";
|
||||
example = "weekly";
|
||||
description = lib.mdDoc ''
|
||||
|
@ -33,9 +31,9 @@ in
|
|||
'';
|
||||
};
|
||||
|
||||
randomizedDelaySec = mkOption {
|
||||
randomizedDelaySec = lib.mkOption {
|
||||
default = "0";
|
||||
type = types.str;
|
||||
type = lib.types.singleLineStr;
|
||||
example = "45min";
|
||||
description = lib.mdDoc ''
|
||||
Add a randomized delay before each garbage collection.
|
||||
|
@ -45,9 +43,9 @@ in
|
|||
'';
|
||||
};
|
||||
|
||||
persistent = mkOption {
|
||||
persistent = lib.mkOption {
|
||||
default = true;
|
||||
type = types.bool;
|
||||
type = lib.types.bool;
|
||||
example = false;
|
||||
description = lib.mdDoc ''
|
||||
Takes a boolean argument. If true, the time when the service
|
||||
|
@ -61,10 +59,10 @@ in
|
|||
'';
|
||||
};
|
||||
|
||||
options = mkOption {
|
||||
options = lib.mkOption {
|
||||
default = "";
|
||||
example = "--max-freed $((64 * 1024**3))";
|
||||
type = types.str;
|
||||
type = lib.types.singleLineStr;
|
||||
description = lib.mdDoc ''
|
||||
Options given to {file}`nix-collect-garbage` when the
|
||||
garbage collector is run automatically.
|
||||
|
@ -89,7 +87,8 @@ in
|
|||
systemd.services.nix-gc = lib.mkIf config.nix.enable {
|
||||
description = "Nix Garbage Collector";
|
||||
script = "exec ${config.nix.package.out}/bin/nix-collect-garbage ${cfg.options}";
|
||||
startAt = optional cfg.automatic cfg.dates;
|
||||
serviceConfig.Type = "oneshot";
|
||||
startAt = lib.optional cfg.automatic cfg.dates;
|
||||
};
|
||||
|
||||
systemd.timers.nix-gc = lib.mkIf cfg.automatic {
|
||||
|
|
Loading…
Reference in a new issue