1{flake-utils}: {2 fleetConfiguration = {3 4 5 6 7 data,8 nixpkgs,9 overlays ? [],10 hosts,11 modules,12 globalModules ? [],13 extraFleetLib ? {},14 }: let15 hostNames = nixpkgs.lib.attrNames hosts;16 fleetLib =17 (import ./fleetLib.nix {18 inherit nixpkgs hostNames;19 })20 // extraFleetLib;21 in let22 root = nixpkgs.lib.evalModules {23 modules =24 (import ../modules/fleet/_modules.nix)25 ++ [26 data27 ({...}: {28 inherit globalModules hosts overlays;29 })30 ]31 ++ modules;32 specialArgs = {33 inherit nixpkgs fleetLib;34 };35 };36 failedAssertions = map (x: x.message) (nixpkgs.lib.filter (x: !x.assertion) root.config.assertions);37 checkedRoot =38 if failedAssertions != []39 then throw "Fleet failed assertions:\n${nixpkgs.lib.concatStringsSep "\n" (map (x: "- ${x}") failedAssertions)}"40 else nixpkgs.lib.showWarnings root.config.warnings root;41 withData = {42 root,43 data,44 }: {45 config = root.config;46 };47 defaultData = withData {48 inherit data;49 root = checkedRoot;50 };51 uncheckedData = withData {inherit data root;};52 in {53 inherit nixpkgs overlays;54 inherit (defaultData) config;55 unchecked = {56 inherit (uncheckedData) config;57 };58 };59}