From c365ca44f779e6fbc1c36d26d63282106bcf4a59 Mon Sep 17 00:00:00 2001 From: nyanloutre Date: Thu, 10 May 2018 19:00:14 +0200 Subject: [PATCH] Site max en module --- services.nix | 9 ++++----- services/site-max.nix | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+), 5 deletions(-) create mode 100644 services/site-max.nix diff --git a/services.nix b/services.nix index d98a47b..f46bb38 100644 --- a/services.nix +++ b/services.nix @@ -18,6 +18,7 @@ in ./services/mail-server.nix ./services/lidarr.nix ./services/site-musique.nix + ./services/site-max.nix ]; services.haproxy-acme.enable = true; @@ -37,7 +38,6 @@ in organizr = { ip = "127.0.0.1"; port = organizr_port; auth = true; }; calibre = { ip = "127.0.0.1"; port = 8080; auth = false; }; pgmanage = { ip = "127.0.0.1"; port = pgmanage_port; auth = true; }; - max = { ip = "127.0.0.1"; port = max_port; auth = false; }; }; services.mailserver.enable = true; @@ -135,10 +135,6 @@ in ''; }; }; - "max" = { - listen = [ { addr = "127.0.0.1"; port = max_port; } ]; - locations = { "/" = { root = pkgs.site-max; }; }; - }; }; services.phpfpm.poolConfigs.mypool = '' @@ -210,6 +206,9 @@ in services.site-musique.enable = true; services.site-musique.port = musique_port; + services.site-max.enable = true; + services.site-max.port = max_port; + networking.firewall.allowedTCPPorts = [ 111 2049 4000 4001 4002 # NFS 3483 9000 9090 # Slimserver diff --git a/services/site-max.nix b/services/site-max.nix new file mode 100644 index 0000000..cf7b4c3 --- /dev/null +++ b/services/site-max.nix @@ -0,0 +1,35 @@ +{ lib, config, pkgs, ... }: + +with lib; + +let + cfg = config.services.site-max; +in +{ + options.services.site-max = { + enable = mkEnableOption "Site Max Spiegel"; + + port = mkOption { + type = types.int; + example = 54321; + description = "Local listening port"; + }; + }; + + config = mkIf cfg.enable { + + services.haproxy-acme.services = { + max = { ip = "127.0.0.1"; port = cfg.port; auth = false; }; + }; + + services.nginx.virtualHosts = { + "max" = { + listen = [ { addr = "127.0.0.1"; port = cfg.port; } ]; + locations."/" = { + root = pkgs.site-max; + }; + }; + }; + + }; +}