derive domain from server type

This commit is contained in:
Pim Kunis 2024-01-28 13:46:32 +01:00
parent bd5dc4b883
commit a015290fcf
3 changed files with 6 additions and 18 deletions

View file

@ -4,11 +4,7 @@
type = "physical"; type = "physical";
nixosModule = { nixosModule = {
networking = { networking.hostName = "jefke";
hostName = "jefke";
# TODO: generate this using type?
domain = "hyp";
};
lab = { lab = {
terraformDatabase.enable = true; terraformDatabase.enable = true;
@ -34,10 +30,7 @@
nixosModule = { config, ... }: nixosModule = { config, ... }:
let inherit (config.lab.networking) dmzServicesIPv4 dmzServicesIPv6; in let inherit (config.lab.networking) dmzServicesIPv4 dmzServicesIPv6; in
{ {
networking = { networking.hostName = "atlas";
hostName = "atlas";
domain = "hyp";
};
lab = { lab = {
networking = { networking = {
@ -65,10 +58,7 @@
type = "physical"; type = "physical";
nixosModule = { pkgs, ... }: { nixosModule = { pkgs, ... }: {
networking = { networking.hostName = "lewis";
hostName = "lewis";
domain = "hyp";
};
lab = { lab = {
dataHost.enable = true; dataHost.enable = true;
@ -96,10 +86,7 @@
echo "Hello world from inside a virtual machine!!" | ${pkgs.lolcat}/bin/lolcat echo "Hello world from inside a virtual machine!!" | ${pkgs.lolcat}/bin/lolcat
''; '';
networking = { networking.hostName = "my-microvm";
hostName = "my-microvm";
domain = "dmz";
};
lab.vmMacAddress = "BA:DB:EE:F0:00:00"; lab.vmMacAddress = "BA:DB:EE:F0:00:00";
}; };

View file

@ -89,6 +89,7 @@ in {
config = { config = {
networking = { networking = {
domain = if machine.type == "physical" then "hyp" else "dmz";
nftables.enable = true; nftables.enable = true;
useDHCP = machine.type == "virtual"; useDHCP = machine.type == "virtual";

View file

@ -1,4 +1,4 @@
{ pkgs, config, lib, modulesPath, machine, microvm, disko, agenix, machines, ... }: { { pkgs, config, lib, modulesPath, microvm, disko, agenix, machines, ... }: {
imports = [ imports = [
(modulesPath + "/installer/scan/not-detected.nix") (modulesPath + "/installer/scan/not-detected.nix")
microvm.nixosModules.host microvm.nixosModules.host