32 lines
1,018 B
Nix
32 lines
1,018 B
Nix
{ 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;
|
|
}
|