refactor(copyparty): move volume defaults to service

This commit is contained in:
2026-10-13 11:27:47 -04:00
parent 161103ad7c
commit 96006c7236
3 changed files with 82 additions and 82 deletions

View File

@@ -8,6 +8,8 @@
let
cfg = config.modules.services.copyparty; # NOLINT(let_order)
accountName = config.user.name;
serviceGroup = "storage";
serviceStateDir = "/var/lib/copyparty";
@@ -18,8 +20,6 @@ let
port = 3923;
accountName = config.user.name;
credentialName = "password-${builtins.substring 0 16 (builtins.hashString "sha256" accountName)}";
passwordPlaceholder = "@COPYPARTY_PASSWORD_${
@@ -89,38 +89,49 @@ in
volumes = lib.mkOption {
type = lib.types.attrsOf (
lib.types.submodule {
options = {
path = lib.mkOption {
type = lib.types.externalPath;
description = "Sets the filesystem path served by this volume.";
};
access = lib.mkOption {
type = lib.types.attrsOf (lib.types.listOf lib.types.str);
default = { };
example = {
A = [ "alexion" ];
lib.types.submodule (
{ config, ... }:
{
options = {
path = lib.mkOption {
type = lib.types.externalPath;
description = "Sets the filesystem path served by this volume.";
};
description = "Maps Copyparty permission strings to account names.";
};
readOnly = lib.mkOption {
type = lib.types.bool;
default = false;
description = "Serves this volume read-only.";
};
flags = lib.mkOption {
type = lib.types.attrs;
default = { };
example = {
dthumb = true;
access = lib.mkOption {
type = lib.types.attrsOf (lib.types.listOf lib.types.str);
default = if config.readOnly then { r = [ accountName ]; } else { A = [ accountName ]; };
example = {
A = [ "alexion" ];
};
description = "Maps Copyparty permission strings to account names.";
};
readOnly = lib.mkOption {
type = lib.types.bool;
default = false;
description = "Serves this volume read-only.";
};
flags = lib.mkOption {
type = lib.types.attrs;
default =
if config.readOnly then
{ }
else
{
d2d = true;
d2t = true;
dthumb = true;
};
example = {
dthumb = true;
};
description = "Sets Copyparty volume flags.";
};
description = "Sets Copyparty volume flags.";
};
};
}
}
)
);
default = { };
description = "Defines Copyparty volumes by URL path.";