refactor(copyparty): default writable volume settings

This commit is contained in:
2026-10-13 09:37:59 -04:00
parent 5280f47433
commit 161103ad7c
2 changed files with 43 additions and 44 deletions

View File

@@ -5,40 +5,51 @@
}:
let
cfg = config.guests.copyparty; # NOLINT(let_order)
accountName = config.user.name;
volumeType = lib.types.submodule (
{ config, ... }:
{
options = {
hostPath = lib.mkOption {
type = lib.types.str;
description = "Host path bind-mounted into the Copyparty guest for this volume.";
};
path = lib.mkOption {
type = lib.types.str;
description = "Guest path served by this Copyparty volume.";
};
access = lib.mkOption {
type = lib.types.attrsOf (lib.types.listOf lib.types.str);
default.A = [ accountName ];
description = "Copyparty access map from permission string to account names.";
};
readOnly = lib.mkOption {
type = lib.types.bool;
default = false;
description = "Serve this Copyparty volume read-only.";
};
flags = lib.mkOption {
type = lib.types.attrs;
default =
if config.readOnly then
{ }
else
{
d2d = true;
d2t = true;
dthumb = true;
};
description = "Copyparty volume flags.";
};
};
}
);
stateDir = "/var/lib/copyparty";
volumeType = lib.types.submodule {
options = {
hostPath = lib.mkOption {
type = lib.types.str;
description = "Host path bind-mounted into the Copyparty guest for this volume.";
};
path = lib.mkOption {
type = lib.types.str;
description = "Guest path served by this Copyparty volume.";
};
access = lib.mkOption {
type = lib.types.attrsOf (lib.types.listOf lib.types.str);
default = { };
description = "Copyparty access map from permission string to account names.";
};
readOnly = lib.mkOption {
type = lib.types.bool;
default = false;
description = "Serve this Copyparty volume read-only.";
};
flags = lib.mkOption {
type = lib.types.attrs;
default = { };
description = "Copyparty volume flags.";
};
};
};
in
{
options.guests.copyparty = {

View File

@@ -135,22 +135,10 @@
"/inbox" = {
hostPath = "/pikachu/__inbox";
path = "/pikachu/__inbox";
access.A = [ config.user.name ];
flags = {
d2d = true;
d2t = true;
dthumb = true;
};
};
"/media" = {
hostPath = "/pikachu/media";
path = "/pikachu/media";
access.A = [ config.user.name ];
flags = {
d2d = true;
d2t = true;
dthumb = true;
};
};
"/opds" = {
hostPath = "/pikachu/data/opds";