- Add glue/ for fleet generation logic and common configuration - Add variants/ for hardware type modules - Improves separation of concerns and module organization
30 lines
872 B
Nix
30 lines
872 B
Nix
# ============================================================================
|
|
# Host Types Module
|
|
# ============================================================================
|
|
# This module exports all available host types as an attribute set.
|
|
# Each type is a NixOS module function that takes { inputs } and returns
|
|
# a module configuration.
|
|
|
|
{ inputs }:
|
|
let
|
|
inherit (builtins) readDir attrNames;
|
|
lib = inputs.nixpkgs.lib;
|
|
inherit (lib) filterAttrs removeSuffix genAttrs;
|
|
|
|
files = readDir ./.;
|
|
|
|
# Keep only regular *.nix files except default.nix
|
|
nixFiles =
|
|
filterAttrs
|
|
(name: type:
|
|
type == "regular"
|
|
&& lib.hasSuffix ".nix" name
|
|
&& name != "default.nix")
|
|
files;
|
|
|
|
moduleNames = map (name: removeSuffix ".nix" name) (attrNames nixFiles);
|
|
in
|
|
genAttrs moduleNames
|
|
(name:
|
|
import ./${name}.nix { inherit inputs; })
|