diff --git a/flake.nix b/flake.nix index 74acc6a..e1cd249 100644 --- a/flake.nix +++ b/flake.nix @@ -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; }; diff --git a/lib/default.nix b/lib/default.nix new file mode 100644 index 0000000..fe2fff2 --- /dev/null +++ b/lib/default.nix @@ -0,0 +1,4 @@ +{ inputs }: +{ + mkFleet = import ./mkFleet.nix; +} \ No newline at end of file diff --git a/lib/mkFleet.nix b/lib/mkFleet.nix new file mode 100644 index 0000000..4de4d49 --- /dev/null +++ b/lib/mkFleet.nix @@ -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; + } \ No newline at end of file