1{ 2 _utils, 3 pkgs, 4 ... 5}: let 6 # where tf are the docs for pkgs.formats?? 7 toml = pkgs.formats.toml {}; 8in { 9 services.atticd = { 10 enable = true; 11 credentialsFile = "/etc/atticd.env"; 12 13 # Per https://github.com/zhaofengli/attic/blob/b43d12082e34bceb26038bdad0438fd68804cfcd/server/src/config.rs#L252 14 # we can use the env var ATTIC_SERVER_DATABASE_URL to set the database connection url, 15 # ONLY IF database.url in config is unset. 16 # Since we cannot reasonably "unset" database with the default settings block, this will have to do. 17 # Please reach out if you know a better way! 18 configFile = toml.generate "server.toml" { 19 database = {}; 20 storage = { 21 type = "local"; 22 path = "/var/lib/atticd/storage"; 23 }; 24 25 listen = "127.0.0.1:38191"; 26 allowed-hosts = [ 27 "nonbunary.soopy.moe" 28 ]; 29 chunking = { 30 # The minimum NAR size to trigger chunking 31 nar-size-threshold = 64 * 1024; # 64 KiB 32 # The preferred minimum size of a chunk, in bytes 33 min-size = 16 * 1024; # 16 KiB 34 # The preferred average size of a chunk, in bytes 35 avg-size = 64 * 1024; # 64 KiB 36 # The preferred maximum size of a chunk, in bytes 37 max-size = 256 * 1024; # 256 KiB 38 }; 39 }; 40 }; 41 42 services.nginx.virtualHosts."nonbunary.soopy.moe" = _utils.mkSimpleProxy { 43 port = 38191; 44 extraConfig = { 45 extraConfig = '' 46 client_max_body_size 1G; 47 proxy_read_timeout 3h; 48 proxy_connect_timeout 3h; 49 proxy_send_timeout 3h; 50 ''; 51 }; 52 }; 53}