nixos/systemd-boot: guard assertion messages against eval failures

These messages should be able to be printed in all cases. In particular, trying to coerce a `null` to a string is an error unless passed through `toString`.
This commit is contained in:
Philip Taron
2024-06-18 11:30:16 -07:00
parent 7d329d1a9e
commit faa579e444

View File

@@ -323,15 +323,15 @@ in {
assertions = [ assertions = [
{ {
assertion = (hasPrefix "/" efi.efiSysMountPoint); assertion = (hasPrefix "/" efi.efiSysMountPoint);
message = "The ESP mount point '${efi.efiSysMountPoint}' must be an absolute path"; message = "The ESP mount point '${toString efi.efiSysMountPoint}' must be an absolute path";
} }
{ {
assertion = cfg.xbootldrMountPoint == null || (hasPrefix "/" cfg.xbootldrMountPoint); assertion = cfg.xbootldrMountPoint == null || (hasPrefix "/" cfg.xbootldrMountPoint);
message = "The XBOOTLDR mount point '${cfg.xbootldrMountPoint}' must be an absolute path"; message = "The XBOOTLDR mount point '${toString cfg.xbootldrMountPoint}' must be an absolute path";
} }
{ {
assertion = cfg.xbootldrMountPoint != efi.efiSysMountPoint; assertion = cfg.xbootldrMountPoint != efi.efiSysMountPoint;
message = "The XBOOTLDR mount point '${cfg.xbootldrMountPoint}' cannot be the same as the ESP mount point '${efi.efiSysMountPoint}'"; message = "The XBOOTLDR mount point '${toString cfg.xbootldrMountPoint}' cannot be the same as the ESP mount point '${toString efi.efiSysMountPoint}'";
} }
{ {
assertion = (config.boot.kernelPackages.kernel.features or { efiBootStub = true; }) ? efiBootStub; assertion = (config.boot.kernelPackages.kernel.features or { efiBootStub = true; }) ? efiBootStub;