diff --git a/nixos/boxes/colony/default.nix b/nixos/boxes/colony/default.nix index 4ab1ab5..a839cb8 100644 --- a/nixos/boxes/colony/default.nix +++ b/nixos/boxes/colony/default.nix @@ -9,6 +9,7 @@ assignments = { internal = { altNames = [ "vm" ]; + domain = lib.my.colony.domain; ipv4.address = "${lib.my.colony.start.base.v4}2"; ipv6 = { iid = "::2"; @@ -32,8 +33,6 @@ { imports = [ "${modulesPath}/profiles/qemu-guest.nix" ]; - networking.domain = lib.my.colony.domain; - boot.kernelParams = [ "intel_iommu=on" ]; boot.loader.systemd-boot.configurationLimit = 20; fileSystems = { diff --git a/nixos/boxes/colony/vms/estuary/default.nix b/nixos/boxes/colony/vms/estuary/default.nix index 8168dcd..4ae25f9 100644 --- a/nixos/boxes/colony/vms/estuary/default.nix +++ b/nixos/boxes/colony/vms/estuary/default.nix @@ -8,6 +8,7 @@ internal = { name = "estuary-vm"; altNames = [ "fw" ]; + domain = lib.my.colony.domain; ipv4 = { address = "80.111.124.10"; gateway = null; @@ -37,8 +38,6 @@ config = mkMerge [ { - networking.domain = lib.my.colony.domain; - boot.kernelParams = [ "console=ttyS0,115200n8" ]; fileSystems = { "/boot" = { diff --git a/nixos/boxes/colony/vms/shill/containers/middleman.nix b/nixos/boxes/colony/vms/shill/containers/middleman.nix index f3b281d..f5de0a9 100644 --- a/nixos/boxes/colony/vms/shill/containers/middleman.nix +++ b/nixos/boxes/colony/vms/shill/containers/middleman.nix @@ -7,6 +7,7 @@ internal = { name = "middleman-ctr"; altNames = [ "http" ]; + domain = lib.my.colony.domain; ipv4.address = "${lib.my.colony.start.ctrs.v4}2"; ipv6 = { iid = "::2"; diff --git a/nixos/boxes/colony/vms/shill/containers/vaultwarden.nix b/nixos/boxes/colony/vms/shill/containers/vaultwarden.nix index ebaa32f..7cd34f1 100644 --- a/nixos/boxes/colony/vms/shill/containers/vaultwarden.nix +++ b/nixos/boxes/colony/vms/shill/containers/vaultwarden.nix @@ -6,6 +6,7 @@ assignments = { internal = { name = "vaultwarden-ctr"; + domain = lib.my.colony.domain; ipv4.address = "${lib.my.colony.start.ctrs.v4}3"; ipv6 = { iid = "::3"; diff --git a/nixos/boxes/colony/vms/shill/default.nix b/nixos/boxes/colony/vms/shill/default.nix index 63cf955..373dfa5 100644 --- a/nixos/boxes/colony/vms/shill/default.nix +++ b/nixos/boxes/colony/vms/shill/default.nix @@ -9,6 +9,7 @@ internal = { name = "shill-vm"; altNames = [ "ctr" ]; + domain = lib.my.colony.domain; ipv4.address = "${lib.my.colony.start.vms.v4}2"; ipv6 = { iid = "::2"; @@ -35,8 +36,6 @@ config = mkMerge [ { - networking.domain = lib.my.colony.domain; - boot.kernelParams = [ "console=ttyS0,115200n8" ]; fileSystems = { "/boot" = { diff --git a/nixos/default.nix b/nixos/default.nix index 53b3c96..2cdaa78 100644 --- a/nixos/default.nix +++ b/nixos/default.nix @@ -1,8 +1,8 @@ { lib, pkgsFlakes, hmFlakes, inputs, pkgs', config, ... }: let inherit (builtins) attrValues mapAttrs; - inherit (lib) substring flatten optional optionals mkDefault mkForce mkOption mkOptionType; - inherit (lib.my) naiveIPv4Gateway homeStateVersion mkOpt' mkBoolOpt' commonOpts inlineModule'; + inherit (lib) substring flatten optional optionals mkIf mkDefault mkForce mkOption mkOptionType; + inherit (lib.my) naiveIPv4Gateway homeStateVersion mkOpt' mkBoolOpt' mkDefault' commonOpts inlineModule'; cfg = config.nixos; @@ -50,7 +50,10 @@ let }; system.name = name; - networking.hostName = mkDefault (config'.assignments.internal.name or name); + networking = { + domain = let d = config'.assignments.internal.domain; in mkIf (d != null) (mkDefault' d); + hostName = mkDefault (config'.assignments.internal.name or name); + }; nixpkgs = { inherit (config') system; # Make sure any previously set overlays (e.g. lib which will be inherited by home-manager down the @@ -94,6 +97,7 @@ let name = mkOpt' str name "Name of assignment."; altNames = mkOpt' (listOf str) [ ] "Extra names to assign."; visible = mkBoolOpt' true "Whether or not this assignment should be visible."; + domain = mkOpt' (nullOr str) null "Domain for this assignment."; ipv4 = { address = mkOpt' str null "IPv4 address."; mask = mkOpt' ints.u8 24 "Network mask.";