git.delta.rocks / jrsonnet / refs/commits / cd4874aa6417

difftreelog

source

lib/default.nix1.4 KiBsourcehistory
1{2  fleetConfiguration = { nixpkgs, hosts, ... }@allConfig:3    let4      config = builtins.removeAttrs allConfig [ "nixpkgs" ];5    in6    rec {7      root = nixpkgs.lib.evalModules {8        modules =9          (import ../modules/modules.nix) ++ [10            config11            (12              { ... }: {13                options = { };14                config = {15                  # Secret data is available only via fleet build-systems16                  secrets =17                    if builtins?getEnv then18                      let19                        stringData = builtins.getEnv "SECRET_DATA";20                      in21                      if stringData != "" then (builtins.fromJSON stringData) else { }22                    else { };23                };24              }25            )26          ];27        specialArgs = {28          inherit nixpkgs;29          fleet = import ./fleetLib.nix {30            inherit nixpkgs hosts;31          };32        };33      };34      configuredHosts = root.config.hosts;35      configuredSecrets = root.config.secrets;36      configuredSystems = nixpkgs.lib.listToAttrs (37        map38          (39            name: {40              inherit name; value = nixpkgs.lib.nixosSystem {41              system = configuredHosts.${name}.system;42              modules = configuredHosts.${name}.modules;43            };44            }45          )46          (builtins.attrNames root.config.hosts)47      ); #nixpkgs.lib.nixosSystem {}48    };49}