42 lines
1,018 B
Nix
42 lines
1,018 B
Nix
let
|
|
sources = import ./npins;
|
|
metadata = import ./meta;
|
|
|
|
lib = import ./lib/trivial.nix;
|
|
|
|
mkNode = node: { name, nodes, ... }: {
|
|
# Import the base configuration for each node
|
|
imports = builtins.map (lib.mkRel ./machines/${node}) [
|
|
"_configuration.nix"
|
|
"_hardware-configuration.nix"
|
|
];
|
|
|
|
# Deployment config is specified in meta.nodes.${node}.deployment
|
|
inherit (metadata.nodes.${node}) deployment;
|
|
};
|
|
|
|
mkNixpkgs = node: import sources."nixos-${metadata.nodes.${node}.nixpkgs}" { };
|
|
|
|
mkArgs = node: {
|
|
dgn-lib = import ./lib { inherit ((mkNixpkgs node)) lib; };
|
|
};
|
|
|
|
nodes = builtins.attrNames metadata.nodes;
|
|
in
|
|
|
|
{
|
|
meta = {
|
|
nodeNixpkgs = lib.mapSingleFuse mkNixpkgs nodes;
|
|
|
|
specialArgs = { meta = metadata; };
|
|
|
|
nodeSpecialArgs = lib.mapSingleFuse mkArgs nodes;
|
|
|
|
# TODO: Add remote builders (`machinesFile` option)
|
|
};
|
|
|
|
defaults = { ... }: {
|
|
# Import the default modules
|
|
imports = [ ./modules ];
|
|
};
|
|
} // (lib.mapSingleFuse mkNode nodes)
|