diff --git a/flake.nix b/flake.nix index 84947fb..8517bb8 100644 --- a/flake.nix +++ b/flake.nix @@ -15,17 +15,20 @@ outputs = { self, nixpkgs, deploy-rs, ... }: let - + # can centralise the config for each machiene here machine_config = [ # each system one line { + # each machiene must have a name name = "test01"; + + # core info about it system = "x86_64-linux"; modules = [ ./machines/base.nix ]; - # for + # for the deployment hostname = "test01.home.brendan.ie"; sshUser = "root"; } @@ -48,7 +51,9 @@ } ); + # this takes the config attributes and turns it into something useful for the nodes create_nodes = map ( + # this is fairly simple, just plug in teh values config: { ${config.name} = { hostname = config.hostname; @@ -60,12 +65,12 @@ } ); - # this merges together an array of atributes + # this merges together an array of atributes into just one set merge = nixpkgs.lib.lists.foldl (a: b: a // b) {}; in { + # values created using the data and functions above nixosConfigurations = merge (create_nixosConfigurations machine_config); - deploy.nodes = merge (create_nodes machine_config); # This is highly advised, and will prevent many possible mistakes