From 7f6594fce514d1caab9ff05c709eb96129929c05 Mon Sep 17 00:00:00 2001 From: Zynh Ludwig Date: Fri, 27 Dec 2024 05:42:42 -0800 Subject: [PATCH] add nginx --- modules/nginx.nix | 17 +++++++++++++++++ modules/nyazoom.nix | 6 +++++- 2 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 modules/nginx.nix diff --git a/modules/nginx.nix b/modules/nginx.nix new file mode 100644 index 0000000..3e9b22e --- /dev/null +++ b/modules/nginx.nix @@ -0,0 +1,17 @@ +{ lib, config, ... }: + +let + cfg = config.permafrost.nginx; +in +{ + options.permafrost.nginx = { + enable = lib.mkEnableOption "nginx nixos module"; + }; + + config = lib.mkIf cfg.enable { + services.nginx.enable = true; + security.acme.acceptTerms = true; + + networking.firewall.allowedTCPPorts = [ 80 443 ]; + }; +} diff --git a/modules/nyazoom.nix b/modules/nyazoom.nix index 12a7ebd..2fa8176 100644 --- a/modules/nyazoom.nix +++ b/modules/nyazoom.nix @@ -21,6 +21,10 @@ in wants = [ "network.target" ]; }; - networking.firewall.allowedTCPPorts = [ 3000 ]; + permafrost.nginx.enable = lib.mkDefault true; + services.nginx.virtualHosts."nyazoom.zynh.me" = { + serverName = "nyazoom.zynh.me"; + locations."/".proxyPass = "http://localhost:3000"; + }; }; }