From 3ab76ae6168be961e830ab6b66b7d6cb907b091c Mon Sep 17 00:00:00 2001
From: eyjhb <eyjhbb@gmail.com>
Date: Fri, 16 Aug 2024 14:19:37 +0200
Subject: [PATCH] bump from nixos-24.11 to nixos-unstable + bumped stateVersion

---
 machines/gerd.nix                               |  2 +-
 machines/gerd/services/authelia/authelia.nix    |  5 ++++-
 machines/gerd/services/forgejo/auth_sources.nix |  1 -
 machines/gerd/services/nextcloud.nix            |  4 ++--
 shared/sources/sources.json                     | 14 ++++++++++----
 5 files changed, 17 insertions(+), 9 deletions(-)

diff --git a/machines/gerd.nix b/machines/gerd.nix
index 76978f7..d732d35 100644
--- a/machines/gerd.nix
+++ b/machines/gerd.nix
@@ -48,5 +48,5 @@
     };
   };
 
-  system.stateVersion = "24.05";
+  system.stateVersion = "24.11";
 }
diff --git a/machines/gerd/services/authelia/authelia.nix b/machines/gerd/services/authelia/authelia.nix
index fff4ecb..291e327 100644
--- a/machines/gerd/services/authelia/authelia.nix
+++ b/machines/gerd/services/authelia/authelia.nix
@@ -4,6 +4,7 @@ let
   svc_domain = "auth.${config.mine.shared.settings.domain}";
 
   autheliaStateDir = "/var/lib/authelia-main";
+  port = 9091;
 in {
   services.authelia.instances.main = {
     enable = true;
@@ -19,6 +20,8 @@ in {
     settings = {
       session.domain = config.mine.shared.settings.domain;
 
+      server.address = "tcp://127.0.0.1:${builtins.toString port}";
+
       # totp - disable for now, as it requires email server
       access_control.default_policy = "one_factor";
       # totp.disable = true;
@@ -62,7 +65,7 @@ in {
   services.nginx.virtualHosts."${svc_domain}" = {
     forceSSL = true;
     enableACME = true;
-    locations."/".proxyPass = "http://localhost:${builtins.toString config.services.authelia.instances.main.settings.server.port}";
+    locations."/".proxyPass = "http://localhost:${builtins.toString port}";
   };
 
   # persistent files
diff --git a/machines/gerd/services/forgejo/auth_sources.nix b/machines/gerd/services/forgejo/auth_sources.nix
index 200e52e..5c69bec 100644
--- a/machines/gerd/services/forgejo/auth_sources.nix
+++ b/machines/gerd/services/forgejo/auth_sources.nix
@@ -83,7 +83,6 @@ let
     echo "PRERUN-AUTH: Finished adding/updating..."
   '';
 in {
-
   systemd.services.forgejo.preStart = lib.mkAfter ''
     ${scriptAddLDAPAuth}
     ${scriptAddOAuth}
diff --git a/machines/gerd/services/nextcloud.nix b/machines/gerd/services/nextcloud.nix
index db0afbb..bf21d03 100644
--- a/machines/gerd/services/nextcloud.nix
+++ b/machines/gerd/services/nextcloud.nix
@@ -129,7 +129,7 @@ in {
         version = "3.1.1";
         # TODO(eyJhb): add to niv
       in pkgs.fetchNextcloudApp {
-          sha256 = "sha256-EVHDDFtz92lZviuTqr+St7agfBWok83HpfuL6DFCoTE=";
+          sha256 = "sha256-b/tKk+y+ZypCHGNDtunDua2msYD6/TzA0haoC0k85F4=";
           url = "https://github.com/pulsejet/nextcloud-oidc-login/releases/download/v${version}/oidc_login.tar.gz";
           license = "agpl3Only";
       };
@@ -162,7 +162,7 @@ in {
 
   systemd.services.nextcloud-setup = {
     # runs this after all the main nextcloud-setup stuff
-    postStop = lib.mkAfter ''
+    script = lib.mkAfter ''
       ${nextcloudSetupLdap}
       ${nextcloudSetupAdmin}
       ${nextcloudSetupEncryption}
diff --git a/shared/sources/sources.json b/shared/sources/sources.json
index 2d57f8b..a4be058 100644
--- a/shared/sources/sources.json
+++ b/shared/sources/sources.json
@@ -35,16 +35,22 @@
         "url": "https://github.com/nix-community/impermanence/archive/23c1f06316b67cb5dabdfe2973da3785cfe9c34a.tar.gz",
         "url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
     },
-    "nixpkgs": {
+    "nixos-mailserver": {
         "branch": "nixos-24.05",
+        "repo": "git@gitlab.com:simple-nixos-mailserver/nixos-mailserver.git",
+        "rev": "29916981e7b3b5782dc5085ad18490113f8ff63b",
+        "type": "git"
+    },
+    "nixpkgs": {
+        "branch": "nixos-unstable",
         "description": "Nix Packages collection",
         "homepage": null,
         "owner": "NixOS",
         "repo": "nixpkgs",
-        "rev": "4a92571f9207810b559c9eac203d1f4d79830073",
-        "sha256": "0sp7qjbb7dvrh4zvd40i6y7jwsd1v1qj44f0c95q88g7fikda8gq",
+        "rev": "c3aa7b8938b17aebd2deecf7be0636000d62a2b9",
+        "sha256": "1ds3yjcy52l8d3rkxr3b7h9c0c3nly079bgakjaasnfjj3xprrwr",
         "type": "tarball",
-        "url": "https://github.com/NixOS/nixpkgs/archive/4a92571f9207810b559c9eac203d1f4d79830073.tar.gz",
+        "url": "https://github.com/NixOS/nixpkgs/archive/c3aa7b8938b17aebd2deecf7be0636000d62a2b9.tar.gz",
         "url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
     }
 }