summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorBenedikt Peetz <benedikt.peetz@b-peetz.de>2024-05-25 22:26:01 +0200
committerBenedikt Peetz <benedikt.peetz@b-peetz.de>2024-06-01 15:32:13 +0200
commit49659abaf8e4f08343835448acc4b092f2773569 (patch)
tree49cc57ed3792131244a1a8c49b9d542746a78cc2
parentfeat(flake): update nixpkgs to 24.05 (diff)
downloadnixos-server-49659abaf8e4f08343835448acc4b092f2773569.tar.gz
nixos-server-49659abaf8e4f08343835448acc4b092f2773569.zip
feat(system/services/nginx)!: Change meaning of `root` key
The `root` key was rather useless (it was always just the
`/etc/.../<domain>` path.). This change gives it a real meaning. See the
'BREAKING CHANGE' section for more information.

BREAKING CHANGE: Previously the `root` key denoted the _absolute_ root of
a repository. Now it just denotes the root relative (i.e. a path within
the built repository) to the repos cloning position.  You should just
remove the absolute part of the path (that, which is not an output in
your built repository)
-rw-r--r--system/services/nginx/default.nix8
-rw-r--r--system/services/nginx/hosts.nix8
2 files changed, 4 insertions, 12 deletions
diff --git a/system/services/nginx/default.nix b/system/services/nginx/default.nix
index 7c2fa55..996996e 100644
--- a/system/services/nginx/default.nix
+++ b/system/services/nginx/default.nix
@@ -14,7 +14,7 @@
   };
   mkVirtHost = {
     domain,
-    root,
+    root ? "",
     url,
     extraSettings ? {},
   }: {
@@ -23,20 +23,20 @@
       lib.recursiveUpdate {
         forceSSL = true;
         enableACME = true;
-        root = "${root}";
+        root = "/etc/nginx/websites/${domain}/${root}";
       }
       extraSettings;
   };
 
   mkNixSyncRepository = {
     domain,
-    root,
+    root ? "",
     url,
     extraSettings ? {},
   }: {
     name = "${domain}";
     value = {
-      path = "${root}";
+      path = "/etc/nginx/websites/${domain}/${root}";
       uri = "${url}";
       inherit extraSettings;
     };
diff --git a/system/services/nginx/hosts.nix b/system/services/nginx/hosts.nix
index 9bad97d..98dbbf1 100644
--- a/system/services/nginx/hosts.nix
+++ b/system/services/nginx/hosts.nix
@@ -11,45 +11,37 @@
 in [
   {
     domain = "vhack.eu";
-    root = "/etc/nginx/websites/vhack.eu";
     url = "https://codeberg.org/vhack.eu/website.git";
   }
   {
     domain = "b-peetz.de";
-    root = "/etc/nginx/websites/b-peetz.de";
     url = "https://codeberg.org/bpeetz/b-peetz.de.git";
   }
 
   # Trinitrix
   {
     domain = "trinitrix.vhack.eu";
-    # FIXME(@bpeetz): Remove the need for this pointless path.  <2024-05-25>
-    root = "/etc/nginix/websites/trinitrix.vhack.eu";
     url = "https://codeberg.org/trinitrix/website.git";
   }
 
   # WKD
   {
     domain = "openpgpkey.b-peetz.de";
-    root = "/etc/nginx/websites/openpgpkey.b-peetz.de";
     url = "https://codeberg.org/vhack.eu/gpg_wkd.git";
     extraSettings = extraWkdSettings;
   }
   {
     domain = "openpgpkey.s-schoeffel.de";
-    root = "/etc/nginx/websites/openpgpkey.s-schoeffel.de";
     url = "https://codeberg.org/vhack.eu/gpg_wkd.git";
     extraSettings = extraWkdSettings;
   }
   {
     domain = "openpgpkey.sils.li";
-    root = "/etc/nginx/websites/openpgpkey.sils.li";
     url = "https://codeberg.org/vhack.eu/gpg_wkd.git";
     extraSettings = extraWkdSettings;
   }
   {
     domain = "openpgpkey.vhack.eu";
-    root = "/etc/nginx/websites/openpgpkey.vhack.eu";
     url = "https://codeberg.org/vhack.eu/gpg_wkd.git";
     extraSettings = extraWkdSettings;
   }