From eaf1b9f486188ae9133ecd47d67ec05305e74e53 Mon Sep 17 00:00:00 2001
From: tdback <tyler@tdback.net>
Date: Thu, 13 Mar 2025 20:22:59 -0400
Subject: flake: simplify module imports in systems

---
 flake.nix           | 248 +++++++++++++++-------------------------------------
 modules/default.nix |   5 +-
 2 files changed, 71 insertions(+), 182 deletions(-)

diff --git a/flake.nix b/flake.nix
index 4855502..fd067a1 100644
--- a/flake.nix
+++ b/flake.nix
@@ -18,194 +18,86 @@
     in
     mergeSets [
       (mkSystem "frigg" "x86_64-linux" inputs.nixpkgs [
-        {
-          type = "customs";
-          modules = [ "cgit" ];
-        }
-        {
-          type = "profiles";
-          modules = [
-            "common"
-            "upgrade"
-            "wireguard"
-            "zfs"
-          ];
-        }
-        {
-          type = "scripts";
-          modules = [
-            "motd"
-            "pushover"
-            "zquota"
-          ];
-        }
-        {
-          type = "services";
-          modules = [
-            "llm"
-            "sftpgo"
-            "ssh"
-          ];
-        }
+        "customs/cgit"
+        "profiles/common"
+        "profiles/upgrade"
+        "profiles/wireguard"
+        "profiles/zfs"
+        "scripts/motd"
+        "scripts/pushover"
+        "scripts/zquota"
+        "services/llm"
+        "services/sftpgo"
+        "services/ssh"
       ])
       (mkSystem "heimdall" "x86_64-linux" inputs.nixpkgs [
-        {
-          type = "profiles";
-          modules = [
-            "common"
-            "upgrade"
-          ];
-        }
-        {
-          type = "scripts";
-          modules = [
-            "motd"
-            "pushover"
-          ];
-        }
-        {
-          type = "services";
-          modules = [
-            "dns"
-            "searx"
-            "ssh"
-          ];
-        }
+        "profiles/common"
+        "profiles/upgrade"
+        "scripts/motd"
+        "scripts/pushover"
+        "services/dns"
+        "services/searx"
+        "services/ssh"
       ])
       (mkSystem "loki" "aarch64-linux" inputs.nixpkgs [
-        {
-          type = "profiles";
-          modules = [
-            "common"
-            "upgrade"
-          ];
-        }
-        {
-          type = "scripts";
-          modules = [
-            "motd"
-            "pushover"
-          ];
-        }
-        {
-          type = "services";
-          modules = [
-            "matrix"
-            "ssh"
-          ];
-        }
+        "profiles/common"
+        "profiles/upgrade"
+        "scripts/motd"
+        "scripts/pushover"
+        "services/matrix"
+        "services/ssh"
       ])
       (mkSystem "odin" "x86_64-linux" inputs.nixpkgs [
-        {
-          type = "containers";
-          modules = [
-            "freshrss"
-            "jellyfin"
-            "lubelogger"
-            "pinchflat"
-            "vaultwarden"
-            "watchtower"
-          ];
-        }
-        {
-          type = "profiles";
-          modules = [
-            "common"
-            "podman"
-            "upgrade"
-            "wireguard"
-            "zfs"
-          ];
-        }
-        {
-          type = "scripts";
-          modules = [
-            "motd"
-            "pushover"
-            "zquota"
-          ];
-        }
-        {
-          type = "services";
-          modules = [
-            "immich"
-            "ssh"
-          ];
-        }
+        "containers/freshrss"
+        "containers/jellyfin"
+        "containers/lubelogger"
+        "containers/pinchflat"
+        "containers/vaultwarden"
+        "containers/watchtower"
+        "profiles/common"
+        "profiles/podman"
+        "profiles/upgrade"
+        "profiles/wireguard"
+        "profiles/zfs"
+        "scripts/motd"
+        "scripts/pushover"
+        "scripts/zquota"
+        "services/immich"
+        "services/ssh"
       ])
       (mkSystem "sol" "x86_64-linux" inputs.nixpkgs [
-        {
-          type = "profiles";
-          modules = [
-            "common"
-            "upgrade"
-          ];
-        }
-        {
-          type = "scripts";
-          modules = [
-            "motd"
-            "pushover"
-          ];
-        }
-        {
-          type = "services";
-          modules = [
-            "ssh"
-            "xonotic"
-          ];
-        }
+        "profiles/common"
+        "profiles/upgrade"
+        "scripts/motd"
+        "scripts/pushover"
+        "services/ssh"
+        "services/xonotic"
+      ])
+      (mkSystem "sparrow" "x86_64-linux" inputs.nixpkgs [
+        "profiles/common"
+        "profiles/vpn"
+        "profiles/xorg"
+        "profiles/zsa"
       ])
-      (mkSystem "sparrow" "x86_64-linux" inputs.nixpkgs (
-        inputs.nixpkgs.lib.singleton {
-          type = "profiles";
-          modules = [
-            "common"
-            "vpn"
-            "xorg"
-            "zsa"
-          ];
-        }
-      ))
       (mkSystem "thor" "x86_64-linux" inputs.nixpkgs [
-        {
-          type = "profiles";
-          modules = [
-            "common"
-            "upgrade"
-            "wireguard"
-          ];
-        }
-        {
-          type = "scripts";
-          modules = [
-            "motd"
-            "pushover"
-          ];
-        }
-        {
-          type = "services";
-          modules = [
-            "fediverse"
-            "ssh"
-            "website"
-          ];
-        }
+        "profiles/common"
+        "profiles/upgrade"
+        "profiles/wireguard"
+        "scripts/motd"
+        "scripts/pushover"
+        "services/fediverse"
+        "services/ssh"
+        "services/website"
+      ])
+      (mkSystem "woodpecker" "x86_64-linux" inputs.nixpkgs [
+        "profiles/common"
+        "profiles/fstrim"
+        "profiles/libvirtd"
+        "profiles/nvidia"
+        "profiles/steam"
+        "profiles/wireshark"
+        "profiles/xorg"
+        "profiles/zsa"
       ])
-      (mkSystem "woodpecker" "x86_64-linux" inputs.nixpkgs (
-        inputs.nixpkgs.lib.singleton {
-          type = "profiles";
-          modules = [
-            "common"
-            "fstrim"
-            "libvirtd"
-            "nvidia"
-            "steam"
-            "wireshark"
-            "xorg"
-            "zsa"
-          ];
-        }
-      ))
     ];
 }
diff --git a/modules/default.nix b/modules/default.nix
index 91ab291..6bf0abf 100644
--- a/modules/default.nix
+++ b/modules/default.nix
@@ -1,9 +1,6 @@
 { inputs }:
 let
-  genModules =
-    { type, modules }: builtins.map (module: "${inputs.self}/modules/${type}/${module}") modules;
-
-  mkModules = moduleAttrList: builtins.concatMap (moduleAttr: genModules moduleAttr) moduleAttrList;
+  mkModules = modules: builtins.map (module: "${inputs.self}/modules/${module}") modules;
 in
 {
   mkSystem = hostname: system: nixpkgsVersion: modules: rec {
-- 
cgit v1.2.3