From ae37ebf22a2e88516024d21d353b50dec324c5b2 Mon Sep 17 00:00:00 2001 From: Fabian Montero Date: Mon, 27 Jan 2025 23:17:12 -0600 Subject: [PATCH] vps: add wiki-js --- sys/platforms/vps/srv/default.nix | 1 + sys/platforms/vps/srv/wiki-js.nix | 53 +++++++++++++++++++++++++++++++ 2 files changed, 54 insertions(+) create mode 100644 sys/platforms/vps/srv/wiki-js.nix diff --git a/sys/platforms/vps/srv/default.nix b/sys/platforms/vps/srv/default.nix index d6affda..3060eab 100644 --- a/sys/platforms/vps/srv/default.nix +++ b/sys/platforms/vps/srv/default.nix @@ -18,5 +18,6 @@ with lib; { ./shiori.nix ./calibre-web.nix ./immich.nix + ./wiki-js.nix ]; } diff --git a/sys/platforms/vps/srv/wiki-js.nix b/sys/platforms/vps/srv/wiki-js.nix new file mode 100644 index 0000000..f852db5 --- /dev/null +++ b/sys/platforms/vps/srv/wiki-js.nix @@ -0,0 +1,53 @@ +{ + lib, + pkgs, + ... +}: +with lib; { + systemd.services.wiki-js = { + requires = ["postgresql.service"]; + after = ["postgresql.service"]; + }; + + services = { + nginx = { + virtualHosts."wjs.posixlycorrect.com" = { + enableACME = true; + forceSSL = true; + extraConfig = '' + proxy_headers_hash_max_size 512; + proxy_headers_hash_bucket_size 128; + ''; + locations."/" = { + proxyPass = "http://127.0.0.1:3000"; + }; + }; + }; + + wiki-js = { + enable = true; + environmentFile = "/var/trust/wiki-js/env.txt"; + settings = { + bindIP = "127.0.0.1"; + port = 3000; + db = { + db = "wiki-js"; + user = "wiki-js"; + type = "postgres"; + host = "/run/postgresql"; + }; + }; + }; + + postgresql = { + enable = true; + ensureDatabases = ["wiki-js"]; + ensureUsers = [ + { + name = "wiki-js"; + ensureDBOwnership = true; + } + ]; + }; + }; +}