Add some docs
This commit is contained in:
parent
f64314685b
commit
36e4cfd68f
12
flake.nix
12
flake.nix
|
@ -6,7 +6,10 @@
|
||||||
|
|
||||||
outputs = { self, nixpkgs, deploy-rs }@inputs:
|
outputs = { self, nixpkgs, deploy-rs }@inputs:
|
||||||
let
|
let
|
||||||
|
# Add default system
|
||||||
system = "x86_64-linux";
|
system = "x86_64-linux";
|
||||||
|
|
||||||
|
# Make a config
|
||||||
mkConfig = { name, lxc ? true }:
|
mkConfig = { name, lxc ? true }:
|
||||||
nixpkgs.lib.nixosSystem {
|
nixpkgs.lib.nixosSystem {
|
||||||
inherit system;
|
inherit system;
|
||||||
|
@ -18,6 +21,8 @@
|
||||||
[ ]) ++ [ "${./.}/hosts/${name}/configuration.nix" ];
|
[ ]) ++ [ "${./.}/hosts/${name}/configuration.nix" ];
|
||||||
specialArgs = { inputs = inputs; };
|
specialArgs = { inputs = inputs; };
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# create a deployment
|
||||||
mkDeploy = profile: {
|
mkDeploy = profile: {
|
||||||
hostname = "${profile}.voidlocal";
|
hostname = "${profile}.voidlocal";
|
||||||
fastConnection = true;
|
fastConnection = true;
|
||||||
|
@ -27,9 +32,14 @@
|
||||||
self.nixosConfigurations.${profile};
|
self.nixosConfigurations.${profile};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# art starts here :D
|
||||||
hosts' = import ./common/hosts.nix;
|
hosts' = import ./common/hosts.nix;
|
||||||
|
|
||||||
|
# we only want nix hosts for this part, not all of the defined ones...
|
||||||
nixHosts = (builtins.filter ({ nix ? true, ... }: nix) hosts');
|
nixHosts = (builtins.filter ({ nix ? true, ... }: nix) hosts');
|
||||||
|
|
||||||
|
# Convert a host from hosts.nix to something nixosConfigurations understands
|
||||||
hostToConfig = z@{ hostname, nixname ? hostname, lxc ? true, ... }:
|
hostToConfig = z@{ hostname, nixname ? hostname, lxc ? true, ... }:
|
||||||
a:
|
a:
|
||||||
a // {
|
a // {
|
||||||
|
@ -39,12 +49,14 @@
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# Same as above, but for the nodes part of deploy.
|
||||||
hostToDeploy = z@{ hostname, nixname ? hostname, lxc ? true, ... }:
|
hostToDeploy = z@{ hostname, nixname ? hostname, lxc ? true, ... }:
|
||||||
a:
|
a:
|
||||||
a // {
|
a // {
|
||||||
${nixname} = mkDeploy nixname;
|
${nixname} = mkDeploy nixname;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# And actually make the two sets.
|
||||||
configs = nixpkgs.lib.fold hostToConfig { } nixHosts;
|
configs = nixpkgs.lib.fold hostToConfig { } nixHosts;
|
||||||
nodes = nixpkgs.lib.fold hostToDeploy { } nixHosts;
|
nodes = nixpkgs.lib.fold hostToDeploy { } nixHosts;
|
||||||
in {
|
in {
|
||||||
|
|
Loading…
Reference in a new issue