ctucx.git: nixfiles

ctucx' nixfiles

commit cf947f5ba13084793e61ea439def4fcab1060406
parent 0e5b8f01953ca3da26c1d9c077c89a0d7b0f62ef
Author: Leah (ctucx) <git@ctu.cx>
Date: Tue, 13 Jun 2023 19:56:43 +0200

cleanup
3 files changed, 22 insertions(+), 37 deletions(-)
diff --git a/machines/briefkasten/gotosocial.nix b/machines/briefkasten/gotosocial.nix
@@ -73,7 +73,7 @@ in {
       "= /".return = "307 /@leah";
 
       "/" = {
-        proxyPass       = "http://[::1]:8085/";
+        proxyPass       = "http://[::1]:8085";
         proxyWebsockets = true;
       };
 
diff --git a/machines/briefkasten/websites/photos.ctu.cx.nix b/machines/briefkasten/websites/photos.ctu.cx.nix
@@ -2,46 +2,31 @@
 
 let
   galleryConfig = {
-    SourceDir  = "/mnt/photos.ctu.cx";
-    TargetDir  = "/var/lib/ctucx-gallery";
-    MogrifyCmd = "${pkgs.imagemagick}/bin/mogrify";
-
-    Thumbnails = {
-      SmallHeight  = "200";
-      SmallQuality = "90";
+    globalSection = {
+      SourceDir  = "/mnt/photos.ctu.cx";
+      TargetDir  = "/var/lib/ctucx-gallery";
+      MogrifyCmd = "${pkgs.imagemagick}/bin/mogrify";
     };
 
-    Site = {
-      Author              = "ctucx";
-      Name                = "ctucx.photos";
-      Description         = "photos that i made";
-      Tags                = "ctucx, ctucx bahnbilder";
-      ShowOriginalsButton = "true";
-      SymlinkOriginals    = "true";
-      EnableJS            = "true";
+    sections = {
+      Thumbnails = {
+        SmallHeight  = "200";
+        SmallQuality = "90";
+      };
+
+      Site = {
+        Author              = "ctucx";
+        Name                = "ctucx.photos";
+        Description         = "photos that i made";
+        Tags                = "ctucx, ctucx bahnbilder";
+        ShowOriginalsButton = "true";
+        SymlinkOriginals    = "true";
+        EnableJS            = "true";
+      };
     };
   };
 
-#  toINI() currently doesn't elements that are not in sections
-#  galleryConfigFile = pkgs.writeText "gallery.ini" (lib.generators.toINI {} galleryConfig);
-  galleryConfigFile = pkgs.writeText "gallery.ini" ''
-    SourceDir  = "${galleryConfig.SourceDir}"
-    TargetDir  = "${galleryConfig.TargetDir}"
-    MogrifyCmd = "${galleryConfig.MogrifyCmd}"
-
-    [Thumbnails]
-    SmallHeight  = ${galleryConfig.Thumbnails.SmallHeight}
-    SmallQuality = ${galleryConfig.Thumbnails.SmallQuality}
-
-    [Site]
-    Author              = "${galleryConfig.Site.Author}"
-    Name                = "${galleryConfig.Site.Name}"
-    Description         = "${galleryConfig.Site.Description}"
-    Tags                = "${galleryConfig.Site.Tags}"
-    ShowOriginalsButton = ${galleryConfig.Site.ShowOriginalsButton}
-    SymlinkOriginals    = ${galleryConfig.Site.SymlinkOriginals}
-    EnableJS            = ${galleryConfig.Site.EnableJS};
-  '';
+  galleryConfigFile = pkgs.writeText "gallery.ini" (lib.generators.toINIWithGlobalSection {} galleryConfig);
 
 in {
 
diff --git a/machines/trabbi/websites/ctu.cx.nix b/machines/trabbi/websites/ctu.cx.nix
@@ -10,8 +10,8 @@
       enableACME = true;
       forceSSL   = true;
       kTLS       = true;
+      root       = ./ctu.cx;
       locations  = {
-        "/".root = ./ctu.cx;
         "/netzabdeckung.html".return = "307 https://wifionic.de/";
         "/bikemap".return = "307 https://bikemap.ctu.cx/";
       };