Skip to content

Commit

Permalink
nixos/docuum: add missing options
Browse files Browse the repository at this point in the history
  • Loading branch information
mkg20001 committed Jun 19, 2024
1 parent 354a172 commit a4776f9
Showing 1 changed file with 27 additions and 3 deletions.
30 changes: 27 additions & 3 deletions nixos/modules/services/admin/docuum.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

let
cfg = config.services.docuum;
inherit (lib) mkIf mkEnableOption mkOption getExe types;
inherit (lib) mkIf mkEnableOption mkOption getExe types optionals concatMap;
in
{
options.services.docuum = {
Expand All @@ -14,6 +14,27 @@ in
default = "10 GB";
example = "50%";
};

minAge = mkOption {
description = "Sets the minimum age of images to be considered for deletion.";
type = types.nullOr types.str;
default = null;
example = "1d";
};

keep = mkOption {
description = "Prevents deletion of images for which repository:tag matches the specified regex.";
type = types.listOf types.str;
default = [];
example = [ "^my-image" ];
};

deletionChunkSize = mkOption {
description = "Removes specified quantity of images at a time.";
type = types.int;
default = 1;
example = 10;
};
};

config = mkIf cfg.enable {
Expand All @@ -35,10 +56,13 @@ in
DynamicUser = true;
StateDirectory = "docuum";
SupplementaryGroups = [ "docker" ];
ExecStart = utils.escapeSystemdExecArgs [
ExecStart = utils.escapeSystemdExecArgs ([
(getExe pkgs.docuum)
"--threshold" cfg.threshold
];
"--deletion-chunk-size" cfg.deletionChunkSize
] ++ (concatMap (keep: [ "--keep" keep ]) cfg.keep)
++ (optionals (cfg.minAge != null) [ "--min-age" cfg.minAge ])
);
};
};
};
Expand Down

0 comments on commit a4776f9

Please sign in to comment.