HASH c3431da1a6f2
DATE 2025-10-27
SUBJECT flake: ooknet builder flake-parts module init
FILES 3 CHANGED
HASH c3431da1a6f2
DATE 2025-10-27
SUBJECT flake: ooknet builder flake-parts
module init
FILES 3 CHANGED
┌─ outputs/builder/modules.nix ──────────────────────────────────────────────┐
│ diff --git a/outputs/builder/modules.nix b/outputs/builder/modules.nix │
│ new file mode 100644 │
│ index 0000000..6bd52a8 │
│ --- /dev/null │
│ +++ b/outputs/builder/modules.nix │
│ @@ -0,0 +1,93 @@ │
│ +{ │
│ + inputs, │
│ + self, │
│ + ... │
│ +}: let │
│ + inherit (inputs.secrets.nixosModules) nixosSecrets; │
│ + inherit (inputs.secrets.nixosModules) darwinSecrets; │
│ + inherit (inputs.disko.nixosModules) disko; │
│ + │
│ + nixosModules = "${self}/modules/nixos"; │
│ + commonModules = "${self}/modules/common"; │
│ + hostModules = "${self}/hosts"; │
│ + options = "${self}/modules/options"; │
│ + │
│ + nixos-hm = inputs.home-manager.nixosModules.home-manager; │
│ + darwin-hm = inputs.home-manager.darwinModules.home-manager; │
│ + │
│ + nixos = { │
│ + base = nixosModules + "/base"; │
│ + hardware = nixosModules + "/hardware"; │
│ + server = nixosModules + "/server"; │
│ + image = nixosModules + "/image"; │
│ + workstation = nixosModules + "/workstation"; │
│ + virtualization = nixosModules + "/virtualization"; │
│ + }; │
│ + common = { │
│ + base = commonModules + "/base"; │
│ + workstation = commonModules + "/workstation"; │
│ + console = commonModules + "/console"; │
│ + }; │
│ + darwin = "${self}/modules/darwin"; │
│ + │
│ + nixosMinimal = [ │
│ + options │
│ + (common.base + "/admin.nix") │
│ + (nixos.base + "/openssh.nix") │
│ + ]; │
│ + │
│ + core = [ │
│ + options │
│ + common.base │
│ + common.console │
│ + ]; │
│ + │
│ + nixosCore = │
│ + core │
│ + ++ [ │
│ + nixos.base │
│ + nixos.hardware │
│ + nixos.virtualization │
│ + nixos-hm │
│ + nixosSecrets │
│ + disko │
│ + ]; │
│ + │
│ + darwinCore = │
│ + core │
│ + ++ [ │
│ + darwin │
│ + darwin-hm │
│ + darwinSecrets │
│ + ]; │
│ + │
│ + isoModules = [ │
│ + nixosSecrets │
│ + (nixos.image + "/isoImage.nix") │
│ + (nixos.base + "/networking.nix") │
│ + (nixos.base + "/tailscale.nix") │
│ + (common.base + "/nix.nix") │
│ + (common.base + "/sudo.nix") │
│ + ]; │
│ + │
│ + ooknetModules = { │
│ + inherit │
│ + isoModules │
│ + nixosCore │
│ + nixosMinimal │
│ + darwinCore │
│ + nixos │
│ + darwin │
│ + common │
│ + core │
│ + hostModules │
│ + nixos-hm │
│ + darwin-hm │
│ + nixosSecrets │
│ + darwinSecrets │
│ + options │
│ + ; │
│ + }; │
│ +in { │
│ + _module.args.ooknetModules = ooknetModules; │
│ +} │
└────────────────────────────────────────────────────────────────────────────────────┘
┌─ outputs/builder/modules.nix ────────┐
│ diff --git a/outputs/builder/modules.nix b/o │
│ utputs/builder/modules.nix │
│ new file mode 100644 │
│ index 0000000..6bd52a8 │
│ --- /dev/null │
│ +++ b/outputs/builder/modules.nix │
│ @@ -0,0 +1,93 @@ │
│ +{ │
│ + inputs, │
│ + self, │
│ + ... │
│ +}: let │
│ + inherit (inputs.secrets.nixosModules) nix │
│ osSecrets; │
│ + inherit (inputs.secrets.nixosModules) dar │
│ winSecrets; │
│ + inherit (inputs.disko.nixosModules) disko │
│ ; │
│ + │
│ + nixosModules = "${self}/modules/nixos"; │
│ + commonModules = "${self}/modules/common"; │
│ + hostModules = "${self}/hosts"; │
│ + options = "${self}/modules/options"; │
│ + │
│ + nixos-hm = inputs.home-manager.nixosModul │
│ es.home-manager; │
│ + darwin-hm = inputs.home-manager.darwinMod │
│ ules.home-manager; │
│ + │
│ + nixos = { │
│ + base = nixosModules + "/base"; │
│ + hardware = nixosModules + "/hardware"; │
│ + server = nixosModules + "/server"; │
│ + image = nixosModules + "/image"; │
│ + workstation = nixosModules + "/workstat │
│ ion"; │
│ + virtualization = nixosModules + "/virtu │
│ alization"; │
│ + }; │
│ + common = { │
│ + base = commonModules + "/base"; │
│ + workstation = commonModules + "/worksta │
│ tion"; │
│ + console = commonModules + "/console"; │
│ + }; │
│ + darwin = "${self}/modules/darwin"; │
│ + │
│ + nixosMinimal = [ │
│ + options │
│ + (common.base + "/admin.nix") │
│ + (nixos.base + "/openssh.nix") │
│ + ]; │
│ + │
│ + core = [ │
│ + options │
│ + common.base │
│ + common.console │
│ + ]; │
│ + │
│ + nixosCore = │
│ + core │
│ + ++ [ │
│ + nixos.base │
│ + nixos.hardware │
│ + nixos.virtualization │
│ + nixos-hm │
│ + nixosSecrets │
│ + disko │
│ + ]; │
│ + │
│ + darwinCore = │
│ + core │
│ + ++ [ │
│ + darwin │
│ + darwin-hm │
│ + darwinSecrets │
│ + ]; │
│ + │
│ + isoModules = [ │
│ + nixosSecrets │
│ + (nixos.image + "/isoImage.nix") │
│ + (nixos.base + "/networking.nix") │
│ + (nixos.base + "/tailscale.nix") │
│ + (common.base + "/nix.nix") │
│ + (common.base + "/sudo.nix") │
│ + ]; │
│ + │
│ + ooknetModules = { │
│ + inherit │
│ + isoModules │
│ + nixosCore │
│ + nixosMinimal │
│ + darwinCore │
│ + nixos │
│ + darwin │
│ + common │
│ + core │
│ + hostModules │
│ + nixos-hm │
│ + darwin-hm │
│ + nixosSecrets │
│ + darwinSecrets │
│ + options │
│ + ; │
│ + }; │
│ +in { │
│ + _module.args.ooknetModules = ooknetModule │
│ s; │
│ +} │
└──────────────────────────────────────────────┘
┌─ outputs/builder/options.nix ──────────────────────────────────────────────┐
│ diff --git a/outputs/builder/options.nix b/outputs/builder/options.nix │
│ new file mode 100644 │
│ index 0000000..eda73be │
│ --- /dev/null │
│ +++ b/outputs/builder/options.nix │
│ @@ -0,0 +1,86 @@ │
│ +{lib, ...}: let │
│ + inherit (lib) mkOption; │
│ + inherit (lib.types) nullOr attrsOf submodule enum anything deferredModule listO │
│ f str; │
│ + systemOptions = { │
│ + additionalOptions ? {}, │
│ + example ? "", │
│ + description ? "", │
│ + }: │
│ + mkOption { │
│ + type = attrsOf (submodule { │
│ + options = │
│ + { │
│ + system = mkOption { │
│ + type = enum ["x86_64-linux" "aarch64-darwin"]; │
│ + description = "Systems architecture (e.g., x86_64-linux, aarch64-da │
│ rwin)"; │
│ + example = "x86_64-linux"; │
│ + }; │
│ + additionalModules = mkOption { │
│ + type = listOf deferredModule; │
│ + default = []; │
│ + description = '' │
│ + Additional modules to include with the system │
│ + ''; │
│ + }; │
│ + additionalArgs = mkOption { │
│ + type = attrsOf anything; │
│ + default = {}; │
│ + description = '' │
│ + Additional special args to pass to the system │
│ + ''; │
│ + }; │
│ + } │
│ + // additionalOptions; │
│ + }); │
│ + default = {}; │
│ + inherit example description; │
│ + }; │
│ +in { │
│ + options.flake.ooknet = { │
│ + workstations = systemOptions { │
│ + additionalOptions = { │
│ + type = mkOption { │
│ + type = enum ["laptop" "desktop"]; │
│ + description = "Type of workstation (e.g., laptop, desktop)"; │
│ + example = "laptop"; │
│ + }; │
│ + }; │
│ + }; │
│ + servers = systemOptions { │
│ + additionalOptions = { │
│ + services = mkOption { │
│ + type = listOf str; │
│ + default = []; │
│ + description = "List of services a server runs"; │
│ + }; │
│ + profile = mkOption { │
│ + type = nullOr str; │
│ + default = null; │
│ + }; │
│ + domain = mkOption { │
│ + type = str; │
│ + default = ""; │
│ + description = "Servers domain name"; │
│ + }; │
│ + type = mkOption { │
│ + type = enum ["desktop" "vm"]; │
│ + description = "Type of server (e.g., desktop, vm)"; │
│ + example = "vm"; │
│ + }; │
│ + }; │
│ + }; │
│ + images = systemOptions { │
│ + additionalOptions = { │
│ + profile = mkOption { │
│ + type = nullOr str; │
│ + default = null; │
│ + }; │
│ + type = mkOption { │
│ + type = enum ["iso" "installer"]; │
│ + description = "Type of image (e.g., installer, iso)"; │
│ + example = "iso"; │
│ + }; │
│ + }; │
│ + }; │
│ + }; │
│ +} │
└────────────────────────────────────────────────────────────────────────────────────┘
┌─ outputs/builder/options.nix ────────┐
│ diff --git a/outputs/builder/options.nix b/o │
│ utputs/builder/options.nix │
│ new file mode 100644 │
│ index 0000000..eda73be │
│ --- /dev/null │
│ +++ b/outputs/builder/options.nix │
│ @@ -0,0 +1,86 @@ │
│ +{lib, ...}: let │
│ + inherit (lib) mkOption; │
│ + inherit (lib.types) nullOr attrsOf submod │
│ ule enum anything deferredModule listOf str; │
│ + systemOptions = { │
│ + additionalOptions ? {}, │
│ + example ? "", │
│ + description ? "", │
│ + }: │
│ + mkOption { │
│ + type = attrsOf (submodule { │
│ + options = │
│ + { │
│ + system = mkOption { │
│ + type = enum ["x86_64-linux" " │
│ aarch64-darwin"]; │
│ + description = "Systems archit │
│ ecture (e.g., x86_64-linux, aarch64-darwin)" │
│ ; │
│ + example = "x86_64-linux"; │
│ + }; │
│ + additionalModules = mkOption { │
│ + type = listOf deferredModule; │
│ + default = []; │
│ + description = '' │
│ + Additional modules to inclu │
│ de with the system │
│ + ''; │
│ + }; │
│ + additionalArgs = mkOption { │
│ + type = attrsOf anything; │
│ + default = {}; │
│ + description = '' │
│ + Additional special args to │
│ pass to the system │
│ + ''; │
│ + }; │
│ + } │
│ + // additionalOptions; │
│ + }); │
│ + default = {}; │
│ + inherit example description; │
│ + }; │
│ +in { │
│ + options.flake.ooknet = { │
│ + workstations = systemOptions { │
│ + additionalOptions = { │
│ + type = mkOption { │
│ + type = enum ["laptop" "desktop"]; │
│ + description = "Type of workstatio │
│ n (e.g., laptop, desktop)"; │
│ + example = "laptop"; │
│ + }; │
│ + }; │
│ + }; │
│ + servers = systemOptions { │
│ + additionalOptions = { │
│ + services = mkOption { │
│ + type = listOf str; │
│ + default = []; │
│ + description = "List of services a │
│ server runs"; │
│ + }; │
│ + profile = mkOption { │
│ + type = nullOr str; │
│ + default = null; │
│ + }; │
│ + domain = mkOption { │
│ + type = str; │
│ + default = ""; │
│ + description = "Servers domain nam │
│ e"; │
│ + }; │
│ + type = mkOption { │
│ + type = enum ["desktop" "vm"]; │
│ + description = "Type of server (e. │
│ g., desktop, vm)"; │
│ + example = "vm"; │
│ + }; │
│ + }; │
│ + }; │
│ + images = systemOptions { │
│ + additionalOptions = { │
│ + profile = mkOption { │
│ + type = nullOr str; │
│ + default = null; │
│ + }; │
│ + type = mkOption { │
│ + type = enum ["iso" "installer"]; │
│ + description = "Type of image (e.g │
│ ., installer, iso)"; │
│ + example = "iso"; │
│ + }; │
│ + }; │
│ + }; │
│ + }; │
│ +} │
└──────────────────────────────────────────────┘
┌─ outputs/builder/workstation.nix ──────────────────────────────────────────┐
│ diff --git a/outputs/builder/workstation.nix b/outputs/builder/workstation.nix │
│ new file mode 100644 │
│ index 0000000..40a3318 │
│ --- /dev/null │
│ +++ b/outputs/builder/workstation.nix │
│ @@ -0,0 +1,67 @@ │
│ +{ │
│ + config, │
│ + lib, │
│ + withSystem, │
│ + inputs, │
│ + self, │
│ + ooknetModules, │
│ + ... │
│ +}: let │
│ + inherit (lib) mapAttrs mkDefault filterAttrs; │
│ + inherit (builtins) concatLists singleton; │
│ + inherit (self) hozen ook; │
│ + inherit (ooknetModules) nixosCore darwinCore common nixos hostModules; │
│ + │
│ + buildWorkstation = hostname: cfg: │
│ + withSystem cfg.system ({ │
│ + inputs', │
│ + self', │
│ + ... │
│ + }: let │
│ + isDarwin = cfg.system == "aarch64-darwin"; │
│ + │
│ + mkSystem = │
│ + if isDarwin │
│ + then inputs.nix-darwin.lib.darwinSystem │
│ + else inputs.nixpkgs.lib.nixosSystem; │
│ + │
│ + platformModules = │
│ + if isDarwin │
│ + then darwinCore ++ [common.workstation] │
│ + else nixosCore ++ [nixos.workstation common.workstation]; │
│ + in │
│ + mkSystem { │
│ + 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 = "workstation"; │
│ + type = cfg.type; │
│ + }; │
│ + }) │
│ + platformModules │
│ + [(hostModules + "/${hostname}")] │
│ + cfg.additionalModules │
│ + ]; │
│ + }); │
│ +in { │
│ + config = let │
│ + workstations = config.flake.ooknet.workstations; │
│ + nixosWorkstations = filterAttrs (_: cfg: cfg.system != "aarch64-darwin") work │
│ stations; │
│ + darwinWorkstations = filterAttrs (_: cfg: cfg.system == "aarch64-darwin") wor │
│ kstations; │
│ + in { │
│ + flake.nixosConfigurations = mapAttrs buildWorkstation nixosWorkstations; │
│ + flake.darwinConfigurations = mapAttrs buildWorkstation darwinWorkstations; │
│ + }; │
│ +} │
└────────────────────────────────────────────────────────────────────────────────────┘
┌─ outputs/builder/workstation.nix ────┐
│ diff --git a/outputs/builder/workstation.nix │
│ b/outputs/builder/workstation.nix │
│ new file mode 100644 │
│ index 0000000..40a3318 │
│ --- /dev/null │
│ +++ b/outputs/builder/workstation.nix │
│ @@ -0,0 +1,67 @@ │
│ +{ │
│ + config, │
│ + lib, │
│ + withSystem, │
│ + inputs, │
│ + self, │
│ + ooknetModules, │
│ + ... │
│ +}: let │
│ + inherit (lib) mapAttrs mkDefault filterAt │
│ trs; │
│ + inherit (builtins) concatLists singleton; │
│ + inherit (self) hozen ook; │
│ + inherit (ooknetModules) nixosCore darwinC │
│ ore common nixos hostModules; │
│ + │
│ + buildWorkstation = hostname: cfg: │
│ + withSystem cfg.system ({ │
│ + inputs', │
│ + self', │
│ + ... │
│ + }: let │
│ + isDarwin = cfg.system == "aarch64-dar │
│ win"; │
│ + │
│ + mkSystem = │
│ + if isDarwin │
│ + then inputs.nix-darwin.lib.darwinSy │
│ stem │
│ + else inputs.nixpkgs.lib.nixosSystem │
│ ; │
│ + │
│ + platformModules = │
│ + if isDarwin │
│ + then darwinCore ++ [common.workstat │
│ ion] │
│ + else nixosCore ++ [nixos.workstatio │
│ n common.workstation]; │
│ + in │
│ + mkSystem { │
│ + 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 = "workstation"; │
│ + type = cfg.type; │
│ + }; │
│ + }) │
│ + platformModules │
│ + [(hostModules + "/${hostname}")] │
│ + cfg.additionalModules │
│ + ]; │
│ + }); │
│ +in { │
│ + config = let │
│ + workstations = config.flake.ooknet.work │
│ stations; │
│ + nixosWorkstations = filterAttrs (_: cfg │
│ : cfg.system != "aarch64-darwin") workstatio │
│ ns; │
│ + darwinWorkstations = filterAttrs (_: cf │
│ g: cfg.system == "aarch64-darwin") workstati │
│ ons; │
│ + in { │
│ + flake.nixosConfigurations = mapAttrs bu │
│ ildWorkstation nixosWorkstations; │
│ + flake.darwinConfigurations = mapAttrs b │
│ uildWorkstation darwinWorkstations; │
│ + }; │
│ +} │
└──────────────────────────────────────────────┘
[ BACK TO LOG ]
──────────────────────────────────────────────────────────────────────────────────────
OOKNET
────────────────────────────────────────────────
OOKNET