Merge pull request #222080 from Stunkymonkey/nixos-optionalString

This commit is contained in:
Artturi
2023-04-20 16:07:30 +03:00
committed by GitHub
41 changed files with 89 additions and 95 deletions

View File

@@ -33,7 +33,7 @@ let
then realGrub.override { efiSupport = cfg.efiSupport; }
else null;
f = x: if x == null then "" else "" + x;
f = x: optionalString (x != null) ("" + x);
grubConfig = args:
let
@@ -52,7 +52,7 @@ let
fullName = lib.getName realGrub;
fullVersion = lib.getVersion realGrub;
grubEfi = f grubEfi;
grubTargetEfi = if cfg.efiSupport && (cfg.version == 2) then f (grubEfi.grubTarget or "") else "";
grubTargetEfi = optionalString (cfg.efiSupport && (cfg.version == 2)) (f (grubEfi.grubTarget or ""));
bootPath = args.path;
storePath = config.boot.loader.grub.storePath;
bootloaderId = if args.efiBootloaderId == null then "${config.system.nixos.distroName}${efiSysMountPoint'}" else args.efiBootloaderId;

View File

@@ -20,7 +20,7 @@ let
nix = config.nix.package.out;
timeout = if config.boot.loader.timeout != null then config.boot.loader.timeout else "";
timeout = optionalString (config.boot.loader.timeout != null) config.boot.loader.timeout;
editor = if cfg.editor then "True" else "False";
@@ -32,9 +32,9 @@ let
inherit (config.system.nixos) distroName;
memtest86 = if cfg.memtest86.enable then pkgs.memtest86-efi else "";
memtest86 = optionalString cfg.memtest86.enable pkgs.memtest86-efi;
netbootxyz = if cfg.netbootxyz.enable then pkgs.netbootxyz-efi else "";
netbootxyz = optionalString cfg.netbootxyz.enable pkgs.netbootxyz-efi;
copyExtraFiles = pkgs.writeShellScript "copy-extra-files" ''
empty_file=$(${pkgs.coreutils}/bin/mktemp)