OOKNET                             [ /  search the index  ]  
──────────────────────────────────────────────────────────────────────────────────────
══════════════════════════════════════════════════════════════════════════════════════
OOKNET   [ /  search  ]  
────────────────────────────────────────────────
════════════════════════════════════════════════
 
HASH      a6c9a80ae6a9
DATE      2025-10-27
SUBJECT   flake: use ooknet builder module for nixosConfigurations
FILES     9 CHANGED
HASH      a6c9a80ae6a9
DATE      2025-10-27
SUBJECT   flake: use ooknet builder module for
          nixosConfigurations
FILES     9 CHANGED
 

diff --git a/outputs/builder/default.nix b/outputs/builder/default.nix
new file mode 100644
index 0000000..8220fba
--- /dev/null
+++ b/outputs/builder/default.nix
@@ -0,0 +1,9 @@
+{
+  imports = [
+    ./modules.nix
+    ./options.nix
+    ./workstation.nix
+    ./server.nix
+    ./image.nix
+  ];
+}

diff --git a/outputs/builder/default.nix b/o
utputs/builder/default.nix
new file mode 100644
index 0000000..8220fba
--- /dev/null
+++ b/outputs/builder/default.nix
@@ -0,0 +1,9 @@
+{
+  imports = [
+    ./modules.nix
+    ./options.nix
+    ./workstation.nix
+    ./server.nix
+    ./image.nix
+  ];
+}
 

diff --git a/outputs/builder/image.nix b/outputs/builder/image.nix
new file mode 100644
index 0000000..10dd73e
--- /dev/null
+++ b/outputs/builder/image.nix
@@ -0,0 +1,54 @@
+{
+  config,
+  lib,
+  withSystem,
+  inputs,
+  self,
+  ooknetModules,
+  ...
+}: let
+  inherit (lib) mapAttrs mkDefault singleton optionals;
+  inherit (builtins) concatLists;
+  inherit (self) hozen ook;
+  inherit (ooknetModules) nixosMinimal isoModules nixos hostModules;
+
+  buildImage = hostname: cfg:
+    withSystem cfg.system ({
+      inputs',
+      self',
+      ...
+    }:
+      inputs.nixpkgs.lib.nixosSystem {
+        specialArgs =
+          {
+            inherit hozen ook inputs self inputs' self';
+          }
+          // cfg.additionalArgs;
+
+        modules = concatLists [
+          (singleton {
+            networking.hostName = hostname;
+            nixpkgs = {
+              flake.source = inputs.nixpkgs.outPath;
+              hostPlatform = mkDefault cfg.system;
+            };
+            ooknet.host = {
+              name = hostname;
+              role = cfg.role;
+              type = cfg.type;
+            };
+          })
+          nixosMinimal
+          (optionals (cfg.type == "iso") isoModules)
+          (optionals (cfg.role == "installer") [(nixos.image + "/installer.nix")]
)
+          (
+            if cfg.profile != null
+            then [(hostModules + "/${cfg.profile}")]
+            else [(hostModules + "/${hostname}")]
+          )
+          cfg.additionalModules
+        ];
+      });
+in {
+  config.flake.nixosConfigurations = mapAttrs buildImage config.flake.ooknet.imag
es;
+}

diff --git a/outputs/builder/image.nix b/out
puts/builder/image.nix
new file mode 100644
index 0000000..10dd73e
--- /dev/null
+++ b/outputs/builder/image.nix
@@ -0,0 +1,54 @@
+{
+  config,
+  lib,
+  withSystem,
+  inputs,
+  self,
+  ooknetModules,
+  ...
+}: let
+  inherit (lib) mapAttrs mkDefault singleto
n optionals;
+  inherit (builtins) concatLists;
+  inherit (self) hozen ook;
+  inherit (ooknetModules) nixosMinimal isoM
odules nixos hostModules;
+
+  buildImage = hostname: cfg:
+    withSystem cfg.system ({
+      inputs',
+      self',
+      ...
+    }:
+      inputs.nixpkgs.lib.nixosSystem {
+        specialArgs =
+          {
+            inherit hozen ook inputs self i
nputs' self';
+          }
+          // cfg.additionalArgs;
+
+        modules = concatLists [
+          (singleton {
+            networking.hostName = hostname;
+            nixpkgs = {
+              flake.source = inputs.nixpkgs
.outPath;
+              hostPlatform = mkDefault cfg.
system;
+            };
+            ooknet.host = {
+              name = hostname;
+              role = cfg.role;
+              type = cfg.type;
+            };
+          })
+          nixosMinimal
+          (optionals (cfg.type == "iso") is
oModules)
+          (optionals (cfg.role == "installe
r") [(nixos.image + "/installer.nix")])
+          (
+            if cfg.profile != null
+            then [(hostModules + "/${cfg.pr
ofile}")]
+            else [(hostModules + "/${hostna
me}")]
+          )
+          cfg.additionalModules
+        ];
+      });
+in {
+  config.flake.nixosConfigurations = mapAtt
rs buildImage config.flake.ooknet.images;
+}
 

diff --git a/outputs/builder/options.nix b/outputs/builder/options.nix
index eda73be..bcb51ac 100644
--- a/outputs/builder/options.nix
+++ b/outputs/builder/options.nix
@@ -74,12 +74,18 @@ in {
         profile = mkOption {
           type = nullOr str;
           default = null;
+          description = "Profile to use instead of hostname-based config";
         };
         type = mkOption {
-          type = enum ["iso" "installer"];
-          description = "Type of image (e.g., installer, iso)";
+          type = enum ["iso"];
+          description = "Image format type";
           example = "iso";
         };
+        role = mkOption {
+          type = enum ["installer" "live"];
+          description = "Role of the image (installer or live)";
+          example = "installer";
+        };
       };
     };
   };

diff --git a/outputs/builder/options.nix b/o
utputs/builder/options.nix
index eda73be..bcb51ac 100644
--- a/outputs/builder/options.nix
+++ b/outputs/builder/options.nix
@@ -74,12 +74,18 @@ in {
         profile = mkOption {
           type = nullOr str;
           default = null;
+          description = "Profile to use ins
tead of hostname-based config";
         };
         type = mkOption {
-          type = enum ["iso" "installer"];
-          description = "Type of image (e.g
., installer, iso)";
+          type = enum ["iso"];
+          description = "Image format type"
;
           example = "iso";
         };
+        role = mkOption {
+          type = enum ["installer" "live"];
+          description = "Role of the image 
(installer or live)";
+          example = "installer";
+        };
       };
     };
   };
 

diff --git a/outputs/builder/server.nix b/outputs/builder/server.nix
new file mode 100644
index 0000000..358a516
--- /dev/null
+++ b/outputs/builder/server.nix
@@ -0,0 +1,58 @@
+{
+  config,
+  lib,
+  withSystem,
+  inputs,
+  self,
+  ooknetModules,
+  ...
+}: let
+  inherit (lib) mapAttrs mkDefault singleton assertMsg;
+  inherit (builtins) concatLists;
+  inherit (self) hozen ook;
+  inherit (ooknetModules) nixosCore nixos hostModules;
+
+  buildServer = hostname: cfg:
+    assert assertMsg (!(cfg.type == "vm" && cfg.profile == null))
+    "Profile must be specified for VM servers (${hostname})";
+      withSystem cfg.system ({
+        inputs',
+        self',
+        ...
+      }:
+        inputs.nixpkgs.lib.nixosSystem {
+          specialArgs =
+            {
+              inherit hozen ook inputs self inputs' self';
+            }
+            // cfg.additionalArgs;
+
+          modules = concatLists [
+            (singleton {
+              networking.hostName = hostname;
+              nixpkgs = {
+                flake.source = inputs.nixpkgs.outPath;
+                hostPlatform = mkDefault cfg.system;
+              };
+              ooknet.host = {
+                name = hostname;
+                role = "server";
+                type = cfg.type;
+              };
+              ooknet.server = {
+                inherit (cfg) domain services;
+              };
+            })
+            nixosCore
+            [nixos.server]
+            (
+              if cfg.type == "vm"
+              then [(hostModules + "/${cfg.profile}")]
+              else [(hostModules + "/${hostname}")]
+            )
+            cfg.additionalModules
+          ];
+        });
+in {
+  config.flake.nixosConfigurations = mapAttrs buildServer config.flake.ooknet.ser
vers;
+}

diff --git a/outputs/builder/server.nix b/ou
tputs/builder/server.nix
new file mode 100644
index 0000000..358a516
--- /dev/null
+++ b/outputs/builder/server.nix
@@ -0,0 +1,58 @@
+{
+  config,
+  lib,
+  withSystem,
+  inputs,
+  self,
+  ooknetModules,
+  ...
+}: let
+  inherit (lib) mapAttrs mkDefault singleto
n assertMsg;
+  inherit (builtins) concatLists;
+  inherit (self) hozen ook;
+  inherit (ooknetModules) nixosCore nixos h
ostModules;
+
+  buildServer = hostname: cfg:
+    assert assertMsg (!(cfg.type == "vm" &&
 cfg.profile == null))
+    "Profile must be specified for VM serve
rs (${hostname})";
+      withSystem cfg.system ({
+        inputs',
+        self',
+        ...
+      }:
+        inputs.nixpkgs.lib.nixosSystem {
+          specialArgs =
+            {
+              inherit hozen ook inputs self
 inputs' self';
+            }
+            // cfg.additionalArgs;
+
+          modules = concatLists [
+            (singleton {
+              networking.hostName = hostnam
e;
+              nixpkgs = {
+                flake.source = inputs.nixpk
gs.outPath;
+                hostPlatform = mkDefault cf
g.system;
+              };
+              ooknet.host = {
+                name = hostname;
+                role = "server";
+                type = cfg.type;
+              };
+              ooknet.server = {
+                inherit (cfg) domain servic
es;
+              };
+            })
+            nixosCore
+            [nixos.server]
+            (
+              if cfg.type == "vm"
+              then [(hostModules + "/${cfg.
profile}")]
+              else [(hostModules + "/${host
name}")]
+            )
+            cfg.additionalModules
+          ];
+        });
+in {
+  config.flake.nixosConfigurations = mapAtt
rs buildServer config.flake.ooknet.servers;
+}
 

diff --git a/outputs/builder/workstation.nix b/outputs/builder/workstation.nix
index 40a3318..725fa6b 100644
--- a/outputs/builder/workstation.nix
+++ b/outputs/builder/workstation.nix
@@ -7,8 +7,8 @@
   ooknetModules,
   ...
 }: let
-  inherit (lib) mapAttrs mkDefault filterAttrs;
-  inherit (builtins) concatLists singleton;
+  inherit (lib) mapAttrs mkDefault filterAttrs singleton;
+  inherit (builtins) concatLists;
   inherit (self) hozen ook;
   inherit (ooknetModules) nixosCore darwinCore common nixos hostModules;
 

diff --git a/outputs/builder/workstation.nix
 b/outputs/builder/workstation.nix
index 40a3318..725fa6b 100644
--- a/outputs/builder/workstation.nix
+++ b/outputs/builder/workstation.nix
@@ -7,8 +7,8 @@
   ooknetModules,
   ...
 }: let
-  inherit (lib) mapAttrs mkDefault filterAt
trs;
-  inherit (builtins) concatLists singleton;
+  inherit (lib) mapAttrs mkDefault filterAt
trs singleton;
+  inherit (builtins) concatLists;
   inherit (self) hozen ook;
   inherit (ooknetModules) nixosCore darwinC
ore common nixos hostModules;
 
 

diff --git a/outputs/default.nix b/outputs/default.nix
index 70ea828..d37a498 100644
--- a/outputs/default.nix
+++ b/outputs/default.nix
@@ -2,6 +2,7 @@
   imports = [
     ./apps.nix
     ./lib
+    ./builder
     ./hozen
     ./hosts
     ./pkgs

diff --git a/outputs/default.nix b/outputs/d
efault.nix
index 70ea828..d37a498 100644
--- a/outputs/default.nix
+++ b/outputs/default.nix
@@ -2,6 +2,7 @@
   imports = [
     ./apps.nix
     ./lib
+    ./builder
     ./hozen
     ./hosts
     ./pkgs
 

diff --git a/outputs/hosts/installer.nix b/outputs/hosts/installer.nix
index 663264b..e3395bf 100644
--- a/outputs/hosts/installer.nix
+++ b/outputs/hosts/installer.nix
@@ -1,15 +1,7 @@
-{
-  withSystem,
-  ook,
-  ...
-}: let
-  inherit (ook.lib.builders) mkImage;
-in {
-  flake.nixosConfigurations = {
-    ooksinstall = mkImage {
-      inherit withSystem;
+{...}: {
+  flake.ooknet.images = {
+    ooksinstall = {
       system = "x86_64-linux";
-      hostname = "ooksinstall";
       type = "iso";
       role = "installer";
     };

diff --git a/outputs/hosts/installer.nix b/o
utputs/hosts/installer.nix
index 663264b..e3395bf 100644
--- a/outputs/hosts/installer.nix
+++ b/outputs/hosts/installer.nix
@@ -1,15 +1,7 @@
-{
-  withSystem,
-  ook,
-  ...
-}: let
-  inherit (ook.lib.builders) mkImage;
-in {
-  flake.nixosConfigurations = {
-    ooksinstall = mkImage {
-      inherit withSystem;
+{...}: {
+  flake.ooknet.images = {
+    ooksinstall = {
       system = "x86_64-linux";
-      hostname = "ooksinstall";
       type = "iso";
       role = "installer";
     };
 

diff --git a/outputs/hosts/servers.nix b/outputs/hosts/servers.nix
index 7636e0e..3bdf88f 100644
--- a/outputs/hosts/servers.nix
+++ b/outputs/hosts/servers.nix
@@ -1,36 +1,24 @@
-{
-  withSystem,
-  ook,
-  ...
-}: let
-  inherit (ook.lib.builders) mkServer;
-in {
-  flake.nixosConfigurations = {
-    ooknode = mkServer {
-      inherit withSystem;
+{...}: {
+  flake.ooknet.servers = {
+    ooknode = {
       system = "x86_64-linux";
-      hostname = "ooknode";
-      domain = "ooknet.org";
       type = "vm";
       profile = "linode";
+      domain = "ooknet.org";
       services = ["website" "forgejo"];
     };
-    ooksmedia = mkServer {
-      inherit withSystem;
+    ooksmedia = {
       system = "x86_64-linux";
-      hostname = "ooksmedia";
-      domain = "ooknet.org";
       type = "desktop";
+      domain = "ooknet.org";
       services = ["ookflix" "monitoring" "authentik"];
     };
-    ookstest = mkServer {
-      inherit withSystem;
+    ookstest = {
       system = "x86_64-linux";
-      hostname = "ookstest";
-      domain = "ooknet.org";
       type = "vm";
-      services = [];
       profile = "ookstest";
+      domain = "ooknet.org";
+      services = [];
     };
   };
 }

diff --git a/outputs/hosts/servers.nix b/out
puts/hosts/servers.nix
index 7636e0e..3bdf88f 100644
--- a/outputs/hosts/servers.nix
+++ b/outputs/hosts/servers.nix
@@ -1,36 +1,24 @@
-{
-  withSystem,
-  ook,
-  ...
-}: let
-  inherit (ook.lib.builders) mkServer;
-in {
-  flake.nixosConfigurations = {
-    ooknode = mkServer {
-      inherit withSystem;
+{...}: {
+  flake.ooknet.servers = {
+    ooknode = {
       system = "x86_64-linux";
-      hostname = "ooknode";
-      domain = "ooknet.org";
       type = "vm";
       profile = "linode";
+      domain = "ooknet.org";
       services = ["website" "forgejo"];
     };
-    ooksmedia = mkServer {
-      inherit withSystem;
+    ooksmedia = {
       system = "x86_64-linux";
-      hostname = "ooksmedia";
-      domain = "ooknet.org";
       type = "desktop";
+      domain = "ooknet.org";
       services = ["ookflix" "monitoring" "a
uthentik"];
     };
-    ookstest = mkServer {
-      inherit withSystem;
+    ookstest = {
       system = "x86_64-linux";
-      hostname = "ookstest";
-      domain = "ooknet.org";
       type = "vm";
-      services = [];
       profile = "ookstest";
+      domain = "ooknet.org";
+      services = [];
     };
   };
 }
 

diff --git a/outputs/hosts/workstations.nix b/outputs/hosts/workstations.nix
index fb87597..f037141 100644
--- a/outputs/hosts/workstations.nix
+++ b/outputs/hosts/workstations.nix
@@ -1,44 +1,24 @@
 {
-  withSystem,
-  ook,
-  ...
-}: let
-  inherit (ook.lib.builders) mkWorkstation;
-in {
-  flake = {
-    nixosConfigurations = {
-      ookst480s = mkWorkstation {
-        inherit withSystem;
-        system = "x86_64-linux";
-        hostname = "ookst480s";
-        type = "laptop";
-      };
-      ooksmicro = mkWorkstation {
-        inherit withSystem;
-        system = "x86_64-linux";
-        hostname = "ooksmicro";
-        type = "laptop";
-      };
-      ooksx1 = mkWorkstation {
-        inherit withSystem;
-        system = "x86_64-linux";
-        hostname = "ooksx1";
-        type = "laptop";
-      };
-      ooksdesk = mkWorkstation {
-        inherit withSystem;
-        system = "x86_64-linux";
-        hostname = "ooksdesk";
-        type = "desktop";
-      };
+  flake.ooknet.workstations = {
+    ookst480s = {
+      system = "x86_64-linux";
+      type = "laptop";
     };
-    darwinConfigurations = {
-      ooksair = mkWorkstation {
-        inherit withSystem;
-        system = "aarch64-darwin";
-        hostname = "ooksair";
-        type = "laptop";
-      };
+    ooksmicro = {
+      system = "x86_64-linux";
+      type = "laptop";
+    };
+    ooksx1 = {
+      system = "x86_64-linux";
+      type = "laptop";
+    };
+    ooksdesk = {
+      system = "x86_64-linux";
+      type = "desktop";
+    };
+    ooksair = {
+      system = "aarch64-darwin";
+      type = "laptop";
     };
   };
 }

diff --git a/outputs/hosts/workstations.nix 
b/outputs/hosts/workstations.nix
index fb87597..f037141 100644
--- a/outputs/hosts/workstations.nix
+++ b/outputs/hosts/workstations.nix
@@ -1,44 +1,24 @@
 {
-  withSystem,
-  ook,
-  ...
-}: let
-  inherit (ook.lib.builders) mkWorkstation;
-in {
-  flake = {
-    nixosConfigurations = {
-      ookst480s = mkWorkstation {
-        inherit withSystem;
-        system = "x86_64-linux";
-        hostname = "ookst480s";
-        type = "laptop";
-      };
-      ooksmicro = mkWorkstation {
-        inherit withSystem;
-        system = "x86_64-linux";
-        hostname = "ooksmicro";
-        type = "laptop";
-      };
-      ooksx1 = mkWorkstation {
-        inherit withSystem;
-        system = "x86_64-linux";
-        hostname = "ooksx1";
-        type = "laptop";
-      };
-      ooksdesk = mkWorkstation {
-        inherit withSystem;
-        system = "x86_64-linux";
-        hostname = "ooksdesk";
-        type = "desktop";
-      };
+  flake.ooknet.workstations = {
+    ookst480s = {
+      system = "x86_64-linux";
+      type = "laptop";
     };
-    darwinConfigurations = {
-      ooksair = mkWorkstation {
-        inherit withSystem;
-        system = "aarch64-darwin";
-        hostname = "ooksair";
-        type = "laptop";
-      };
+    ooksmicro = {
+      system = "x86_64-linux";
+      type = "laptop";
+    };
+    ooksx1 = {
+      system = "x86_64-linux";
+      type = "laptop";
+    };
+    ooksdesk = {
+      system = "x86_64-linux";
+      type = "desktop";
+    };
+    ooksair = {
+      system = "aarch64-darwin";
+      type = "laptop";
     };
   };
 }
 
[ BACK TO LOG ]
──────────────────────────────────────────────────────────────────────────────────────
OOKNET
────────────────────────────────────────────────
OOKNET