fix: module: define only if devices are given

This commit is contained in:
lassulus 2022-12-27 18:47:49 +01:00
parent 1006ff074c
commit df3a607ad7

View File

@ -5,8 +5,8 @@ let
in { in {
options.disko = { options.disko = {
devices = lib.mkOption { devices = lib.mkOption {
type = lib.types.nullOr types.devices; type = types.devices;
default = null; default = {};
}; };
enableConfig = lib.mkOption { enableConfig = lib.mkOption {
description = '' description = ''
@ -18,7 +18,7 @@ in {
default = true; default = true;
}; };
}; };
config = lib.mkIf (cfg.devices != null) { config = lib.mkIf (cfg.devices.disk != {}) {
system.build.formatScript = pkgs.writers.writeDash "disko-create" '' system.build.formatScript = pkgs.writers.writeDash "disko-create" ''
export PATH=${lib.makeBinPath (types.diskoLib.packages cfg.devices pkgs)}:$PATH export PATH=${lib.makeBinPath (types.diskoLib.packages cfg.devices pkgs)}:$PATH
${types.diskoLib.create cfg.devices} ${types.diskoLib.create cfg.devices}