2024-04-12 19:36:44 +02:00
|
|
|
{ config, nixpkgs, ... }:
|
2024-02-02 10:51:31 +01:00
|
|
|
|
|
|
|
let
|
|
|
|
host = "cachix.dgnum.eu";
|
|
|
|
in
|
|
|
|
{
|
2023-09-28 17:20:16 +02:00
|
|
|
services = {
|
|
|
|
atticd = {
|
|
|
|
enable = true;
|
|
|
|
|
|
|
|
credentialsFile = config.age.secrets."atticd-credentials_file".path;
|
|
|
|
|
|
|
|
settings = {
|
|
|
|
listen = "127.0.0.1:9090";
|
|
|
|
api-endpoint = "https://${host}/";
|
|
|
|
|
|
|
|
allowed-hosts = [ host ];
|
|
|
|
|
|
|
|
chunking = {
|
|
|
|
# The minimum NAR size to trigger chunking
|
|
|
|
#
|
|
|
|
# If 0, chunking is disabled entirely for newly-uploaded NARs.
|
|
|
|
# If 1, all NARs are chunked.
|
|
|
|
nar-size-threshold = 64 * 1024; # 64 KiB
|
|
|
|
|
|
|
|
# The preferred minimum size of a chunk, in bytes
|
|
|
|
min-size = 16 * 1024; # 16 KiB
|
|
|
|
|
|
|
|
# The preferred average size of a chunk, in bytes
|
|
|
|
avg-size = 64 * 1024; # 64 KiB
|
|
|
|
|
|
|
|
# The preferred maximum size of a chunk, in bytes
|
|
|
|
max-size = 256 * 1024; # 256 KiB
|
|
|
|
};
|
|
|
|
|
|
|
|
database.url = "postgresql://atticd?host=/run/postgresql";
|
|
|
|
|
|
|
|
storage = {
|
|
|
|
type = "s3";
|
|
|
|
region = "garage";
|
2023-12-05 23:10:36 +01:00
|
|
|
bucket = "attic-dgnum";
|
2023-09-28 17:20:16 +02:00
|
|
|
endpoint = "https://s3.dgnum.eu";
|
|
|
|
};
|
|
|
|
};
|
2023-12-11 15:54:36 +01:00
|
|
|
|
|
|
|
useFlakeCompatOverlay = false;
|
2024-04-12 19:36:44 +02:00
|
|
|
package = nixpkgs.unstable.attic-server;
|
2023-09-28 17:20:16 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
nginx = {
|
|
|
|
enable = true;
|
|
|
|
|
|
|
|
virtualHosts.${host} = {
|
|
|
|
enableACME = true;
|
|
|
|
forceSSL = true;
|
|
|
|
|
2023-12-05 23:10:36 +01:00
|
|
|
locations."/" = {
|
|
|
|
proxyPass = "http://127.0.0.1:9090";
|
|
|
|
|
|
|
|
extraConfig = ''
|
2024-04-12 19:53:02 +02:00
|
|
|
client_max_body_size 10G;
|
2023-12-05 23:10:36 +01:00
|
|
|
'';
|
|
|
|
};
|
2023-09-28 17:20:16 +02:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
postgresql = {
|
|
|
|
enable = true;
|
|
|
|
|
|
|
|
ensureDatabases = [ "atticd" ];
|
|
|
|
|
2024-02-02 10:51:31 +01:00
|
|
|
ensureUsers = [
|
|
|
|
{
|
|
|
|
name = "atticd";
|
|
|
|
ensureDBOwnership = true;
|
|
|
|
}
|
|
|
|
];
|
2023-09-28 17:20:16 +02:00
|
|
|
};
|
|
|
|
};
|
2024-04-15 16:15:54 +02:00
|
|
|
|
|
|
|
systemd.services.atticd.environment.RUST_LOG = "warn";
|
2023-09-28 17:20:16 +02:00
|
|
|
}
|