forked from aylac.top/nixcfg
this repo has no description
1{ 2 config, 3 self, 4 lib, 5 ... 6}: let 7 name = "copyparty"; 8 cfg = config.myNixOS.services.${name}; 9 10 network = config.mySnippets.tailnet; 11 service = network.networkMap.${name}; 12in { 13 options.myNixOS.services.${name} = { 14 enable = lib.mkEnableOption "${name} server"; 15 autoProxy = lib.mkOption { 16 default = true; 17 example = false; 18 description = "${name} auto proxy"; 19 type = lib.types.bool; 20 }; 21 }; 22 23 config = lib.mkIf cfg.enable { 24 age.secrets.copyparty = { 25 file = "${self.inputs.secrets}/copyparty.age"; 26 owner = "copyparty"; 27 group = "copyparty"; 28 mode = "0400"; 29 }; 30 31 services = { 32 caddy.virtualHosts."${service.vHost}".extraConfig = lib.mkIf cfg.autoProxy '' 33 bind tailscale/${name} 34 encode zstd gzip 35 reverse_proxy ${service.hostName}:${toString service.port} 36 ''; 37 38 copyparty = { 39 enable = true; 40 settings = { 41 i = "0.0.0.0"; 42 p = [service.port (service.port + 1)]; 43 no-reload = true; 44 ignored-flag = false; 45 }; 46 accounts = { 47 ayla = { 48 passwordFile = config.age.secrets.copyparty.path; 49 }; 50 }; 51 volumes = { 52 "/" = { 53 path = "/data/copyparty"; 54 access = { 55 r = ["*"]; 56 A = ["ayla"]; 57 }; 58 flags = { 59 fk = 4; 60 scan = 480; 61 }; 62 }; 63 }; 64 }; 65 }; 66 }; 67}