1{ flake-utils }: {2 fleetConfiguration = { data, nixpkgs, hosts, ... }@allConfig:3 let4 config = builtins.removeAttrs allConfig [ "nixpkgs" "data" ];5 in6 flake-utils.lib.eachDefaultSystem (system: rec {7 root = nixpkgs.lib.evalModules {8 modules = (import ../modules/fleet/_modules.nix) ++ [ config data ];9 specialArgs = {10 inherit nixpkgs;11 fleet = import ./fleetLib.nix {12 inherit nixpkgs hosts;13 };14 };15 };16 configuredHosts = root.config.hosts;17 configuredSecrets = root.config.secrets;18 configuredSystems = nixpkgs.lib.listToAttrs (19 map20 (21 name: {22 inherit name;23 value = nixpkgs.lib.nixosSystem {24 system = configuredHosts.${name}.system;25 modules = configuredHosts.${name}.modules ++ (26 if configuredHosts.${name}.system == "aarch64-linux" then [ (nixpkgs + "/nixos/modules/installer/sd-card/sd-image-aarch64-installer.nix") ]27 else [ ]28 ) ++ [29 ({ ... }: {30 nixpkgs.localSystem.system = system;31 nixpkgs.crossSystem = if system == configuredHosts.${name}.system then null else {32 system = configuredHosts.${name}.system;33 };34 })35 ];36 };37 }38 )39 (builtins.attrNames root.config.hosts)40 ); 41 });42}