From 1a5d835d47a9f8885d1be8aabc6426e819e4f835 Mon Sep 17 00:00:00 2001
From: notohh <github@notohh.dev>
Date: Sat, 8 Feb 2025 13:30:25 -0500
Subject: [PATCH 1/5] add pre-commit to separate module && init topology

---
 flake.lock             | 191 +++++++++++++++++++++++++++++++++++------
 flake.nix              |  29 ++-----
 modules/pre-commit.nix |  27 ++++++
 modules/topology.nix   |  16 ++++
 4 files changed, 216 insertions(+), 47 deletions(-)
 create mode 100644 modules/pre-commit.nix
 create mode 100644 modules/topology.nix

diff --git a/flake.lock b/flake.lock
index dffbce7..9208c02 100644
--- a/flake.lock
+++ b/flake.lock
@@ -515,6 +515,27 @@
         "type": "github"
       }
     },
+    "devshell": {
+      "inputs": {
+        "nixpkgs": [
+          "nix-topology",
+          "nixpkgs"
+        ]
+      },
+      "locked": {
+        "lastModified": 1728330715,
+        "narHash": "sha256-xRJ2nPOXb//u1jaBnDP56M7v5ldavjbtR6lfGqSvcKg=",
+        "owner": "numtide",
+        "repo": "devshell",
+        "rev": "dd6b80932022cea34a019e2bb32f6fa9e494dfef",
+        "type": "github"
+      },
+      "original": {
+        "owner": "numtide",
+        "repo": "devshell",
+        "type": "github"
+      }
+    },
     "eww": {
       "inputs": {
         "flake-compat": "flake-compat_7",
@@ -649,20 +670,6 @@
       }
     },
     "flake-compat_12": {
-      "locked": {
-        "lastModified": 1733328505,
-        "narHash": "sha256-NeCCThCEP3eCl2l/+27kNNK7QrwZB1IJCrXfrbv5oqU=",
-        "rev": "ff81ac966bb2cae68946d5ed5fc4994f96d0ffec",
-        "revCount": 69,
-        "type": "tarball",
-        "url": "https://api.flakehub.com/f/pinned/edolstra/flake-compat/1.1.0/01948eb7-9cba-704f-bbf3-3fa956735b52/source.tar.gz"
-      },
-      "original": {
-        "type": "tarball",
-        "url": "https://flakehub.com/f/edolstra/flake-compat/1.tar.gz"
-      }
-    },
-    "flake-compat_13": {
       "flake": false,
       "locked": {
         "lastModified": 1696426674,
@@ -678,7 +685,37 @@
         "type": "github"
       }
     },
+    "flake-compat_13": {
+      "locked": {
+        "lastModified": 1733328505,
+        "narHash": "sha256-NeCCThCEP3eCl2l/+27kNNK7QrwZB1IJCrXfrbv5oqU=",
+        "rev": "ff81ac966bb2cae68946d5ed5fc4994f96d0ffec",
+        "revCount": 69,
+        "type": "tarball",
+        "url": "https://api.flakehub.com/f/pinned/edolstra/flake-compat/1.1.0/01948eb7-9cba-704f-bbf3-3fa956735b52/source.tar.gz"
+      },
+      "original": {
+        "type": "tarball",
+        "url": "https://flakehub.com/f/edolstra/flake-compat/1.tar.gz"
+      }
+    },
     "flake-compat_14": {
+      "flake": false,
+      "locked": {
+        "lastModified": 1696426674,
+        "narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=",
+        "owner": "edolstra",
+        "repo": "flake-compat",
+        "rev": "0f9255e01c2351cc7d116c072cb317785dd33b33",
+        "type": "github"
+      },
+      "original": {
+        "owner": "edolstra",
+        "repo": "flake-compat",
+        "type": "github"
+      }
+    },
+    "flake-compat_15": {
       "flake": false,
       "locked": {
         "lastModified": 1733328505,
@@ -1119,11 +1156,11 @@
         "systems": "systems_22"
       },
       "locked": {
-        "lastModified": 1731533236,
-        "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
+        "lastModified": 1726560853,
+        "narHash": "sha256-X6rJYSESBVr3hBoH0WbKE5KvhPU5bloyZ2L4K60/fPQ=",
         "owner": "numtide",
         "repo": "flake-utils",
-        "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
+        "rev": "c1dfcf08411b08f6b8615f7d8971a2bfa81d5e8a",
         "type": "github"
       },
       "original": {
@@ -1168,6 +1205,24 @@
         "type": "github"
       }
     },
+    "flake-utils_9": {
+      "inputs": {
+        "systems": "systems_25"
+      },
+      "locked": {
+        "lastModified": 1731533236,
+        "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
+        "owner": "numtide",
+        "repo": "flake-utils",
+        "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
+        "type": "github"
+      },
+      "original": {
+        "owner": "numtide",
+        "repo": "flake-utils",
+        "type": "github"
+      }
+    },
     "flocon": {
       "inputs": {
         "agenix": "agenix",
@@ -1322,6 +1377,28 @@
       }
     },
     "gitignore_5": {
+      "inputs": {
+        "nixpkgs": [
+          "nix-topology",
+          "pre-commit-hooks",
+          "nixpkgs"
+        ]
+      },
+      "locked": {
+        "lastModified": 1709087332,
+        "narHash": "sha256-HG2cCnktfHsKV0s4XW83gU3F57gaTljL9KNSuG6bnQs=",
+        "owner": "hercules-ci",
+        "repo": "gitignore.nix",
+        "rev": "637db329424fd7e46cf4185293b9cc8c88c95394",
+        "type": "github"
+      },
+      "original": {
+        "owner": "hercules-ci",
+        "repo": "gitignore.nix",
+        "type": "github"
+      }
+    },
+    "gitignore_6": {
       "inputs": {
         "nixpkgs": [
           "pre-commit-hooks",
@@ -3119,6 +3196,29 @@
         "type": "github"
       }
     },
+    "nix-topology": {
+      "inputs": {
+        "devshell": "devshell",
+        "flake-utils": "flake-utils_6",
+        "nixpkgs": [
+          "nixpkgs"
+        ],
+        "pre-commit-hooks": "pre-commit-hooks_4"
+      },
+      "locked": {
+        "lastModified": 1738246091,
+        "narHash": "sha256-2+KkZsRO+XlOFbXbRgMZbRtlqn5MBNYj4HNmZ/2Tojg=",
+        "owner": "oddlama",
+        "repo": "nix-topology",
+        "rev": "5526269fa3eedf4f4bc00c0bf7a03db31d24b029",
+        "type": "github"
+      },
+      "original": {
+        "owner": "oddlama",
+        "repo": "nix-topology",
+        "type": "github"
+      }
+    },
     "nixos-hardware": {
       "locked": {
         "lastModified": 1738816619,
@@ -3276,8 +3376,8 @@
     },
     "nixpkgs-xr": {
       "inputs": {
-        "flake-compat": "flake-compat_12",
-        "flake-utils": "flake-utils_6",
+        "flake-compat": "flake-compat_13",
+        "flake-utils": "flake-utils_7",
         "nixpkgs": "nixpkgs_19",
         "treefmt-nix": "treefmt-nix_2"
       },
@@ -6604,8 +6704,35 @@
     },
     "pre-commit-hooks_4": {
       "inputs": {
-        "flake-compat": "flake-compat_13",
+        "flake-compat": "flake-compat_12",
         "gitignore": "gitignore_5",
+        "nixpkgs": [
+          "nix-topology",
+          "nixpkgs"
+        ],
+        "nixpkgs-stable": [
+          "nix-topology",
+          "nixpkgs"
+        ]
+      },
+      "locked": {
+        "lastModified": 1730797577,
+        "narHash": "sha256-SrID5yVpyUfknUTGWgYkTyvdr9J1LxUym4om3SVGPkg=",
+        "owner": "cachix",
+        "repo": "pre-commit-hooks.nix",
+        "rev": "1864030ed24a2b8b4e4d386a5eeaf0c5369e50a9",
+        "type": "github"
+      },
+      "original": {
+        "owner": "cachix",
+        "repo": "pre-commit-hooks.nix",
+        "type": "github"
+      }
+    },
+    "pre-commit-hooks_5": {
+      "inputs": {
+        "flake-compat": "flake-compat_14",
+        "gitignore": "gitignore_6",
         "nixpkgs": "nixpkgs_21"
       },
       "locked": {
@@ -6624,7 +6751,7 @@
     },
     "prismlauncher": {
       "inputs": {
-        "flake-compat": "flake-compat_14",
+        "flake-compat": "flake-compat_15",
         "libnbtplusplus": "libnbtplusplus",
         "nix-filter": "nix-filter_2",
         "nixpkgs": "nixpkgs_22"
@@ -6706,11 +6833,12 @@
         "hyprwayland-scanner": "hyprwayland-scanner_11",
         "manga-tui": "manga-tui",
         "nix-gaming": "nix-gaming_2",
+        "nix-topology": "nix-topology",
         "nixos-hardware": "nixos-hardware_2",
         "nixpkgs": "nixpkgs_18",
         "nixpkgs-xr": "nixpkgs-xr",
         "nur": "nur",
-        "pre-commit-hooks": "pre-commit-hooks_4",
+        "pre-commit-hooks": "pre-commit-hooks_5",
         "prismlauncher": "prismlauncher",
         "scls": "scls",
         "sops-nix": "sops-nix",
@@ -6878,7 +7006,7 @@
     },
     "scls": {
       "inputs": {
-        "flake-utils": "flake-utils_7",
+        "flake-utils": "flake-utils_8",
         "naersk": "naersk",
         "nixpkgs": [
           "nixpkgs"
@@ -7173,6 +7301,21 @@
         "type": "github"
       }
     },
+    "systems_25": {
+      "locked": {
+        "lastModified": 1681028828,
+        "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
+        "owner": "nix-systems",
+        "repo": "default",
+        "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
+        "type": "github"
+      },
+      "original": {
+        "owner": "nix-systems",
+        "repo": "default",
+        "type": "github"
+      }
+    },
     "systems_3": {
       "locked": {
         "lastModified": 1689347949,
@@ -7483,7 +7626,7 @@
     },
     "yazi": {
       "inputs": {
-        "flake-utils": "flake-utils_8",
+        "flake-utils": "flake-utils_9",
         "nixpkgs": "nixpkgs_23",
         "rust-overlay": "rust-overlay_5"
       },
diff --git a/flake.nix b/flake.nix
index ec22d8f..3acebce 100755
--- a/flake.nix
+++ b/flake.nix
@@ -4,11 +4,12 @@
   outputs = inputs:
     inputs.flake-parts.lib.mkFlake {inherit inputs;} {
       imports = [
-        inputs.pre-commit-hooks.flakeModule
         ./hosts
         ./overlays
         ./hosts/deploy.nix
         ./home/profiles
+        ./modules/pre-commit.nix
+        ./modules/topology.nix
       ];
       systems = ["x86_64-linux"];
       perSystem = {
@@ -16,28 +17,6 @@
         pkgs,
         ...
       }: {
-        pre-commit = {
-          check.enable = true;
-          settings = {
-            excludes = ["flake.lock"];
-            hooks = {
-              stylua.enable = true;
-              statix.enable = true;
-              alejandra.enable = true;
-              deadnix = {
-                enable = true;
-                excludes = ["technorino.nix"];
-              };
-              prettier = {
-                enable = true;
-                files = "\\.(js|ts|md|json)$";
-                settings = {
-                  trailing-comma = "none";
-                };
-              };
-            };
-          };
-        };
         devShells.default = pkgs.mkShell {
           name = "snowflake";
           shellHook = config.pre-commit.installationScript;
@@ -137,5 +116,9 @@
       url = "github:youwen5/zen-browser-flake";
       inputs.nixpkgs.follows = "nixpkgs";
     };
+    nix-topology = {
+      url = "github:oddlama/nix-topology";
+      inputs.nixpkgs.follows = "nixpkgs";
+    };
   };
 }
diff --git a/modules/pre-commit.nix b/modules/pre-commit.nix
new file mode 100644
index 0000000..00f54c8
--- /dev/null
+++ b/modules/pre-commit.nix
@@ -0,0 +1,27 @@
+{inputs, ...}: {
+  imports = [
+    inputs.pre-commit-hooks.flakeModule
+  ];
+  perSystem.pre-commit = {
+    check.enable = true;
+    settings = {
+      excludes = ["flake.lock"];
+      hooks = {
+        stylua.enable = true;
+        statix.enable = true;
+        alejandra.enable = true;
+        deadnix = {
+          enable = true;
+          excludes = ["technorino.nix"];
+        };
+        prettier = {
+          enable = true;
+          files = "\\.(js|ts|md|json)$";
+          settings = {
+            trailing-comma = "none";
+          };
+        };
+      };
+    };
+  };
+}
diff --git a/modules/topology.nix b/modules/topology.nix
new file mode 100644
index 0000000..f19204c
--- /dev/null
+++ b/modules/topology.nix
@@ -0,0 +1,16 @@
+{
+  inputs,
+  self,
+  ...
+}: {
+  imports = [
+    inputs.nix-topology.flakeModule
+  ];
+  perSystem = _: {
+    topology.modules = [
+      {
+        inherit (self) nixosConfigurations;
+      }
+    ];
+  };
+}

From 6fe24f311f6eeada43de6c53d59d3fafe71d6bf4 Mon Sep 17 00:00:00 2001
From: notohh <github@notohh.dev>
Date: Sat, 8 Feb 2025 13:41:37 -0500
Subject: [PATCH 2/5] move modules to hosts/common

---
 hosts/ame/default.nix                        |  5 ++---
 hosts/arashi/default.nix                     |  3 +--
 hosts/common.nix                             |  8 --------
 {modules => hosts/common}/README.md          |  0
 hosts/common/default.nix                     | 17 +++++++++++++++++
 {modules => hosts/common}/fonts.nix          |  0
 {modules => hosts/common}/nix.nix            |  0
 {modules => hosts/common}/openssh.nix        |  0
 {modules => hosts/common}/prometheus.nix     |  0
 {modules => hosts/common}/security.nix       |  0
 {modules => hosts/common}/sops.nix           |  2 +-
 {modules => hosts/common}/system.nix         |  0
 {modules => hosts/common}/time.nix           |  0
 {modules => hosts/common}/users.nix          |  0
 {modules => hosts/common}/virtualisation.nix |  0
 hosts/haru/default.nix                       |  3 +--
 hosts/kariru/default.nix                     |  3 +--
 hosts/kaze/default.nix                       |  3 +--
 hosts/sakura/default.nix                     |  3 +--
 hosts/sora/default.nix                       |  3 +--
 hosts/tsuki/default.nix                      |  6 +++---
 hosts/tsuru/default.nix                      |  3 +--
 hosts/yuki/default.nix                       |  3 +--
 hosts/yuki/services/hass/config.nix          |  2 +-
 modules/default.nix                          | 13 -------------
 25 files changed, 32 insertions(+), 45 deletions(-)
 delete mode 100644 hosts/common.nix
 rename {modules => hosts/common}/README.md (100%)
 create mode 100644 hosts/common/default.nix
 rename {modules => hosts/common}/fonts.nix (100%)
 rename {modules => hosts/common}/nix.nix (100%)
 rename {modules => hosts/common}/openssh.nix (100%)
 rename {modules => hosts/common}/prometheus.nix (100%)
 rename {modules => hosts/common}/security.nix (100%)
 rename {modules => hosts/common}/sops.nix (62%)
 rename {modules => hosts/common}/system.nix (100%)
 rename {modules => hosts/common}/time.nix (100%)
 rename {modules => hosts/common}/users.nix (100%)
 rename {modules => hosts/common}/virtualisation.nix (100%)
 delete mode 100644 modules/default.nix

diff --git a/hosts/ame/default.nix b/hosts/ame/default.nix
index 71b9842..cb91f4e 100644
--- a/hosts/ame/default.nix
+++ b/hosts/ame/default.nix
@@ -3,9 +3,8 @@ _: {
     ./hardware.nix
     ./services
     ./networking.nix
-    ../common.nix
-    ../../modules
-    ../../modules/fonts.nix
+    ../common
+    ../common/fonts.nix
   ];
 
   programs.hyprland.enable = true;
diff --git a/hosts/arashi/default.nix b/hosts/arashi/default.nix
index 053a564..8b8526d 100644
--- a/hosts/arashi/default.nix
+++ b/hosts/arashi/default.nix
@@ -3,8 +3,7 @@
     ./hardware.nix
     ./services
     ./networking.nix
-    ../common.nix
-    ../../modules
+    ../common
   ];
 
   users = {
diff --git a/hosts/common.nix b/hosts/common.nix
deleted file mode 100644
index 919e406..0000000
--- a/hosts/common.nix
+++ /dev/null
@@ -1,8 +0,0 @@
-{inputs, ...}: {
-  imports = [
-    inputs.sops-nix.nixosModules.sops
-    inputs.home-manager.nixosModules.home-manager
-    inputs.nur.modules.nixos.default
-    # inputs.attic.nixosModules.atticd
-  ];
-}
diff --git a/modules/README.md b/hosts/common/README.md
similarity index 100%
rename from modules/README.md
rename to hosts/common/README.md
diff --git a/hosts/common/default.nix b/hosts/common/default.nix
new file mode 100644
index 0000000..cd5b6e0
--- /dev/null
+++ b/hosts/common/default.nix
@@ -0,0 +1,17 @@
+{inputs, ...}: {
+  imports = [
+    inputs.sops-nix.nixosModules.sops
+    inputs.home-manager.nixosModules.home-manager
+    inputs.nur.modules.nixos.default
+    inputs.nix-topology.nixosModules.default
+    ./prometheus.nix
+    ./security.nix
+    ./users.nix
+    ./nix.nix
+    ./system.nix
+    ./openssh.nix
+    ./virtualisation.nix
+    ./sops.nix
+    ./time.nix
+  ];
+}
diff --git a/modules/fonts.nix b/hosts/common/fonts.nix
similarity index 100%
rename from modules/fonts.nix
rename to hosts/common/fonts.nix
diff --git a/modules/nix.nix b/hosts/common/nix.nix
similarity index 100%
rename from modules/nix.nix
rename to hosts/common/nix.nix
diff --git a/modules/openssh.nix b/hosts/common/openssh.nix
similarity index 100%
rename from modules/openssh.nix
rename to hosts/common/openssh.nix
diff --git a/modules/prometheus.nix b/hosts/common/prometheus.nix
similarity index 100%
rename from modules/prometheus.nix
rename to hosts/common/prometheus.nix
diff --git a/modules/security.nix b/hosts/common/security.nix
similarity index 100%
rename from modules/security.nix
rename to hosts/common/security.nix
diff --git a/modules/sops.nix b/hosts/common/sops.nix
similarity index 62%
rename from modules/sops.nix
rename to hosts/common/sops.nix
index e79cf14..5db3874 100644
--- a/modules/sops.nix
+++ b/hosts/common/sops.nix
@@ -1,6 +1,6 @@
 _: {
   sops = {
-    defaultSopsFile = ../secrets/secrets.yaml;
+    defaultSopsFile = ../../secrets/secrets.yaml;
     age.keyFile = "/home/notoh/.config/sops/age/keys.txt";
   };
 }
diff --git a/modules/system.nix b/hosts/common/system.nix
similarity index 100%
rename from modules/system.nix
rename to hosts/common/system.nix
diff --git a/modules/time.nix b/hosts/common/time.nix
similarity index 100%
rename from modules/time.nix
rename to hosts/common/time.nix
diff --git a/modules/users.nix b/hosts/common/users.nix
similarity index 100%
rename from modules/users.nix
rename to hosts/common/users.nix
diff --git a/modules/virtualisation.nix b/hosts/common/virtualisation.nix
similarity index 100%
rename from modules/virtualisation.nix
rename to hosts/common/virtualisation.nix
diff --git a/hosts/haru/default.nix b/hosts/haru/default.nix
index 945b49b..27e514e 100644
--- a/hosts/haru/default.nix
+++ b/hosts/haru/default.nix
@@ -3,8 +3,7 @@
     ./hardware.nix
     ./services
     ./networking.nix
-    ../common.nix
-    ../../modules
+    ../common
   ];
 
   users = {
diff --git a/hosts/kariru/default.nix b/hosts/kariru/default.nix
index 53b937f..0069e3a 100644
--- a/hosts/kariru/default.nix
+++ b/hosts/kariru/default.nix
@@ -3,8 +3,7 @@
     ./hardware.nix
     ./services
     ./networking.nix
-    ../common.nix
-    ../../modules
+    ../common
   ];
 
   users = {
diff --git a/hosts/kaze/default.nix b/hosts/kaze/default.nix
index 86d9731..161e8c4 100644
--- a/hosts/kaze/default.nix
+++ b/hosts/kaze/default.nix
@@ -3,8 +3,7 @@
     ./hardware.nix
     ./services
     ./networking.nix
-    ../common.nix
-    ../../modules
+    ../common
   ];
 
   users = {
diff --git a/hosts/sakura/default.nix b/hosts/sakura/default.nix
index 4355e29..73384fb 100644
--- a/hosts/sakura/default.nix
+++ b/hosts/sakura/default.nix
@@ -3,8 +3,7 @@ _: {
     ./hardware.nix
     ./services
     ./networking.nix
-    ../common.nix
-    ../../modules
+    ../common
   ];
 
   users = {
diff --git a/hosts/sora/default.nix b/hosts/sora/default.nix
index 6b808e7..c352a42 100644
--- a/hosts/sora/default.nix
+++ b/hosts/sora/default.nix
@@ -3,8 +3,7 @@ _: {
     ./hardware.nix
     ./networking.nix
     ./services
-    ../common.nix
-    ../../modules
+    ../common
   ];
 
   services.snowflake-proxy.enable = true;
diff --git a/hosts/tsuki/default.nix b/hosts/tsuki/default.nix
index 0459266..b69bdcb 100755
--- a/hosts/tsuki/default.nix
+++ b/hosts/tsuki/default.nix
@@ -10,10 +10,10 @@
     ./services
     ./networking.nix
     ./gaming.nix
-    ../common.nix
+    ./topology.nix
+    ../common
+    ../common/fonts.nix
     ../../home/wayland
-    ../../modules
-    ../../modules/fonts.nix
   ];
 
   virtualisation = {
diff --git a/hosts/tsuru/default.nix b/hosts/tsuru/default.nix
index 67df882..1b85e28 100644
--- a/hosts/tsuru/default.nix
+++ b/hosts/tsuru/default.nix
@@ -3,8 +3,7 @@
     ./hardware.nix
     ./services
     ./networking.nix
-    ../common.nix
-    ../../modules
+    ../common
   ];
 
   users = {
diff --git a/hosts/yuki/default.nix b/hosts/yuki/default.nix
index d04b201..c8d505d 100644
--- a/hosts/yuki/default.nix
+++ b/hosts/yuki/default.nix
@@ -3,8 +3,7 @@
     ./hardware.nix
     ./services
     ./networking.nix
-    ../common.nix
-    ../../modules
+    ../common
   ];
 
   users = {
diff --git a/hosts/yuki/services/hass/config.nix b/hosts/yuki/services/hass/config.nix
index c73ff39..7253367 100644
--- a/hosts/yuki/services/hass/config.nix
+++ b/hosts/yuki/services/hass/config.nix
@@ -2,7 +2,7 @@ _: {
   services.home-assistant.config = {
     lovelace.mode = "yaml";
     http = {
-      server_host = "0.0.0.0";
+      server_host = ["0.0.0.0"];
       server_port = 8123;
     };
     homeassistant = {
diff --git a/modules/default.nix b/modules/default.nix
deleted file mode 100644
index fb3ae59..0000000
--- a/modules/default.nix
+++ /dev/null
@@ -1,13 +0,0 @@
-_: {
-  imports = [
-    ./prometheus.nix
-    ./security.nix
-    ./users.nix
-    ./nix.nix
-    ./system.nix
-    ./openssh.nix
-    ./virtualisation.nix
-    ./sops.nix
-    ./time.nix
-  ];
-}

From a69380665e9f57de456a963eb36e9d433a642bde Mon Sep 17 00:00:00 2001
From: notohh <github@notohh.dev>
Date: Sat, 8 Feb 2025 17:45:44 -0500
Subject: [PATCH 3/5] nu: add generate-topology alias

---
 home/programs/terminal/nushell/config.nu | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/home/programs/terminal/nushell/config.nu b/home/programs/terminal/nushell/config.nu
index 051726f..19cd8e0 100755
--- a/home/programs/terminal/nushell/config.nu
+++ b/home/programs/terminal/nushell/config.nu
@@ -39,6 +39,7 @@ alias tail = tspin
 alias spotify = spotify_player
 alias atac =  atac --directory ~/.config/atac/
 alias zed = zeditor .
+alias generate-topology = nix build ".#topology.x86_64-linux.config.output"
 nitch
 
 $env.config = {
@@ -221,7 +222,7 @@ $env.config = {
             | where command =~ $buffer
             | each { |it| {value: $it.command description: $it.usage} }
         }
-      } 
+      }
   ]
   keybindings: [
     {
@@ -325,7 +326,7 @@ $env.config = {
       event: { send: menu name: commands_with_description }
     }
 
-     
+
   ]
 
 }

From 5b0814a8d7caa470cb52f6422a718f5f9cc8f89d Mon Sep 17 00:00:00 2001
From: notohh <github@notohh.dev>
Date: Sat, 8 Feb 2025 17:46:19 -0500
Subject: [PATCH 4/5] import default.nix

---
 flake.nix           | 3 +--
 modules/default.nix | 6 ++++++
 2 files changed, 7 insertions(+), 2 deletions(-)
 create mode 100644 modules/default.nix

diff --git a/flake.nix b/flake.nix
index 3acebce..610ec75 100755
--- a/flake.nix
+++ b/flake.nix
@@ -6,10 +6,9 @@
       imports = [
         ./hosts
         ./overlays
+        ./modules
         ./hosts/deploy.nix
         ./home/profiles
-        ./modules/pre-commit.nix
-        ./modules/topology.nix
       ];
       systems = ["x86_64-linux"];
       perSystem = {
diff --git a/modules/default.nix b/modules/default.nix
new file mode 100644
index 0000000..c86e188
--- /dev/null
+++ b/modules/default.nix
@@ -0,0 +1,6 @@
+_: {
+  imports = [
+    ./pre-commit.nix
+    ./topology.nix
+  ];
+}

From a9e0d4d500ba4f41441b6dc66e567d070fe1920a Mon Sep 17 00:00:00 2001
From: notohh <github@notohh.dev>
Date: Sat, 8 Feb 2025 18:05:47 -0500
Subject: [PATCH 5/5] init basic topology structure

---
 hosts/ame/default.nix     |  1 +
 hosts/ame/topology.nix    | 20 +++++++++++
 hosts/arashi/default.nix  |  1 +
 hosts/arashi/topology.nix | 20 +++++++++++
 hosts/haru/default.nix    |  1 +
 hosts/haru/topology.nix   | 20 +++++++++++
 hosts/kariru/default.nix  |  1 +
 hosts/kariru/topology.nix | 20 +++++++++++
 hosts/kaze/default.nix    |  1 +
 hosts/kaze/topology.nix   | 20 +++++++++++
 hosts/sakura/default.nix  |  1 +
 hosts/sakura/topology.nix | 20 +++++++++++
 hosts/sora/default.nix    |  1 +
 hosts/sora/topology.nix   | 19 ++++++++++
 hosts/tsuki/gaming.nix    |  2 +-
 hosts/tsuki/topology.nix  | 20 +++++++++++
 hosts/tsuru/default.nix   |  1 +
 hosts/tsuru/topology.nix  | 20 +++++++++++
 hosts/yuki/default.nix    |  1 +
 hosts/yuki/topology.nix   | 20 +++++++++++
 modules/topology.nix      | 75 +++++++++++++++++++++++++++++++++++++--
 21 files changed, 281 insertions(+), 4 deletions(-)
 create mode 100644 hosts/ame/topology.nix
 create mode 100644 hosts/arashi/topology.nix
 create mode 100644 hosts/haru/topology.nix
 create mode 100644 hosts/kariru/topology.nix
 create mode 100644 hosts/kaze/topology.nix
 create mode 100644 hosts/sakura/topology.nix
 create mode 100644 hosts/sora/topology.nix
 create mode 100644 hosts/tsuki/topology.nix
 create mode 100644 hosts/tsuru/topology.nix
 create mode 100644 hosts/yuki/topology.nix

diff --git a/hosts/ame/default.nix b/hosts/ame/default.nix
index cb91f4e..260d225 100644
--- a/hosts/ame/default.nix
+++ b/hosts/ame/default.nix
@@ -3,6 +3,7 @@ _: {
     ./hardware.nix
     ./services
     ./networking.nix
+    ./topology.nix
     ../common
     ../common/fonts.nix
   ];
diff --git a/hosts/ame/topology.nix b/hosts/ame/topology.nix
new file mode 100644
index 0000000..4c1a206
--- /dev/null
+++ b/hosts/ame/topology.nix
@@ -0,0 +1,20 @@
+_: {
+  topology = {
+    self = {
+      name = "ame";
+      hardware.info = "Thinkpad T480";
+      interfaces = {
+        tailscale0 = {
+          addresses = ["100.108.207.106/32"];
+          network = "tailscale0";
+          type = "wireguard";
+        };
+        home = {
+          network = "home";
+          addresses = [""];
+          type = "wifi";
+        };
+      };
+    };
+  };
+}
diff --git a/hosts/arashi/default.nix b/hosts/arashi/default.nix
index 8b8526d..8afd6f4 100644
--- a/hosts/arashi/default.nix
+++ b/hosts/arashi/default.nix
@@ -3,6 +3,7 @@
     ./hardware.nix
     ./services
     ./networking.nix
+    ./topology.nix
     ../common
   ];
 
diff --git a/hosts/arashi/topology.nix b/hosts/arashi/topology.nix
new file mode 100644
index 0000000..f8bf0fa
--- /dev/null
+++ b/hosts/arashi/topology.nix
@@ -0,0 +1,20 @@
+_: {
+  topology = {
+    self = {
+      name = "arashi";
+      hardware.info = "Proxmox VM";
+      interfaces = {
+        tailscale0 = {
+          addresses = ["100.94.214.100/32"];
+          network = "tailscale0";
+          type = "wireguard";
+        };
+        home = {
+          addresses = ["192.168.1.211/24"];
+          network = "home";
+          type = "ethernet";
+        };
+      };
+    };
+  };
+}
diff --git a/hosts/haru/default.nix b/hosts/haru/default.nix
index 27e514e..e278a60 100644
--- a/hosts/haru/default.nix
+++ b/hosts/haru/default.nix
@@ -3,6 +3,7 @@
     ./hardware.nix
     ./services
     ./networking.nix
+    ./topology.nix
     ../common
   ];
 
diff --git a/hosts/haru/topology.nix b/hosts/haru/topology.nix
new file mode 100644
index 0000000..b50cd91
--- /dev/null
+++ b/hosts/haru/topology.nix
@@ -0,0 +1,20 @@
+_: {
+  topology = {
+    self = {
+      name = "haru";
+      hardware.info = "Proxmox VM";
+      interfaces = {
+        tailscale0 = {
+          addresses = ["100.73.192.45/32"];
+          network = "tailscale0";
+          type = "wireguard";
+        };
+        home = {
+          addresses = ["192.168.1.103/24"];
+          network = "home";
+          type = "ethernet";
+        };
+      };
+    };
+  };
+}
diff --git a/hosts/kariru/default.nix b/hosts/kariru/default.nix
index 0069e3a..0ee01a2 100644
--- a/hosts/kariru/default.nix
+++ b/hosts/kariru/default.nix
@@ -3,6 +3,7 @@
     ./hardware.nix
     ./services
     ./networking.nix
+    ./topology.nix
     ../common
   ];
 
diff --git a/hosts/kariru/topology.nix b/hosts/kariru/topology.nix
new file mode 100644
index 0000000..a2777f1
--- /dev/null
+++ b/hosts/kariru/topology.nix
@@ -0,0 +1,20 @@
+_: {
+  topology = {
+    self = {
+      name = "kariru";
+      hardware.info = "Proxmox VM";
+      interfaces = {
+        tailscale0 = {
+          addresses = ["100.126.229.95/32"];
+          network = "tailscale0";
+          type = "wireguard";
+        };
+        home = {
+          addresses = ["192.168.1.54/24"];
+          network = "home";
+          type = "ethernet";
+        };
+      };
+    };
+  };
+}
diff --git a/hosts/kaze/default.nix b/hosts/kaze/default.nix
index 161e8c4..4fc9ba5 100644
--- a/hosts/kaze/default.nix
+++ b/hosts/kaze/default.nix
@@ -3,6 +3,7 @@
     ./hardware.nix
     ./services
     ./networking.nix
+    ./topology.nix
     ../common
   ];
 
diff --git a/hosts/kaze/topology.nix b/hosts/kaze/topology.nix
new file mode 100644
index 0000000..0076a59
--- /dev/null
+++ b/hosts/kaze/topology.nix
@@ -0,0 +1,20 @@
+_: {
+  topology = {
+    self = {
+      name = "kaze";
+      hardware.info = "BuyVM VPS";
+      interfaces = {
+        tailscale0 = {
+          addresses = ["100.69.79.81/32"];
+          network = "tailscale0";
+          type = "wireguard";
+        };
+        eth0 = {
+          network = "hetzner";
+          addresses = ["198.98.48.71 "];
+          type = "ethernet";
+        };
+      };
+    };
+  };
+}
diff --git a/hosts/sakura/default.nix b/hosts/sakura/default.nix
index 73384fb..80b5d03 100644
--- a/hosts/sakura/default.nix
+++ b/hosts/sakura/default.nix
@@ -3,6 +3,7 @@ _: {
     ./hardware.nix
     ./services
     ./networking.nix
+    ./topology.nix
     ../common
   ];
 
diff --git a/hosts/sakura/topology.nix b/hosts/sakura/topology.nix
new file mode 100644
index 0000000..417b2ee
--- /dev/null
+++ b/hosts/sakura/topology.nix
@@ -0,0 +1,20 @@
+_: {
+  topology = {
+    self = {
+      name = "sakura";
+      hardware.info = "Proxmox VM";
+      interfaces = {
+        tailscale0 = {
+          addresses = ["100.121.201.47/32"];
+          network = "tailscale0";
+          type = "wireguard";
+        };
+        home = {
+          addresses = ["192.168.1.25/24"];
+          network = "home";
+          type = "ethernet";
+        };
+      };
+    };
+  };
+}
diff --git a/hosts/sora/default.nix b/hosts/sora/default.nix
index c352a42..6d7d729 100644
--- a/hosts/sora/default.nix
+++ b/hosts/sora/default.nix
@@ -3,6 +3,7 @@ _: {
     ./hardware.nix
     ./networking.nix
     ./services
+    ./topology.nix
     ../common
   ];
 
diff --git a/hosts/sora/topology.nix b/hosts/sora/topology.nix
new file mode 100644
index 0000000..908ba10
--- /dev/null
+++ b/hosts/sora/topology.nix
@@ -0,0 +1,19 @@
+_: {
+  topology = {
+    self = {
+      name = "sora";
+      hardware.info = "Hetzner VPS";
+      interfaces = {
+        tailscale0 = {
+          addresses = ["100.104.42.96/32"];
+          network = "tailscale0";
+          type = "wireguard";
+        };
+        eth0 = {
+          network = "hetzner";
+          type = "ethernet";
+        };
+      };
+    };
+  };
+}
diff --git a/hosts/tsuki/gaming.nix b/hosts/tsuki/gaming.nix
index f5e2c07..27fbede 100644
--- a/hosts/tsuki/gaming.nix
+++ b/hosts/tsuki/gaming.nix
@@ -22,7 +22,7 @@
       };
     };
     monado = {
-      enable = true;
+      enable = false;
       highPriority = true;
     };
     sunshine = {
diff --git a/hosts/tsuki/topology.nix b/hosts/tsuki/topology.nix
new file mode 100644
index 0000000..4b31cc4
--- /dev/null
+++ b/hosts/tsuki/topology.nix
@@ -0,0 +1,20 @@
+_: {
+  topology = {
+    self = {
+      name = "tsuki";
+      hardware.info = "Desktop";
+      interfaces = {
+        tailscale0 = {
+          addresses = ["100.127.30.116/32"];
+          network = "tailscale0";
+          type = "wireguard";
+        };
+        home = {
+          addresses = ["192.168.1.47/24"];
+          network = "home";
+          type = "ethernet";
+        };
+      };
+    };
+  };
+}
diff --git a/hosts/tsuru/default.nix b/hosts/tsuru/default.nix
index 1b85e28..7cde069 100644
--- a/hosts/tsuru/default.nix
+++ b/hosts/tsuru/default.nix
@@ -3,6 +3,7 @@
     ./hardware.nix
     ./services
     ./networking.nix
+    ./topology.nix
     ../common
   ];
 
diff --git a/hosts/tsuru/topology.nix b/hosts/tsuru/topology.nix
new file mode 100644
index 0000000..46ff03b
--- /dev/null
+++ b/hosts/tsuru/topology.nix
@@ -0,0 +1,20 @@
+_: {
+  topology = {
+    self = {
+      name = "tsuru";
+      hardware.info = "Proxmox VM";
+      interfaces = {
+        tailscale0 = {
+          addresses = ["100.82.146.40/32"];
+          network = "tailscale0";
+          type = "wireguard";
+        };
+        home = {
+          addresses = ["192.168.1.99/24"];
+          network = "home";
+          type = "ethernet";
+        };
+      };
+    };
+  };
+}
diff --git a/hosts/yuki/default.nix b/hosts/yuki/default.nix
index c8d505d..529e6eb 100644
--- a/hosts/yuki/default.nix
+++ b/hosts/yuki/default.nix
@@ -3,6 +3,7 @@
     ./hardware.nix
     ./services
     ./networking.nix
+    ./topology.nix
     ../common
   ];
 
diff --git a/hosts/yuki/topology.nix b/hosts/yuki/topology.nix
new file mode 100644
index 0000000..28454e2
--- /dev/null
+++ b/hosts/yuki/topology.nix
@@ -0,0 +1,20 @@
+_: {
+  topology = {
+    self = {
+      name = "yuki";
+      hardware.info = "Proxmox VM";
+      interfaces = {
+        tailscale0 = {
+          addresses = ["100.108.113.89/32"];
+          network = "tailscale0";
+          type = "wireguard";
+        };
+        home = {
+          addresses = ["192.168.1.98/24"];
+          network = "home";
+          type = "ethernet";
+        };
+      };
+    };
+  };
+}
diff --git a/modules/topology.nix b/modules/topology.nix
index f19204c..b466f18 100644
--- a/modules/topology.nix
+++ b/modules/topology.nix
@@ -8,9 +8,78 @@
   ];
   perSystem = _: {
     topology.modules = [
-      {
-        inherit (self) nixosConfigurations;
-      }
+      {inherit (self) nixosConfigurations;}
+      ({config, ...}: let
+        inherit
+          (config.lib.topology)
+          mkConnection
+          mkInternet
+          mkRouter
+          ;
+      in {
+        networks = {
+          home = {
+            name = "home";
+            cidrv4 = "192.168.0.0/24";
+          };
+          tailscale0 = {
+            name = "tailscale";
+            cidrv4 = "100.0.0.0/32";
+          };
+          hetzner = {
+            name = "hetzner";
+            cidrv4 = "5.161.102.107/24";
+          };
+        };
+
+        nodes = {
+          internet = mkInternet {
+            connections = [
+              (mkConnection "hetzner" "wan0")
+              (mkConnection "router" "lan0")
+            ];
+          };
+          router = mkRouter "UDM-SE" {
+            info = "UDM-SE";
+            interfaceGroups = [
+              [
+                "eth0"
+                "eth1"
+                "eth2"
+                "eth4"
+                "eth5"
+                "eth6"
+                "eth7"
+              ]
+              ["lan0"]
+            ];
+            connections = {
+              eth0 = mkConnection "ame" "home";
+              eth1 = mkConnection "arashi" "home";
+              eth2 = mkConnection "haru" "home";
+              eth3 = mkConnection "kariru" "home";
+              eth4 = mkConnection "sakura" "home";
+              eth5 = mkConnection "tsuki" "home";
+              eth6 = mkConnection "tsuru" "home";
+              eth7 = mkConnection "yuki" "home";
+            };
+          };
+          hetzner = mkRouter "Hetzner" {
+            info = "hetzner edge router";
+            interfaceGroups = [
+              [
+                "eth0"
+                "eth1"
+              ]
+              ["wan0"]
+            ];
+            connections = {
+              eth0 = mkConnection "sora" "eth0";
+              eth1 = mkConnection "kaze" "eth0";
+            };
+          };
+        };
+      })
     ];
   };
 }