OOKNET                             [ /  search the index  ]  
──────────────────────────────────────────────────────────────────────────────────────
══════════════════════════════════════════════════════════════════════════════════════
OOKNET   [ /  search  ]  
────────────────────────────────────────────────
════════════════════════════════════════════════
 
 
main @ 55 LINES
 
[ HISTORY ]  [ UP ]
 

{
  config,
  lib,
  withSystem,
  inputs,
  self,
  ooknetModules,
  ...
}: let
  inherit (lib) mapAttrs mkDefault singleton optionals;
  inherit (builtins) concatLists;
  inherit (self) ook;
  inherit (ooknetModules) nixosMinimal isoModules nixos hostModules;

  buildImage = hostname: cfg:
    withSystem cfg.system ({
      inputs',
      self',
      ...
    }:
      inputs.nixpkgs.lib.nixosSystem {
        specialArgs =
          {
            inherit 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.image
s;
}

{
  config,
  lib,
  withSystem,
  inputs,
  self,
  ooknetModules,
  ...
}: let
  inherit (lib) mapAttrs mkDefault singleton
 optionals;
  inherit (builtins) concatLists;
  inherit (self) ook;
  inherit (ooknetModules) nixosMinimal isoMo
dules nixos hostModules;

  buildImage = hostname: cfg:
    withSystem cfg.system ({
      inputs',
      self',
      ...
    }:
      inputs.nixpkgs.lib.nixosSystem {
        specialArgs =
          {
            inherit ook inputs self inputs' 
self';
          }
          // cfg.additionalArgs;

        modules = concatLists [
          (singleton {
            networking.hostName = hostname;
            nixpkgs = {
              flake.source = inputs.nixpkgs.
outPath;
              hostPlatform = mkDefault cfg.s
ystem;
            };
            ooknet.host = {
              name = hostname;
              role = cfg.role;
              type = cfg.type;
            };
          })
          nixosMinimal
          (optionals (cfg.type == "iso") iso
Modules)
          (optionals (cfg.role == "installer
") [(nixos.image + "/installer.nix")])
          (
            if cfg.profile != null
            then [(hostModules + "/${cfg.pro
file}")]
            else [(hostModules + "/${hostnam
e}")]
          )
          cfg.additionalModules
        ];
      });
in {
  config.flake.nixosConfigurations = mapAttr
s buildImage config.flake.ooknet.images;
}
 
──────────────────────────────────────────────────────────────────────────────────────
OOKNET
────────────────────────────────────────────────
OOKNET