From 7d6c31e622f267fd7d2ff5b5f9a86c764a127f67 Mon Sep 17 00:00:00 2001 From: alexion Date: Sun, 20 Sep 2026 20:30:42 -0400 Subject: [PATCH] feat(nixos): add copyparty opds volume --- configs/nixos/AGENTS.md | 2 ++ configs/nixos/guests/copyparty.nix | 10 ++++++++++ configs/nixos/hosts/pikachu/default.nix | 7 +++++++ 3 files changed, 19 insertions(+) diff --git a/configs/nixos/AGENTS.md b/configs/nixos/AGENTS.md index 198aa9b..92492e0 100644 --- a/configs/nixos/AGENTS.md +++ b/configs/nixos/AGENTS.md @@ -57,5 +57,7 @@ Use a sudo `nix-store --import` path for unsigned deploy closures. - Public DNS entries are not managed through the NixOS configuration. Do not describe NixOS route choices as public-DNS management. +- The pinned `copyparty-min` package includes Copyparty's OPDS support. + Enable OPDS with the `opds` volume flag or global Copyparty option; do not assume the minimal package removes it. - Do not hand-author `hardware-configuration.nix` for a host that has not been generated on that machine. Generate it on the target system or live ISO, then stage it before evaluating the flake. diff --git a/configs/nixos/guests/copyparty.nix b/configs/nixos/guests/copyparty.nix index 63c57f3..743afe3 100644 --- a/configs/nixos/guests/copyparty.nix +++ b/configs/nixos/guests/copyparty.nix @@ -6,6 +6,14 @@ let cfg = config.guests.copyparty; + rootVolume = cfg.volumes."/" or null; + + rootPlaceholderRules = lib.optionals (rootVolume != null) ( + lib.mapAttrsToList (urlPath: _volume: "d ${rootVolume.hostPath}${urlPath} 2770 root storage - -") ( + lib.filterAttrs (urlPath: _volume: urlPath != "/" && lib.hasPrefix "/" urlPath) cfg.volumes + ) + ); + volumeType = lib.types.submodule { options = { hostPath = lib.mkOption { @@ -99,6 +107,8 @@ in href = lib.mkIf cfg.reverseProxy.enable "https://${cfg.reverseProxy.route.domain}/?h"; }; + systemd.tmpfiles.rules = rootPlaceholderRules; + guests.copyparty = { interior.modules.services.copyparty = { enable = true; diff --git a/configs/nixos/hosts/pikachu/default.nix b/configs/nixos/hosts/pikachu/default.nix index a0af097..d999722 100644 --- a/configs/nixos/hosts/pikachu/default.nix +++ b/configs/nixos/hosts/pikachu/default.nix @@ -198,6 +198,13 @@ "dthumb" ]; }; + "/opds" = { + hostPath = "/pikachu/data/opds"; + path = "/pikachu/data/opds"; + access.r = [ "alexion" ]; + readOnly = true; + flags = [ "opds" ]; + }; }; };