Hello! At the moment I have a flake that generates my system configurations for a small set of identical systems based on genAttrs. It looks like this:
inputs:
let
system = "x86_64-linux";
hosts = [ "node01" "node02" ];
pkgs = nixpkgs.legacyPackages.${system};
in
{
nixosConfigurations = pkgs.lib.genAttrs hosts (host:
import ./systems/node { inherit inputs system pkgs host; } );
}
This works fine, but I managed to modularize my config even more and basically just need to set the Hostname and two IP Addresses for each system.
So I thought I would create either a list of attributes or an attribute set with all the parameters for each system.
So changing the hosts list to something like
hosts =
[
{ name = "node01"; ip = "192.168.88.31/24"; initIp = "192.168.88.21/24"; }
{ name = "node02"; ip = "192.168.88.32/24"; initIp = "192.168.88.22/24"; }
];
or
hosts =
{
node01 = [ "node01" "192.168.88.31/24" "192.168.88.21/24" ];
node02 = [ "node02" "192.168.88.32/24" "192.168.88.22/24" ];
}
But I’m unable to alter the current genAttrs part of my flake make it work. I tried listToAttrs and foreach but I’m not able to get it working. For starters I’m not even sure if the list of attribute sets would be easier than a solution with the attribute set containig lists.
This is probably really basic to most but I haven’t touched nix for a while so I’m completely stuck atm.
Any help or hint would be appreciated.