configure attic api endpoints

pull/57/head
Tudor Roman 2024-01-28 14:08:14 +01:00
parent e614f4b6a0
commit ba416852d9
Signed by: tudor
SSH Key Fingerprint: SHA256:3CwS9plgXBecpXImPGxDIaSktUXBejbV/zerZMqzzBk
2 changed files with 15 additions and 3 deletions

View File

@ -4,7 +4,10 @@
systemModules.basePackages.enable = true;
systemModules.services = {
attic.enable = true;
attic = {
enable = true;
hostAddress = "ceres.lamb-monitor.ts.net";
};
dyndns.enable = true;
ssh.enable = true;
ssh.enableMosh = true;

View File

@ -1,4 +1,4 @@
{ config, pkgs, lib, flake, ... }:
{ config, lib, flake, ... }:
let
cfg = config.systemModules.services.attic;
in
@ -9,6 +9,10 @@ with lib; {
options.systemModules.services.attic = {
enable = mkEnableOption "Attic Nix cache";
hostAddress = mkOption {
description = "User-facing address";
type = types.str;
};
listenPort = mkOption {
description = "Listen port";
type = types.int;
@ -17,11 +21,16 @@ with lib; {
};
config = mkIf cfg.enable {
services.atticd = {
services.atticd = let
hostString = assert cfg.hostAddress != "";
"${cfg.hostAddress}:${builtins.toString cfg.listenPort}";
in {
enable = true;
credentialsFile = config.age.secrets.attic-server-token.path;
settings = {
listen = "[::]:${builtins.toString cfg.listenPort}";
allowed-hosts = [ hostString ];
api-endpoint = "http://${hostString}/";
# taken from: https://docs.attic.rs/admin-guide/deployment/nixos.html
chunking = {
nar-size-threshold = 64 * 1024; # 64 KiB