feat: made a function to create the nodes from teh config attribute

This commit is contained in:
silver 2023-01-13 00:14:44 +00:00
parent f75c4626b5
commit bd970bebd0

View file

@ -24,6 +24,10 @@
modules = [
./machines/base.nix
];
# for
hostname = "test01.home.brendan.ie";
sshUser = "root";
}
];
@ -44,19 +48,25 @@
}
);
create_nodes = map (
config: {
${config.name} = {
hostname = config.hostname;
profiles.system = {
path = deploy-rs.lib."${config.system}".activate.nixos self.nixosConfigurations."${config.name}";
sshUser = config.sshUser;
};
};
}
);
# this merges together an array of atributes
merge = nixpkgs.lib.lists.foldl (a: b: a // b) {};
in {
nixosConfigurations = merge (create_nixosConfigurations machine_config);
deploy.nodes.some-random-system2 = {
hostname = "test01.home.brendan.ie";
profiles.system = {
path = deploy-rs.lib.x86_64-linux.activate.nixos self.nixosConfigurations.test01;
sshUser = "root";
};
};
deploy.nodes = merge (create_nodes machine_config);
# This is highly advised, and will prevent many possible mistakes
checks = builtins.mapAttrs (system: deployLib: deployLib.deployChecks self.deploy) deploy-rs.lib;