diff --git a/pastila/configuration.nix b/pastila/configuration.nix index d96133d..bdb7e85 100644 --- a/pastila/configuration.nix +++ b/pastila/configuration.nix @@ -13,6 +13,7 @@ in ./gitolite.nix ./letsencrypt.nix ./srv.nix + ./weechat-relay.nix ]; # Use the GRUB 2 boot loader. diff --git a/pastila/srv.nix b/pastila/srv.nix index 558654b..af463e6 100644 --- a/pastila/srv.nix +++ b/pastila/srv.nix @@ -11,7 +11,8 @@ in users.users."up" = { isNormalUser = true; home = up_dir; - group = config.services.nginx.group; + # group = config.services.nginx.group; + group = "nginx"; # Unsure why this is broken, but couldn't make things work without # creating the directory by hand. # createHome = true; diff --git a/pastila/weechat-relay.nix b/pastila/weechat-relay.nix new file mode 100644 index 0000000..e5cfafc --- /dev/null +++ b/pastila/weechat-relay.nix @@ -0,0 +1,20 @@ +{ config, lib, pkgs, ... }: + +let + mkProxy = port: { + forceSSL = true; + enableACME = true; + locations."/" = { + proxyPass = "http://localhost:" + builtins.toString port + "/weechat"; + proxyWebsockets = true; + extraConfig = '' + proxy_read_timeout 604800; # Prevent idle disconnects + proxy_set_header X-Real-IP $remote_addr; # Let WeeChat see the client's IP + ''; + }; + }; +in +{ + services.nginx.enable = true; + services.nginx.virtualHosts."relayjq.isomorphis.me" = mkProxy 9001; +} \ No newline at end of file