doc: added some documentation
This commit is contained in:
parent
bd970bebd0
commit
e696a9f1fe
1 changed files with 9 additions and 4 deletions
13
flake.nix
13
flake.nix
|
@ -15,17 +15,20 @@
|
||||||
|
|
||||||
outputs = { self, nixpkgs, deploy-rs, ... }: let
|
outputs = { self, nixpkgs, deploy-rs, ... }: let
|
||||||
|
|
||||||
|
# can centralise the config for each machiene here
|
||||||
machine_config = [
|
machine_config = [
|
||||||
# each system one line
|
# each system one line
|
||||||
{
|
{
|
||||||
|
# each machiene must have a name
|
||||||
name = "test01";
|
name = "test01";
|
||||||
|
|
||||||
|
# core info about it
|
||||||
system = "x86_64-linux";
|
system = "x86_64-linux";
|
||||||
modules = [
|
modules = [
|
||||||
./machines/base.nix
|
./machines/base.nix
|
||||||
];
|
];
|
||||||
|
|
||||||
# for
|
# for the deployment
|
||||||
hostname = "test01.home.brendan.ie";
|
hostname = "test01.home.brendan.ie";
|
||||||
sshUser = "root";
|
sshUser = "root";
|
||||||
}
|
}
|
||||||
|
@ -48,7 +51,9 @@
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
# this takes the config attributes and turns it into something useful for the nodes
|
||||||
create_nodes = map (
|
create_nodes = map (
|
||||||
|
# this is fairly simple, just plug in teh values
|
||||||
config: {
|
config: {
|
||||||
${config.name} = {
|
${config.name} = {
|
||||||
hostname = config.hostname;
|
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) {};
|
merge = nixpkgs.lib.lists.foldl (a: b: a // b) {};
|
||||||
|
|
||||||
in {
|
in {
|
||||||
|
# values created using the data and functions above
|
||||||
nixosConfigurations = merge (create_nixosConfigurations machine_config);
|
nixosConfigurations = merge (create_nixosConfigurations machine_config);
|
||||||
|
|
||||||
deploy.nodes = merge (create_nodes machine_config);
|
deploy.nodes = merge (create_nodes machine_config);
|
||||||
|
|
||||||
# This is highly advised, and will prevent many possible mistakes
|
# This is highly advised, and will prevent many possible mistakes
|
||||||
|
|
Loading…
Reference in a new issue