From 88e78d1602740c6116e84aad8e0ee7c4830828a8 Mon Sep 17 00:00:00 2001 From: centra Date: Sat, 21 Mar 2026 16:42:33 +0900 Subject: [PATCH] Add commissioning facts and PXE bootstrap wiring --- nix/modules/install-target.nix | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 nix/modules/install-target.nix diff --git a/nix/modules/install-target.nix b/nix/modules/install-target.nix new file mode 100644 index 0000000..0778ea5 --- /dev/null +++ b/nix/modules/install-target.nix @@ -0,0 +1,32 @@ +{ config, lib, options, ... }: + +let + hostName = config.networking.hostName; + hasClusterModule = lib.hasAttrByPath [ "plasmacloud" "cluster" "enable" ] options; + clusterNode = + if hasClusterModule && config.plasmacloud.cluster.enable && config.plasmacloud.cluster.nodes ? "${hostName}" then + config.plasmacloud.cluster.nodes.${hostName} + else + null; + clusterInstallPlan = + if clusterNode != null then + clusterNode.installPlan + else + null; + defaultDiskDevice = + if clusterInstallPlan != null && clusterInstallPlan.targetDiskById != null then + clusterInstallPlan.targetDiskById + else if clusterInstallPlan != null then + clusterInstallPlan.targetDisk + else + null; +in +{ + options.plasmacloud.install.diskDevice = lib.mkOption { + type = lib.types.nullOr lib.types.str; + default = null; + description = "Install target disk path used by Disko-enabled host configurations"; + }; + + config.plasmacloud.install.diskDevice = lib.mkDefault defaultDiskDevice; +}