enable restic rest server on hypervisor

This commit is contained in:
Dmitriy Kholkin 2023-06-27 23:08:20 +03:00
parent 58703b9dc8
commit 683b7fb52f
3 changed files with 36 additions and 0 deletions

View File

@ -39,6 +39,7 @@ in {
nixosProfiles.matrix
nixosProfiles.atticd
nixosProfiles.attic
nixosProfiles.restic-server
(import nixosProfiles.blocky {
inherit config;

View File

@ -49,6 +49,7 @@
"prowlarr.ataraxiadev.com" = "ataraxiadev.com";
"qbit.ataraxiadev.com" = "ataraxiadev.com";
"radarr.ataraxiadev.com" = "ataraxiadev.com";
"restic.ataraxiadev.com" = "ataraxiadev.com";
"shoko.ataraxiadev.com" = "ataraxiadev.com";
"sonarr.ataraxiadev.com" = "ataraxiadev.com";
"sonarrtv.ataraxiadev.com" = "ataraxiadev.com";

View File

@ -0,0 +1,34 @@
{ config, pkgs, lib, ... }:
let
resticPort = 8010;
fqdn = "restic.ataraxiadev.com";
certFile = "${config.security.acme.certs.${fqdn}.directory}/fullchain.pem";
keyFile = "${config.security.acme.certs.${fqdn}.directory}/key.pem";
in {
secrets.restic-htpasswd = {
services = [ "restic-rest-server.service" ];
owner = "restic:restic";
};
security.acme.certs.${fqdn} = {
webroot = "/var/lib/acme/acme-challenge";
postRun = "systemctl reload restic-rest-server";
group = "restic";
};
networking.firewall.allowedTCPPorts = [ resticPort ];
networking.firewall.allowPing = true;
services.restic.server = {
enable = true;
dataDir = "/media/nas/backups/restic";
listenAddress = ":${toString resticPort}";
# appendOnly = true;
privateRepos = true;
prometheus = true;
extraFlags = [
"--prometheus-no-auth"
"--htpasswd-file=${config.secrets.restic-htpasswd.decrypted}"
"--tls" "--tls-cert=${certFile}" "--tls-key=${keyFile}"
];
};
}