From 75fdefa9bb8b66c4f2668958cd4e9fd51a8bb04c Mon Sep 17 00:00:00 2001 From: batteredbunny Date: Wed, 15 Jan 2025 02:56:18 +0200 Subject: [PATCH] Move confess-web to its own file --- caddy/default.nix | 9 --------- configuration.nix | 10 +--------- services/confess.nix | 28 ++++++++++++++++++++++++++++ 3 files changed, 29 insertions(+), 18 deletions(-) create mode 100644 services/confess.nix diff --git a/caddy/default.nix b/caddy/default.nix index b4ed907..e685c01 100644 --- a/caddy/default.nix +++ b/caddy/default.nix @@ -223,15 +223,6 @@ in redir https://catnip.ee{uri} permanent ''; - "confess.catnip.ee".extraConfig = '' - tls { - dns cloudflare {env.CLOUDFLARE_API_TOKEN} - resolvers 1.1.1.1 - } - - reverse_proxy :${toString config.services.confess-web.port} - ''; - ":80".extraConfig = '' respond awawaw ''; diff --git a/configuration.nix b/configuration.nix index 4507aed..2fe31ae 100644 --- a/configuration.nix +++ b/configuration.nix @@ -30,8 +30,8 @@ ./services/pds ./services/gonic.nix ./services/youtuee.nix + ./services/confess.nix inputs.lastfm-status.nixosModules.default - inputs.confess.nixosModules.default inputs.common-modules.nixosModules.nixos-upgrade ]; @@ -209,7 +209,6 @@ "/var/lib/syncthing" "/var/lib/matrix-synapse" "/var/lib/plex" - "/var/lib/confess-web" "/var/lib/influxdb2" "/etc/secrets" @@ -247,13 +246,6 @@ guiAddress = "0.0.0.0:8384"; openDefaultPorts = true; }; - confess-web = { - enable = true; - port = 8011; - reverseProxy = true; - trustedProxy = "127.0.0.1"; - environmentFile = "/etc/secrets/confess.env"; - }; lastfm-status = { enable = true; port = 4014; diff --git a/services/confess.nix b/services/confess.nix new file mode 100644 index 0000000..55bdae4 --- /dev/null +++ b/services/confess.nix @@ -0,0 +1,28 @@ +{ config, inputs, ... }: { + imports = [ + inputs.confess.nixosModules.default + ]; + + services = { + confess-web = { + enable = true; + port = 8011; + reverseProxy = true; + trustedProxy = "127.0.0.1"; + environmentFile = "/etc/secrets/confess.env"; + }; + + borgbackup.jobs."borgbase".paths = [ + "/var/lib/confess-web" + ]; + + caddy.virtualHosts."confess.catnip.ee".extraConfig = '' + tls { + dns cloudflare {env.CLOUDFLARE_API_TOKEN} + resolvers 1.1.1.1 + } + + reverse_proxy :${toString config.services.confess-web.port} + ''; + }; +}