nixos/docuum: add module for docuum package

Co-Authored-By: Martin Weinelt <mweinelt@users.noreply.github.com>
This commit is contained in:
Maciej Krüger 2024-03-23 18:25:55 +01:00
parent a26fa45c80
commit 94d6d4e93a
No known key found for this signature in database
GPG Key ID: 0D948CE19CF49C5F
2 changed files with 46 additions and 0 deletions

View File

@ -330,6 +330,7 @@
./security/systemd-confinement.nix
./security/tpm2.nix
./security/wrappers/default.nix
./services/admin/docuum.nix
./services/admin/meshcentral.nix
./services/admin/oxidized.nix
./services/admin/pgadmin.nix

View File

@ -0,0 +1,45 @@
{ config, pkgs, lib, utils, ... }:
let
cfg = config.services.docuum;
inherit (lib) mkIf mkEnableOption mkOption getExe types;
in
{
options.services.docuum = {
enable = mkEnableOption "docuum daemon";
threshold = mkOption {
description = "Threshold for deletion in bytes, like `10 GB`, `10 GiB`, `10GB` or percentage-based thresholds like `50%`";
type = types.str;
default = "10 GB";
example = "50%";
};
};
config = mkIf cfg.enable {
assertions = [
{
assertion = config.virtualisation.docker.enable;
message = "docuum requires docker on the host";
}
];
systemd.services.docuum = {
after = [ "docker.socket" ];
requires = [ "docker.socket" ];
wantedBy = [ "multi-user.target" ];
path = [ config.virtualisation.docker.package ];
environment.HOME = "/var/lib/docuum";
serviceConfig = {
DynamicUser = true;
StateDirectory = "docuum";
SupplementaryGroups = [ "docker" ];
ExecStart = utils.escapeSystemdExecArgs [
(getExe pkgs.docuum)
"--threshold" cfg.threshold
];
};
};
};
}