From 6d189cabb27e81323881073c91714a7410efc8c3 Mon Sep 17 00:00:00 2001 From: Ethel Morgan Date: Sat, 11 Jul 2020 13:25:55 +0100 Subject: add sites package, add sites.catbus-web-ui --- nixos/sites/catbus-web-ui.nix | 18 ++++++++++++++++++ nixos/sites/default.nix | 10 ++++++++++ 2 files changed, 28 insertions(+) create mode 100644 nixos/sites/catbus-web-ui.nix create mode 100644 nixos/sites/default.nix (limited to 'nixos/sites') 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 {}; +} -- cgit v1.2.3