rename machine type -> kind

This commit is contained in:
Pim Kunis 2024-02-29 20:13:28 +01:00
parent 45d9ab3cb7
commit 904098c877
6 changed files with 26 additions and 26 deletions

View file

@ -36,7 +36,7 @@
lib = pkgs.lib;
pkgs-unstable = nixpkgs-unstable.legacyPackages.${controllerArch};
machines = (lib.modules.evalModules { modules = [ (import ./nixos/machines) ]; }).config.machines;
physicalMachines = lib.filterAttrs (n: v: v.type == "physical") machines;
physicalMachines = lib.filterAttrs (n: v: v.kind == "physical") machines;
mkNixosSystems = systemDef:
builtins.mapAttrs
(name: machine:

View file

@ -6,8 +6,8 @@
disko.nixosModules.disko
agenix.nixosModules.default
]
++ lib.lists.optional (machine.type == "physical") ./physical.nix
++ lib.lists.optional (machine.type == "virtual") ./virtual;
++ lib.lists.optional (machine.kind == "physical") ./physical.nix
++ lib.lists.optional (machine.kind == "virtual") ./virtual;
config = {
time.timeZone = "Europe/Amsterdam";
@ -15,16 +15,16 @@
i18n = {
defaultLocale = "en_US.UTF-8";
extraLocaleSettings = {
LC_ADDRESS = "nl_NL.UTF-8";
LC_IDENTIFICATION = "nl_NL.UTF-8";
LC_MEASUREMENT = "nl_NL.UTF-8";
LC_MONETARY = "nl_NL.UTF-8";
LC_NAME = "nl_NL.UTF-8";
LC_NUMERIC = "nl_NL.UTF-8";
LC_PAPER = "nl_NL.UTF-8";
LC_TELEPHONE = "nl_NL.UTF-8";
LC_TIME = "nl_NL.UTF-8";
extraLocaleSettings = let extraLocale = "nl_NL.UTF-8"; in {
LC_ADDRESS = extraLocale;
LC_IDENTIFICATION = extraLocale;
LC_MEASUREMENT = extraLocale;
LC_MONETARY = extraLocale;
LC_NAME = extraLocale;
LC_NUMERIC = extraLocale;
LC_PAPER = extraLocale;
LC_TELEPHONE = extraLocale;
LC_TIME = extraLocale;
};
};

View file

@ -3,7 +3,7 @@ let
machineOpts = { ... }: {
options = {
# TODO: rename to kind?
type = lib.mkOption {
kind = lib.mkOption {
type = lib.types.enum [ "physical" "virtual" ];
description = ''
Whether this machine is physical or virtual.
@ -56,7 +56,7 @@ in
config = {
machines = {
warwick = {
type = "physical";
kind = "physical";
arch = "aarch64-linux";
isRaspberryPi = true;
@ -68,7 +68,7 @@ in
};
atlas = {
type = "physical";
kind = "physical";
arch = "x86_64-linux";
isHypervisor = true;
@ -87,7 +87,7 @@ in
};
jefke = {
type = "physical";
kind = "physical";
arch = "x86_64-linux";
isHypervisor = true;
@ -106,7 +106,7 @@ in
};
lewis = {
type = "physical";
kind = "physical";
arch = "x86_64-linux";
isHypervisor = true;
@ -129,7 +129,7 @@ in
};
hermes = {
type = "virtual";
kind = "virtual";
hypervisorName = "lewis";
nixosModule = { hypervisorConfig, ... }: {
@ -156,7 +156,7 @@ in
};
maestro = {
type = "virtual";
kind = "virtual";
hypervisorName = "atlas";
nixosModule = { config, ... }: {
@ -173,7 +173,7 @@ in
};
bancomart = {
type = "virtual";
kind = "virtual";
hypervisorName = "jefke";
nixosModule = {
@ -187,7 +187,7 @@ in
};
vpay = {
type = "virtual";
kind = "virtual";
hypervisorName = "lewis";
nixosModule = {

View file

@ -48,7 +48,7 @@ in {
config = {
networking = {
domain = if machine.type == "physical" then "hyp" else "dmz";
domain = if machine.kind == "physical" then "hyp" else "dmz";
nftables.enable = true;
useDHCP = false;
@ -117,7 +117,7 @@ in {
networkConfig.Bridge = cfg.dmz.bridgeName;
};
})
(lib.optionalAttrs (machine.type == "virtual") {
(lib.optionalAttrs (machine.kind == "virtual") {
"30-main-nic" = {
matchConfig.Name = "en*";

View file

@ -57,7 +57,7 @@
microvm.vms =
let
vmsForHypervisor = lib.filterAttrs (n: v: v.type == "virtual" && v.hypervisorName == config.networking.hostName) machines;
vmsForHypervisor = lib.filterAttrs (n: v: v.kind == "virtual" && v.hypervisorName == config.networking.hostName) machines;
in
builtins.mapAttrs
(name: vm:

View file

@ -12,7 +12,7 @@ in
};
config = lib.mkIf cfg.enable {
lab.vm.shares = lib.mkIf (machine.type == "virtual") [{
lab.vm.shares = lib.mkIf (machine.kind == "virtual") [{
name = "docker";
mountPoint = "/var/lib/docker";
}];