From c864b96f072345b466da80495afaf509bb2b74fa Mon Sep 17 00:00:00 2001 From: Julien Malka Date: Sat, 26 Feb 2022 18:55:41 +0100 Subject: [PATCH] Create VPN subdomains --- modules/deluge/default.nix | 4 +++- modules/docs/default.nix | 5 ++++- modules/drone/default.nix | 2 +- modules/jackett/default.nix | 5 ++++- modules/jellyfin/default.nix | 38 +++++++++++++++++++++++++++++++++-- modules/lidarr/default.nix | 5 ++++- modules/navidrome/default.nix | 18 ++++++----------- modules/radarr/default.nix | 5 +++-- modules/sonarr/default.nix | 6 ++++-- 9 files changed, 65 insertions(+), 23 deletions(-) diff --git a/modules/deluge/default.nix b/modules/deluge/default.nix index ab547e9..ef2acf3 100644 --- a/modules/deluge/default.nix +++ b/modules/deluge/default.nix @@ -54,8 +54,10 @@ in }; } - (mkIf cfg.nginx.enable (mkPrivateSubdomain cfg.nginx.subdomain port))]); + + (mkIf cfg.nginx.enable (mkVPNSubdomain cfg.nginx.subdomain port))]); + } diff --git a/modules/docs/default.nix b/modules/docs/default.nix index 22dfbc8..e25dfee 100644 --- a/modules/docs/default.nix +++ b/modules/docs/default.nix @@ -46,8 +46,11 @@ in }; } - (mkIf cfg.nginx.enable (mkSubdomain cfg.nginx.subdomain port))]); + (mkIf cfg.nginx.enable (mkSubdomain cfg.nginx.subdomain port)) + + (mkIf cfg.nginx.enable (mkVPNSubdomain cfg.nginx.subdomain port))]); + diff --git a/modules/drone/default.nix b/modules/drone/default.nix index 6244c72..05a18a7 100644 --- a/modules/drone/default.nix +++ b/modules/drone/default.nix @@ -94,5 +94,5 @@ in path = [ pkgs.nixUnstable pkgs.git pkgs.openssh ]; }; - } (mkSubdomain cfg.subdomain port)); + } (recursiveUpdate (mkSubdomain cfg.subdomain port) (mkVPNSubdomain cfg.subdomain port))); } diff --git a/modules/jackett/default.nix b/modules/jackett/default.nix index 41fcf51..757730a 100644 --- a/modules/jackett/default.nix +++ b/modules/jackett/default.nix @@ -38,8 +38,11 @@ in } - (mkIf cfg.nginx.enable (mkPrivateSubdomain cfg.nginx.subdomain port))]); + (mkIf cfg.nginx.enable (mkPrivateSubdomain cfg.nginx.subdomain port)) + + (mkIf cfg.nginx.enable (mkVPNSubdomain cfg.nginx.subdomain port))]); + diff --git a/modules/jellyfin/default.nix b/modules/jellyfin/default.nix index b113eb8..aae3c7f 100644 --- a/modules/jellyfin/default.nix +++ b/modules/jellyfin/default.nix @@ -35,10 +35,44 @@ in user = cfg.user; group = cfg.group; }; + + # services.nginx.appendHttpConfig = '' + # server { + # server_name tv.julienmalka.me; + # listen 80; + # return 301 https://$server_name$request_uri; + # } + + # server { + # server_name tv.julienmalka.me; + # listen 443 ssl http2; + + # include ${../authelia/authelia.conf}; # Authelia auth endpoint + + # location / { + # proxy_pass http://127.0.0.1:8096; + # proxy_set_header Host $host; + # proxy_set_header X-Real-IP $remote_addr; + # proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + + # include ${../authelia/secure.conf}; # Protect this endpoint + # } + # } + # ''; + + + + + + + } - (mkIf cfg.nginx.enable (mkSubdomain cfg.nginx.subdomain port) )]); - + (mkIf cfg.nginx.enable (mkSubdomain cfg.nginx.subdomain port)) + (mkIf cfg.nginx.enable (mkVPNSubdomain cfg.nginx.subdomain port))]); + + + diff --git a/modules/lidarr/default.nix b/modules/lidarr/default.nix index 8c0a1d7..09a5437 100644 --- a/modules/lidarr/default.nix +++ b/modules/lidarr/default.nix @@ -38,8 +38,11 @@ in }; } - (mkIf cfg.nginx.enable (mkPrivateSubdomain cfg.nginx.subdomain port) )]); + (mkIf cfg.nginx.enable (mkPrivateSubdomain cfg.nginx.subdomain port) ) + + (mkIf cfg.nginx.enable (mkVPNSubdomain cfg.nginx.subdomain port))]); + diff --git a/modules/navidrome/default.nix b/modules/navidrome/default.nix index 06f7b49..59455cd 100644 --- a/modules/navidrome/default.nix +++ b/modules/navidrome/default.nix @@ -61,17 +61,11 @@ in } - ({ - services.nginx.virtualHosts."music.julienmalka.me" = { - forceSSL = true; - enableACME = true; - locations."/" = { - proxyPass = "http://localhost:${toString port}"; - }; - }; -}) - -]); - + + (mkIf cfg.nginx.enable (mkSubdomain cfg.nginx.subdomain port)) + + (mkIf cfg.nginx.enable (mkVPNSubdomain cfg.nginx.subdomain port))]); + + } diff --git a/modules/radarr/default.nix b/modules/radarr/default.nix index daa5715..9fad521 100644 --- a/modules/radarr/default.nix +++ b/modules/radarr/default.nix @@ -39,8 +39,9 @@ in } (mkIf cfg.nginx.enable (mkPrivateSubdomain cfg.nginx.subdomain port)) - - ]); + + (mkIf cfg.nginx.enable (mkVPNSubdomain cfg.nginx.subdomain port))]); + diff --git a/modules/sonarr/default.nix b/modules/sonarr/default.nix index 229488a..411d3d6 100644 --- a/modules/sonarr/default.nix +++ b/modules/sonarr/default.nix @@ -38,8 +38,10 @@ in }; } - (mkIf cfg.nginx.enable (mkPrivateSubdomain cfg.nginx.subdomain port) )]); - + (mkIf cfg.nginx.enable (mkPrivateSubdomain cfg.nginx.subdomain port) ) + + (mkIf cfg.nginx.enable (mkVPNSubdomain cfg.nginx.subdomain port))]); +