diff options
Diffstat (limited to '')
-rw-r--r-- | default.nix | 2 | ||||
-rw-r--r-- | nixos/sites/catbus-web-ui.nix | 18 | ||||
-rw-r--r-- | nixos/sites/default.nix | 10 |
3 files changed, 30 insertions, 0 deletions
diff --git a/default.nix b/default.nix index c49b17d..ba56210 100644 --- a/default.nix +++ b/default.nix @@ -3,5 +3,7 @@ require = import ./nixos/modules/module-list.nix; }; + sites = import ./nixos/sites; + overlays = import ./pkgs; } diff --git a/nixos/sites/catbus-web-ui.nix b/nixos/sites/catbus-web-ui.nix new file mode 100644 index 0000000..c68cdcf --- /dev/null +++ b/nixos/sites/catbus-web-ui.nix @@ -0,0 +1,18 @@ +{ pkgs }: + +{ mosquittoHost, mosquittoPort }: { + locations = { + "/" = { + root = "${pkgs.eth.catbus-web-ui}"; + }; + + "/mqtt" = { + proxyPass = "http://${mosquittoHost}:${toString mosquittoPort}"; + proxyWebsockets = true; + extraConfig = '' + rewrite ^/mqtt$ / break; + rewrite ^/mqtt(.*)$ $1 break; + ''; + }; + }; +} diff --git a/nixos/sites/default.nix b/nixos/sites/default.nix new file mode 100644 index 0000000..1ddd148 --- /dev/null +++ b/nixos/sites/default.nix @@ -0,0 +1,10 @@ +{ pkgs, ... }: + +{ + https = site: site // { + forceSSL = true; + enableACME = true; + }; + + catbus-web-ui = pkgs.callPackage ./catbus-web-ui.nix {}; +} |