From 48f0c3b3ecc246d7827c8b7a5ce634a13b734e2e Mon Sep 17 00:00:00 2001
From: willifan <willifan@proton.me>
Date: Thu, 12 Dec 2024 22:38:57 +0100
Subject: [PATCH 1/2] added stylix nixpkgs.follows

---
 flake.lock | 20 +++-----------------
 flake.nix  |  5 ++++-
 2 files changed, 7 insertions(+), 18 deletions(-)

diff --git a/flake.lock b/flake.lock
index 6aaf5f0..4a21718 100644
--- a/flake.lock
+++ b/flake.lock
@@ -467,22 +467,6 @@
         "type": "github"
       }
     },
-    "nixpkgs_2": {
-      "locked": {
-        "lastModified": 1732238832,
-        "narHash": "sha256-sQxuJm8rHY20xq6Ah+GwIUkF95tWjGRd1X8xF+Pkk38=",
-        "owner": "NixOS",
-        "repo": "nixpkgs",
-        "rev": "8edf06bea5bcbee082df1b7369ff973b91618b8d",
-        "type": "github"
-      },
-      "original": {
-        "owner": "NixOS",
-        "ref": "nixpkgs-unstable",
-        "repo": "nixpkgs",
-        "type": "github"
-      }
-    },
     "nixvim": {
       "inputs": {
         "devshell": "devshell",
@@ -577,7 +561,9 @@
         "flake-utils": "flake-utils_2",
         "gnome-shell": "gnome-shell",
         "home-manager": "home-manager_3",
-        "nixpkgs": "nixpkgs_2",
+        "nixpkgs": [
+          "nixpkgs"
+        ],
         "systems": "systems_2",
         "tinted-foot": "tinted-foot",
         "tinted-kitty": "tinted-kitty",
diff --git a/flake.nix b/flake.nix
index 0b9c9fd..e87bc18 100644
--- a/flake.nix
+++ b/flake.nix
@@ -19,7 +19,10 @@
       inputs.nixpkgs.follows = "nixpkgs";
     };
 
-    stylix.url = "github:danth/stylix";
+    stylix = {
+      url ="github:danth/stylix";
+      inputs.nixpkgs.follows = "nixpkgs";
+    };
 
     nixvim = {
       url = "github:nix-community/nixvim";

From 65ff3fcd118404da8b40d5dc579da2c282ad3362 Mon Sep 17 00:00:00 2001
From: willifan <willifan@proton.me>
Date: Sun, 15 Dec 2024 13:01:45 +0100
Subject: [PATCH 2/2] modularize config

---
 flake.nix                                     |  8 +--
 hosts/Anton/default.nix                       |  3 +
 hosts/Lenni/default.nix                       |  3 +
 hosts/Lillie/default.nix                      |  4 ++
 hosts/Puenktchen/default.nix                  |  6 +-
 hosts/default.nix                             |  8 ---
 {hosts => modules}/common/autoupdate.nix      |  0
 {hosts => modules}/common/default.nix         |  0
 {hosts => modules}/common/garbage-collect.nix |  0
 {hosts => modules}/common/keyd.nix            |  0
 {hosts => modules}/common/mimetype.nix        |  0
 {hosts => modules}/common/optimise.nix        |  0
 {hosts => modules}/common/sops.nix            |  0
 modules/common/syncthing.nix                  | 70 +++++++++++++++++++
 {hosts => modules}/desktop/boot.nix           |  0
 {hosts => modules}/desktop/default.nix        |  0
 {hosts => modules}/desktop/nfs-client.nix     |  0
 {hosts => modules}/desktop/nix-ld.nix         |  0
 {hosts => modules}/desktop/printers.nix       |  0
 {hosts => modules}/desktop/remoteBuilder.nix  |  0
 {hosts => modules}/desktop/ssh-server.nix     |  0
 {hosts => modules}/server/boot.nix            |  0
 {hosts => modules}/server/builder.nix         |  0
 {hosts => modules}/server/default.nix         |  0
 {hosts => modules}/server/ssh-server.nix      |  0
 25 files changed, 88 insertions(+), 14 deletions(-)
 delete mode 100644 hosts/default.nix
 rename {hosts => modules}/common/autoupdate.nix (100%)
 rename {hosts => modules}/common/default.nix (100%)
 rename {hosts => modules}/common/garbage-collect.nix (100%)
 rename {hosts => modules}/common/keyd.nix (100%)
 rename {hosts => modules}/common/mimetype.nix (100%)
 rename {hosts => modules}/common/optimise.nix (100%)
 rename {hosts => modules}/common/sops.nix (100%)
 create mode 100644 modules/common/syncthing.nix
 rename {hosts => modules}/desktop/boot.nix (100%)
 rename {hosts => modules}/desktop/default.nix (100%)
 rename {hosts => modules}/desktop/nfs-client.nix (100%)
 rename {hosts => modules}/desktop/nix-ld.nix (100%)
 rename {hosts => modules}/desktop/printers.nix (100%)
 rename {hosts => modules}/desktop/remoteBuilder.nix (100%)
 rename {hosts => modules}/desktop/ssh-server.nix (100%)
 rename {hosts => modules}/server/boot.nix (100%)
 rename {hosts => modules}/server/builder.nix (100%)
 rename {hosts => modules}/server/default.nix (100%)
 rename {hosts => modules}/server/ssh-server.nix (100%)

diff --git a/flake.nix b/flake.nix
index e87bc18..6491e71 100644
--- a/flake.nix
+++ b/flake.nix
@@ -76,7 +76,7 @@
           attrs.stylix.nixosModules.stylix
           attrs.nixvim.nixosModules.nixvim
           attrs.nixos-hardware.nixosModules.framework-12th-gen-intel
-          ./hosts
+          ./hosts/Lenni
           ./users/willifan
           ./pkgs
         ];
@@ -107,7 +107,7 @@
           attrs.nixos-hardware.nixosModules.common-cpu-amd
           attrs.nixos-hardware.nixosModules.common-cpu-amd-pstate
           attrs.nixos-hardware.nixosModules.common-cpu-amd-zenpower
-          ./hosts
+          ./hosts/Puenktchen
           ./users/willifan
           ./pkgs
         ];
@@ -138,7 +138,7 @@
           attrs.nixos-hardware.nixosModules.common-cpu-amd
           attrs.nixos-hardware.nixosModules.common-cpu-amd-pstate
           attrs.nixos-hardware.nixosModules.common-cpu-amd-zenpower
-          ./hosts
+          ./hosts/Anton
           ./users/willifan
           ./pkgs
         ];
@@ -167,7 +167,7 @@
           attrs.stylix.nixosModules.stylix
           attrs.nixvim.nixosModules.nixvim
           attrs.jovian.nixosModules.default
-          ./hosts
+          ./hosts/Lillie
           ./users/willifan
           ./pkgs
         ];
diff --git a/hosts/Anton/default.nix b/hosts/Anton/default.nix
index 805a3eb..0d6c148 100644
--- a/hosts/Anton/default.nix
+++ b/hosts/Anton/default.nix
@@ -16,6 +16,9 @@
     ./radicale.nix
     ./syncthing.nix
 
+    ../../modules/common
+    ../../modules/server
+
   ];
 
 }
diff --git a/hosts/Lenni/default.nix b/hosts/Lenni/default.nix
index 5d54942..7c7c9db 100644
--- a/hosts/Lenni/default.nix
+++ b/hosts/Lenni/default.nix
@@ -4,5 +4,8 @@
     ./hardware-configuration.nix
     #./disko.nix
     ./syncthing.nix
+
+    ../../modules/common
+    ../../modules/desktop
   ];
 }
diff --git a/hosts/Lillie/default.nix b/hosts/Lillie/default.nix
index 81f90fb..6951150 100644
--- a/hosts/Lillie/default.nix
+++ b/hosts/Lillie/default.nix
@@ -3,5 +3,9 @@
   imports = [
     ./hardware-configuration.nix
     ./disko.nix
+
+    ../../modules/common
+    ../../modules/desktop
+
   ];
 }
diff --git a/hosts/Puenktchen/default.nix b/hosts/Puenktchen/default.nix
index d34a683..fdbc42e 100644
--- a/hosts/Puenktchen/default.nix
+++ b/hosts/Puenktchen/default.nix
@@ -3,8 +3,10 @@
   imports = [
     ./hardware-configuration.nix
     ./disko.nix
-    ./syncthing.nix
+
+    ../../modules/common
+    ../../modules/desktop
+  
   ];
 
-  boot.initrd.kernelModules = [ "amdgpu" ];
 }
diff --git a/hosts/default.nix b/hosts/default.nix
deleted file mode 100644
index 908c51b..0000000
--- a/hosts/default.nix
+++ /dev/null
@@ -1,8 +0,0 @@
-{ hostname, type, ... }:
-{
-  imports = [
-    ./common
-    ./${type}
-    ./${hostname}
-  ];
-}
diff --git a/hosts/common/autoupdate.nix b/modules/common/autoupdate.nix
similarity index 100%
rename from hosts/common/autoupdate.nix
rename to modules/common/autoupdate.nix
diff --git a/hosts/common/default.nix b/modules/common/default.nix
similarity index 100%
rename from hosts/common/default.nix
rename to modules/common/default.nix
diff --git a/hosts/common/garbage-collect.nix b/modules/common/garbage-collect.nix
similarity index 100%
rename from hosts/common/garbage-collect.nix
rename to modules/common/garbage-collect.nix
diff --git a/hosts/common/keyd.nix b/modules/common/keyd.nix
similarity index 100%
rename from hosts/common/keyd.nix
rename to modules/common/keyd.nix
diff --git a/hosts/common/mimetype.nix b/modules/common/mimetype.nix
similarity index 100%
rename from hosts/common/mimetype.nix
rename to modules/common/mimetype.nix
diff --git a/hosts/common/optimise.nix b/modules/common/optimise.nix
similarity index 100%
rename from hosts/common/optimise.nix
rename to modules/common/optimise.nix
diff --git a/hosts/common/sops.nix b/modules/common/sops.nix
similarity index 100%
rename from hosts/common/sops.nix
rename to modules/common/sops.nix
diff --git a/modules/common/syncthing.nix b/modules/common/syncthing.nix
new file mode 100644
index 0000000..4b06a0c
--- /dev/null
+++ b/modules/common/syncthing.nix
@@ -0,0 +1,70 @@
+{ lib, config, ... }:
+{
+
+  options = {
+
+    syncthing.devices = lib.mkOption {
+      default = { };
+      type = lib.types.attrsOf (lib.types.submodule {
+        options = {
+
+          id = lib.mkOption {
+            type = lib.types.str;
+            default = null;
+          };
+
+        };
+      });
+    };
+  };
+
+  services.syncthing = {
+    enable =  true;
+    user = "willifan";
+    dataDir = "/mnt/data";
+    configDir = "/mnt/data/.config/syncthing";
+    overrideDevices = true;
+    overrideFolders = true;
+    settings = {
+      gui = {
+        user = "willifan";
+        password = "temppassword";
+      };
+      devices = {
+        Anton = { id = "WCDBADD-UPKCACI-X2YJOIO-5QC44PL-DBCR6TS-ADVQV33-HSMF32O-FOKMKAU"; };
+      };
+      folders = {
+        "Documents" = {
+          id = "jtl6g-qjmwo";
+          path = "/mnt/data/Documents";
+          devices = [ "Anton" ];
+        };
+        "Enpass" = {
+          id = "ciksm-xsw4m";
+          path = "/mnt/data/Enpass";
+          devices = [ "Anton" ];
+        };
+        "Pictures" = {
+          id = "po4qj-q9t0t";
+          path = "/mnt/data/Pictures";
+          devices = [ "Anton" ];
+        };
+        "Videos" = {
+          id = "4wqf5-xasng";
+          path = "/mnt/data/Videos";
+          devices = [ "Anton" ];
+        };
+        "Notes" = {
+          id = "oc61n-iewgj";
+          path = "/mnt/data/Notes";
+          devices = [ "Anton" ];
+        };
+        "Music" = {
+          id = "xxh8a-3y2tq";
+          path = "/mnt/data/Music";
+          devices = [ "Anton" ];
+        };
+      };
+    };
+  };
+}
diff --git a/hosts/desktop/boot.nix b/modules/desktop/boot.nix
similarity index 100%
rename from hosts/desktop/boot.nix
rename to modules/desktop/boot.nix
diff --git a/hosts/desktop/default.nix b/modules/desktop/default.nix
similarity index 100%
rename from hosts/desktop/default.nix
rename to modules/desktop/default.nix
diff --git a/hosts/desktop/nfs-client.nix b/modules/desktop/nfs-client.nix
similarity index 100%
rename from hosts/desktop/nfs-client.nix
rename to modules/desktop/nfs-client.nix
diff --git a/hosts/desktop/nix-ld.nix b/modules/desktop/nix-ld.nix
similarity index 100%
rename from hosts/desktop/nix-ld.nix
rename to modules/desktop/nix-ld.nix
diff --git a/hosts/desktop/printers.nix b/modules/desktop/printers.nix
similarity index 100%
rename from hosts/desktop/printers.nix
rename to modules/desktop/printers.nix
diff --git a/hosts/desktop/remoteBuilder.nix b/modules/desktop/remoteBuilder.nix
similarity index 100%
rename from hosts/desktop/remoteBuilder.nix
rename to modules/desktop/remoteBuilder.nix
diff --git a/hosts/desktop/ssh-server.nix b/modules/desktop/ssh-server.nix
similarity index 100%
rename from hosts/desktop/ssh-server.nix
rename to modules/desktop/ssh-server.nix
diff --git a/hosts/server/boot.nix b/modules/server/boot.nix
similarity index 100%
rename from hosts/server/boot.nix
rename to modules/server/boot.nix
diff --git a/hosts/server/builder.nix b/modules/server/builder.nix
similarity index 100%
rename from hosts/server/builder.nix
rename to modules/server/builder.nix
diff --git a/hosts/server/default.nix b/modules/server/default.nix
similarity index 100%
rename from hosts/server/default.nix
rename to modules/server/default.nix
diff --git a/hosts/server/ssh-server.nix b/modules/server/ssh-server.nix
similarity index 100%
rename from hosts/server/ssh-server.nix
rename to modules/server/ssh-server.nix