diff --git a/hosts/library/default.nix b/hosts/library/default.nix index 447bbb2..e31b79d 100644 --- a/hosts/library/default.nix +++ b/hosts/library/default.nix @@ -4,6 +4,7 @@ imports = [ ./hardware-configuration.nix ./grafana.nix + ./nginx.nix ./prometheus.nix ./tunnel.nix ../server.nix @@ -49,57 +50,6 @@ enable = true; }; - services.nginx = - let - proxyConfig = '' - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_set_header X-Forwarded-Proto $scheme; - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header Host $host; - - proxy_set_header Range $http_range; - proxy_set_header If-Range $http_if_range; - - proxy_http_version 1.1; - proxy_set_header Upgrade $http_upgrade; - proxy_set_header Connection "upgrade"; - ''; - in - { - enable = true; - package = pkgs.openresty; - recommendedGzipSettings = true; - recommendedOptimisation = true; - recommendedTlsSettings = true; - clientMaxBodySize = "2G"; - virtualHosts = { - "library.mesh.vimium.net" = { - locations."/" = { - root = "/mnt/library"; - extraConfig = '' - autoindex on; - ''; - }; - }; - "jellyfin.vimium.com" = { - default = true; - listen = [ - { - addr = "127.0.0.1"; - port = 8000; - } - ]; - locations."/" = { - proxyPass = "http://localhost:8096"; - extraConfig = proxyConfig; - }; - locations."/metrics" = { - return = "404"; - }; - }; - }; - }; - hardware.graphics = { enable = true; extraPackages = with pkgs; [ diff --git a/hosts/library/nginx.nix b/hosts/library/nginx.nix new file mode 100644 index 0000000..0ae2f02 --- /dev/null +++ b/hosts/library/nginx.nix @@ -0,0 +1,57 @@ +{ + pkgs, + ... +}: + +{ + services.nginx = + let + proxyConfig = '' + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header Host $host; + + proxy_set_header Range $http_range; + proxy_set_header If-Range $http_if_range; + + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "upgrade"; + ''; + in + { + enable = true; + package = pkgs.openresty; + recommendedGzipSettings = true; + recommendedOptimisation = true; + recommendedTlsSettings = true; + clientMaxBodySize = "2G"; + virtualHosts = { + "library.mesh.vimium.net" = { + locations."/" = { + root = "/mnt/library"; + extraConfig = '' + autoindex on; + ''; + }; + }; + "jellyfin.vimium.com" = { + default = true; + listen = [ + { + addr = "127.0.0.1"; + port = 8000; + } + ]; + locations."/" = { + proxyPass = "http://localhost:8096"; + extraConfig = proxyConfig; + }; + locations."/metrics" = { + return = "404"; + }; + }; + }; + }; +}