pass nodes to config and have defaults for the IPs
This commit is contained in:
parent
a5eaff1a63
commit
d6304ab783
1 changed files with 26 additions and 6 deletions
32
flake.nix
32
flake.nix
|
@ -53,20 +53,40 @@
|
||||||
description = "All my NixoS machines";
|
description = "All my NixoS machines";
|
||||||
specialArgs = {
|
specialArgs = {
|
||||||
inherit inputs outputs;
|
inherit inputs outputs;
|
||||||
|
nodes = colmenaHive.nodes;
|
||||||
pkgs-unstable = import nixpkgs-unstable { system = "x86_64-linux"; };
|
pkgs-unstable = import nixpkgs-unstable { system = "x86_64-linux"; };
|
||||||
};
|
};
|
||||||
nixpkgs = import nixpkgs { system = "x86_64-linux"; };
|
nixpkgs = import nixpkgs { system = "x86_64-linux"; };
|
||||||
};
|
};
|
||||||
|
|
||||||
defaults = { lib, config, name, ... }: {
|
defaults = { lib, config, name, nodes, ... }: {
|
||||||
imports = [ ./hosts/${name} ./profiles/base ];
|
imports = [ ./hosts/${name} ./profiles/base ];
|
||||||
|
|
||||||
networking.hostName = name;
|
options.cherrykitten = {
|
||||||
networking.domain = "cherrykitten.xyz";
|
primaryIPv4 = lib.mkOption {
|
||||||
|
type = lib.types.nullOr lib.types.str;
|
||||||
|
default =
|
||||||
|
if (config.networking.interfaces ? eth0) then
|
||||||
|
(builtins.elemAt config.networking.interfaces.eth0.ipv4.addresses 0).address
|
||||||
|
else null;
|
||||||
|
};
|
||||||
|
primaryIPv6 = lib.mkOption {
|
||||||
|
type = lib.types.nullOr lib.types.str;
|
||||||
|
default =
|
||||||
|
if (config.networking.interfaces ? eth0) then
|
||||||
|
(builtins.elemAt config.networking.interfaces.eth0.ipv6.addresses 0).address
|
||||||
|
else null;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
home-manager.extraSpecialArgs = {
|
config = {
|
||||||
inherit inputs outputs;
|
networking.hostName = name;
|
||||||
pkgs-unstable = import nixpkgs-unstable { system = "x86_64-linux"; };
|
networking.domain = "cherrykitten.xyz";
|
||||||
|
|
||||||
|
home-manager.extraSpecialArgs = {
|
||||||
|
inherit inputs outputs;
|
||||||
|
pkgs-unstable = import nixpkgs-unstable { system = "x86_64-linux"; };
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
} // hosts;
|
} // hosts;
|
||||||
|
|
Loading…
Add table
Reference in a new issue