feat: add lib.mkFleet for external flake consumption

- Create lib/mkFleet.nix to expose fleet generator as library function
- Allow external flakes to use Athenix's fleet logic with custom inventory
- Export lib output in flake.nix with proper input passing
- Enable usage: nixosConfigurations = athenix.lib.mkFleet { fleet = ...; hwTypes = ...; }
This commit is contained in:
UGA Innovation Factory
2026-01-07 18:11:59 -05:00
parent 775080949d
commit 1ce7334a73
3 changed files with 20 additions and 2 deletions

View File

@@ -69,7 +69,7 @@
...
}:
let
fleet = import ./glue/fleet.nix { inherit inputs; };
fleet = self.lib.mkFleet { inherit inputs; };
linuxSystem = "x86_64-linux";
artifacts = import ./installer/artifacts.nix {
inherit inputs fleet self;
@@ -90,11 +90,14 @@
nixosConfigurations = fleet.nixosConfigurations;
# Expose artifacts to all systems, but they are always built for x86_64-linux
packages = forAllSystems (_: artifacts);
packages.${linuxSystem} = artifacts;
# Expose host type modules and installer modules for external use
nixosModules = import ./installer/modules.nix { inherit inputs; };
# Library functions
lib = import ./lib { inherit inputs; };
# Templates for external configurations
templates = import ./templates;
};

4
lib/default.nix Normal file
View File

@@ -0,0 +1,4 @@
{ inputs }:
{
mkFleet = import ./mkFleet.nix;
}

11
lib/mkFleet.nix Normal file
View File

@@ -0,0 +1,11 @@
# Generate fleet configurations with custom fleet and hardware types
# Usage: nixosConfigurations = athenix.lib.mkFleet { fleet = { ... }; hwTypes = { ... }; }
{
inputs,
fleet ? null,
hwTypes ? null,
}:
import ../fleet/default.nix {
inherit inputs;
inherit fleet hwTypes;
}