Merge pull request #92 from nix-community/module-config

module: define only if devices are given
This commit is contained in:
Jörg Thalheim 2022-12-25 21:27:52 +00:00 committed by GitHub
commit f665b6b34d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

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