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

54 lines
1.1 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:30:12 +00:00
environment.systemPackages = [ pkgs.attic ];
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-04 20:30:12 +00:00
allowed-hosts = [ "${fqdn}" ];
api-endpoint = "https://${fqdn}/";
2023-04-04 15:20:09 +00:00
storage = {
type = "s3";
region = "eu-central-1";
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";
locations."/" = {
recommendedProxySettings = true;
proxyPass = "http://127.0.0.1:8080";
};
};
2023-04-04 15:20:09 +00:00
}