diff options
author | Artturi <Artturin@artturin.com> | 2023-04-20 16:07:30 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-20 16:07:30 +0300 |
commit | b83db86a9e9ff5b07360e8917c3e007001b06f9c (patch) | |
tree | 01bc1eeb7fd3e6c17a4d3649400d8310ce691c59 /nixos/modules/system/boot/loader | |
parent | 2fc54db033c27ffb4f50e35a2079233d7280c9b9 (diff) | |
parent | 327b0cff7aedc20a148d245b1182f43800acc1f5 (diff) | |
download | nixpkgs-b83db86a9e9ff5b07360e8917c3e007001b06f9c.tar nixpkgs-b83db86a9e9ff5b07360e8917c3e007001b06f9c.tar.gz nixpkgs-b83db86a9e9ff5b07360e8917c3e007001b06f9c.tar.bz2 nixpkgs-b83db86a9e9ff5b07360e8917c3e007001b06f9c.tar.lz nixpkgs-b83db86a9e9ff5b07360e8917c3e007001b06f9c.tar.xz nixpkgs-b83db86a9e9ff5b07360e8917c3e007001b06f9c.tar.zst nixpkgs-b83db86a9e9ff5b07360e8917c3e007001b06f9c.zip |
Merge pull request #222080 from Stunkymonkey/nixos-optionalString
Diffstat (limited to 'nixos/modules/system/boot/loader')
-rw-r--r-- | nixos/modules/system/boot/loader/grub/grub.nix | 4 | ||||
-rw-r--r-- | nixos/modules/system/boot/loader/systemd-boot/systemd-boot.nix | 6 |
2 files changed, 5 insertions, 5 deletions
diff --git a/nixos/modules/system/boot/loader/grub/grub.nix b/nixos/modules/system/boot/loader/grub/grub.nix index 121d7e88e74..5c0a07fb512 100644 --- a/nixos/modules/system/boot/loader/grub/grub.nix +++ b/nixos/modules/system/boot/loader/grub/grub.nix @@ -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; diff --git a/nixos/modules/system/boot/loader/systemd-boot/systemd-boot.nix b/nixos/modules/system/boot/loader/systemd-boot/systemd-boot.nix index 757dc080d4b..8a3e89e5888 100644 --- a/nixos/modules/system/boot/loader/systemd-boot/systemd-boot.nix +++ b/nixos/modules/system/boot/loader/systemd-boot/systemd-boot.nix @@ -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) |