diff options
author | Maciej Krüger <mkg20001@gmail.com> | 2024-03-23 18:25:55 +0100 |
---|---|---|
committer | Maciej Krüger <mkg20001@gmail.com> | 2024-03-23 18:25:55 +0100 |
commit | 94d6d4e93a3ce6b467d4b165aa74a71482d344e3 (patch) | |
tree | 723cfbdc32f149a6d72a726a8d56dacd8438b708 | |
parent | a26fa45c8028180d4cc18608bf4f1804606d5f21 (diff) |
nixos/docuum: add module for docuum package
Co-Authored-By: Martin Weinelt <mweinelt@users.noreply.github.com>
-rw-r--r-- | nixos/modules/module-list.nix | 1 | ||||
-rw-r--r-- | nixos/modules/services/admin/docuum.nix | 45 |
2 files changed, 46 insertions, 0 deletions
diff --git a/nixos/modules/module-list.nix b/nixos/modules/module-list.nix index d17e638a0883c..2fcb4c5be0553 100644 --- a/nixos/modules/module-list.nix +++ b/nixos/modules/module-list.nix @@ -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 diff --git a/nixos/modules/services/admin/docuum.nix b/nixos/modules/services/admin/docuum.nix new file mode 100644 index 0000000000000..6f6cd4e027337 --- /dev/null +++ b/nixos/modules/services/admin/docuum.nix @@ -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 + ]; + }; + }; + }; +} |