diff --git a/nixos/modules/system/boot/loader/grub/grub.nix b/nixos/modules/system/boot/loader/grub/grub.nix index 9c36651d6874..81f94e8639d9 100644 --- a/nixos/modules/system/boot/loader/grub/grub.nix +++ b/nixos/modules/system/boot/loader/grub/grub.nix @@ -712,9 +712,9 @@ in (mkIf cfg.enable { - boot.loader.grub.devices = optional (cfg.device != "") cfg.device; + boot.loader.grub.devices = mkIf (cfg.device != "") [ cfg.device ]; - boot.loader.grub.mirroredBoots = optionals (cfg.devices != [ ]) [ + boot.loader.grub.mirroredBoots = mkIf (cfg.devices != [ ]) [ { path = "/boot"; inherit (cfg) devices; inherit (efi) efiSysMountPoint; } ]; @@ -752,7 +752,7 @@ in # set at once. system.boot.loader.id = "grub"; - environment.systemPackages = optional (grub != null) grub; + environment.systemPackages = mkIf (grub != null) [ grub ]; boot.loader.grub.extraPrepareConfig = concatStrings (mapAttrsToList (n: v: ''