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

{
  config,
  lib,
  withSystem,
  inputs,
  self,
  ooknetModules,
  ...
}: let
  inherit (lib) mapAttrs mkDefault filterAttrs singleton;
  inherit (builtins) concatLists;
  inherit (self) 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 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") works
tations;
    darwinWorkstations = filterAttrs (_: cfg: cfg.system == "aarch64-darwin") work
stations;
  in {
    flake.nixosConfigurations = mapAttrs buildWorkstation nixosWorkstations;
    flake.darwinConfigurations = mapAttrs buildWorkstation darwinWorkstations;
  };
}

{
  config,
  lib,
  withSystem,
  inputs,
  self,
  ooknetModules,
  ...
}: let
  inherit (lib) mapAttrs mkDefault filterAtt
rs singleton;
  inherit (builtins) concatLists;
  inherit (self) ook;
  inherit (ooknetModules) nixosCore darwinCo
re common nixos hostModules;

  buildWorkstation = hostname: cfg:
    withSystem cfg.system ({
      inputs',
      self',
      ...
    }: let
      isDarwin = cfg.system == "aarch64-darw
in";

      mkSystem =
        if isDarwin
        then inputs.nix-darwin.lib.darwinSys
tem
        else inputs.nixpkgs.lib.nixosSystem;

      platformModules =
        if isDarwin
        then darwinCore ++ [common.workstati
on]
        else nixosCore ++ [nixos.workstation
 common.workstation];
    in
      mkSystem {
        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 = "workstation";
              type = cfg.type;
            };
          })
          platformModules
          [(hostModules + "/${hostname}")]
          cfg.additionalModules
        ];
      });
in {
  config = let
    workstations = config.flake.ooknet.works
tations;
    nixosWorkstations = filterAttrs (_: cfg:
 cfg.system != "aarch64-darwin") workstation
s;
    darwinWorkstations = filterAttrs (_: cfg
: cfg.system == "aarch64-darwin") workstatio
ns;
  in {
    flake.nixosConfigurations = mapAttrs bui
ldWorkstation nixosWorkstations;
    flake.darwinConfigurations = mapAttrs bu
ildWorkstation darwinWorkstations;
  };
}
 
──────────────────────────────────────────────────────────────────────────────────────
OOKNET
────────────────────────────────────────────────
OOKNET