git.delta.rocks / jrsonnet / refs/commits / 8d4a7a16f575

difftreelog

source

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