1
0
Fork 0
dotfiles/system/nixos/atticd.nix

59 lines
1.2 KiB
Nix
Raw Normal View History

2023-04-04 20:30:12 +00:00
{ pkgs, config, secret, ... }:
2023-04-04 15:20:09 +00:00
2023-04-04 20:30:12 +00:00
let
fqdn = "attic.cache.daniel.sx";
in
2023-04-04 15:20:09 +00:00
{
2023-04-04 20:43:16 +00:00
environment.systemPackages = [ pkgs.attic-client ];
2023-04-04 20:30:12 +00:00
2023-04-04 15:20:09 +00:00
services.atticd = {
enable = true;
credentialsFile = config.age.secrets.atticd-environment.path;
settings = {
listen = "127.0.0.1:8080";
2023-04-05 10:22:05 +00:00
database.url = secret.atticd.database-url;
2023-04-04 15:20:09 +00:00
2023-04-04 20:30:12 +00:00
allowed-hosts = [ "${fqdn}" ];
api-endpoint = "https://${fqdn}/";
2023-04-04 15:20:09 +00:00
storage = {
type = "s3";
2023-04-05 08:42:21 +00:00
region = "auto";
2023-04-04 15:20:09 +00:00
bucket = "attic-cache";
2023-04-04 15:22:37 +00:00
endpoint = "https://${secret.cloudflare.account-id}.r2.cloudflarestorage.com";
2023-04-04 15:20:09 +00:00
};
chunking = {
nar-size-threshold = 64 * 1024; # 64 KiB
min-size = 16 * 1024; # 16 KiB
avg-size = 64 * 1024; # 64 KiB
max-size = 256 * 1024; # 256 KiB
};
garbage-collection = {
interval = "12 hours";
default-retention-period = "3 months";
};
};
};
2023-04-04 20:30:12 +00:00
services.nginx.virtualHosts."${fqdn}" = {
quic = true;
http3 = true;
onlySSL = true;
useACMEHost = "cache.daniel.sx";
extraConfig = ''
client_max_body_size 0;
'';
2023-04-04 20:30:12 +00:00
locations."/" = {
recommendedProxySettings = true;
proxyPass = "http://127.0.0.1:8080";
};
};
2023-04-04 15:20:09 +00:00
}