From 9d2073011b34d02f91f8191b406460a8d3524749 Mon Sep 17 00:00:00 2001 From: Antoine Martin Date: Sun, 28 Mar 2021 22:08:19 +0200 Subject: [PATCH] lohr: setup dev service --- hosts/poseidon/default.nix | 4 ++++ services/default.nix | 1 + services/lohr.nix | 37 +++++++++++++++++++++++++++++++++++++ 3 files changed, 42 insertions(+) create mode 100644 services/lohr.nix diff --git a/hosts/poseidon/default.nix b/hosts/poseidon/default.nix index 74a9f46..8185637 100644 --- a/hosts/poseidon/default.nix +++ b/hosts/poseidon/default.nix @@ -78,6 +78,10 @@ in enable = true; }; + lohr = { + enable = true; + }; + miniflux = { enable = true; adminCredentialsFile = "${../../secrets/miniflux-admin-credentials.secret}"; diff --git a/services/default.nix b/services/default.nix index a1ae911..2777adf 100644 --- a/services/default.nix +++ b/services/default.nix @@ -7,6 +7,7 @@ ./fail2ban.nix ./gitea.nix ./jellyfin.nix + ./lohr.nix ./matrix.nix ./media.nix ./miniflux.nix diff --git a/services/lohr.nix b/services/lohr.nix new file mode 100644 index 0000000..fcc05c3 --- /dev/null +++ b/services/lohr.nix @@ -0,0 +1,37 @@ +{ config, lib, ... }: + +with lib; + +let + cfg = config.my.services.lohr; + my = config.my; + domain = config.networking.domain; +in +{ + options.my.services.lohr = { + enable = lib.mkEnableOption "Lohr Mirroring Daemon"; + + home = mkOption { + type = types.str; + default = "/var/lib/lohr"; + example = "/var/lib/lohr"; + description = "Home for the lohr service, where data will be stored"; + }; + }; + + config = mkIf cfg.enable { + services.nginx.virtualHosts = { + "lohr.${domain}" = { + forceSSL = true; + enableACME = true; + + locations."/" = { + proxyPass = let + laptopClientNum = my.secrets.wireguard.peers.laptop.clientNum; + in + "http://10.0.0.${toString laptopClientNum}:8000"; + }; + }; + }; + }; +}