NixOS/modules/servers/atticd.nix
2025-10-25 00:59:37 -06:00

46 lines
1.2 KiB
Nix

{
lib,
config,
...
}:
let
setup = import ../factories/mkserver.nix { inherit lib config; };
cfg = config.my.servers.atticd;
in
{
options.my.servers.atticd = setup.mkOptions "atticd" "cache" 2343;
config = lib.mkIf (cfg.enable && config.my.secureHost) {
sops.secrets."private_cache_keys/atticd".sopsFile = ../../secrets/keys.yaml;
services.atticd = {
inherit (cfg) enable;
environmentFile = config.sops.secrets."private_cache_keys/atticd".path;
settings = {
listen = "[::]:${toString cfg.port}";
jwt = { };
database.heartbeat = true; # 5 minutes
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
};
compression = {
type = "zstd";
level = 8;
};
garbage-collection = {
interval = "7 days";
default-retention-period = "7 days";
};
};
};
systemd.services.atticd = {
serviceConfig = {
TimeoutStartSec = "15min";
TimeoutStopSec = "5min";
MemoryMax = "4G";
};
};
};
}