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,10 +5,11 @@
}: }:
let let
cfg = config.guests.copyparty; # NOLINT(let_order) cfg = config.guests.copyparty; # NOLINT(let_order)
accountName = config.user.name;
stateDir = "/var/lib/copyparty"; volumeType = lib.types.submodule (
{ config, ... }:
volumeType = lib.types.submodule { {
options = { options = {
hostPath = lib.mkOption { hostPath = lib.mkOption {
type = lib.types.str; type = lib.types.str;
@@ -22,7 +23,7 @@ let
access = lib.mkOption { access = lib.mkOption {
type = lib.types.attrsOf (lib.types.listOf lib.types.str); type = lib.types.attrsOf (lib.types.listOf lib.types.str);
default = { }; default.A = [ accountName ];
description = "Copyparty access map from permission string to account names."; description = "Copyparty access map from permission string to account names.";
}; };
@@ -34,11 +35,21 @@ let
flags = lib.mkOption { flags = lib.mkOption {
type = lib.types.attrs; type = lib.types.attrs;
default = { }; default =
if config.readOnly then
{ }
else
{
d2d = true;
d2t = true;
dthumb = true;
};
description = "Copyparty volume flags."; description = "Copyparty volume flags.";
}; };
}; };
}; }
);
stateDir = "/var/lib/copyparty";
in in
{ {
options.guests.copyparty = { options.guests.copyparty = {

View File

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