2023-10-31 23:19:08 +02:00
|
|
|
{ cluster, config, depot, lib, ... }:
|
2023-06-14 00:27:53 +03:00
|
|
|
|
|
|
|
let
|
2024-07-08 20:00:55 +03:00
|
|
|
inherit (cluster.config.services.attic) secrets;
|
2023-06-14 00:27:53 +03:00
|
|
|
in
|
|
|
|
|
|
|
|
{
|
|
|
|
imports = [
|
|
|
|
depot.inputs.attic.nixosModules.atticd
|
|
|
|
];
|
|
|
|
|
|
|
|
links.atticServer.protocol = "http";
|
|
|
|
|
|
|
|
services.atticd = {
|
|
|
|
enable = true;
|
|
|
|
|
2024-07-08 20:00:55 +03:00
|
|
|
credentialsFile = secrets.serverToken.path;
|
2023-06-14 00:27:53 +03:00
|
|
|
|
|
|
|
settings = {
|
|
|
|
listen = config.links.atticServer.tuple;
|
|
|
|
|
|
|
|
chunking = {
|
2023-10-31 23:19:08 +02:00
|
|
|
nar-size-threshold = 0;
|
|
|
|
min-size = 0;
|
|
|
|
avg-size = 0;
|
|
|
|
max-size = 0;
|
2023-06-14 00:27:53 +03:00
|
|
|
};
|
|
|
|
|
2023-10-31 23:19:08 +02:00
|
|
|
compression.type = "none";
|
|
|
|
|
|
|
|
database.url = "postgresql://attic@${cluster.config.links.patroni-pg-access.tuple}/attic";
|
2023-06-14 00:27:53 +03:00
|
|
|
|
|
|
|
storage = {
|
2023-10-31 23:19:08 +02:00
|
|
|
type = "s3";
|
|
|
|
region = "us-east-1";
|
2023-11-03 22:46:40 +02:00
|
|
|
endpoint = cluster.config.links.garageS3.url;
|
2023-10-31 23:19:08 +02:00
|
|
|
bucket = "attic";
|
2023-06-14 00:27:53 +03:00
|
|
|
};
|
2023-12-02 01:18:10 +02:00
|
|
|
|
|
|
|
garbage-collection = {
|
|
|
|
interval = "2 weeks";
|
|
|
|
default-retention-period = "3 months";
|
|
|
|
};
|
2023-06-14 00:27:53 +03:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2023-12-02 01:10:58 +02:00
|
|
|
users = {
|
|
|
|
users.atticd = {
|
|
|
|
isSystemUser = true;
|
|
|
|
group = "atticd";
|
|
|
|
home = "/var/lib/atticd";
|
|
|
|
createHome = true;
|
|
|
|
};
|
|
|
|
groups.atticd = {};
|
|
|
|
};
|
|
|
|
|
2023-10-31 23:19:08 +02:00
|
|
|
systemd.services.atticd = {
|
2023-12-02 00:22:01 +02:00
|
|
|
after = [ "postgresql.service" ];
|
2023-12-02 01:10:58 +02:00
|
|
|
serviceConfig = {
|
|
|
|
DynamicUser = lib.mkForce false;
|
|
|
|
};
|
2023-10-31 23:19:08 +02:00
|
|
|
environment = {
|
2024-07-08 20:00:55 +03:00
|
|
|
AWS_SHARED_CREDENTIALS_FILE = secrets.s3Credentials.path;
|
|
|
|
PGPASSFILE = secrets.dbCredentials.path;
|
2023-10-31 23:19:08 +02:00
|
|
|
};
|
2023-06-14 03:10:29 +03:00
|
|
|
};
|
2023-06-14 00:27:53 +03:00
|
|
|
|
2023-08-31 01:55:45 +03:00
|
|
|
services.nginx.virtualHosts."cache-api.${depot.lib.meta.domain}" = depot.lib.nginx.vhosts.proxy config.links.atticServer.url // {
|
2023-06-16 18:27:40 +03:00
|
|
|
extraConfig = ''
|
|
|
|
client_max_body_size 4G;
|
|
|
|
'';
|
|
|
|
};
|
2023-06-14 00:27:53 +03:00
|
|
|
}
|