Change:
The systemd-boot efi binary produced by pkgsMusl.systemd does not boot. This is particularly evil, because it is a runtime failure (pkgsMusl.systemd builds fine) and it occurs before the nixos generation selection, so effectively it will brick the installation. Also the BOOTX64.EFI is only update on a systemd version change, not every time the file changes. So users might think they have successfully booted with one systemd-boot, but actually it was not copied over to the boot partition because the existing file there was already from the same systemd version. A.k.a. we should fix pkgsMusl.nixosTests.systemd-
When I port over the gummiboot package from alpine, it builds and boots
Bisected this, first within nixpkgs: Then within systemd: In the end, it builds and boots even in later versions when removing the parameter again:
Openembedded does not have this problem because they use clang, not gcc. With a few hacks I could build a systemd-boot from pkgsMusl.pkgsLLVM and this booted without patching out the .

Discussion:
, withCoredump ? true , withCryptsetup ? true , withDocumentation ? true <del> , withEfi ? stdenv.hostPlatform.isEfi && !stdenv.hostPlatform.isMusl </del> <ins> , withEfi ? stdenv.hostPlatform.isEfi </ins> , withFido2 ? true , withHomed ? !stdenv.hostPlatform.isMusl , withHostnamed ? true

] ++ lib.optional stdenv.hostPlatform.isMusl ( let oe-core = fetchzip { <del> url = "https://git.openembedded.org/openembedded-core/snapshot/openembedded-core-cccd4bcaf381c2729adc000381bd89906003e72a.tar.gz"; sha256 = "2CFZEzWqUy6OOF3c+LN4Zmy3RqMzfdRHp+B5zlWJsoE="; </del> <ins> url = "https://git.openembedded.org/openembedded-core/snapshot/openembedded-core-f34f6ab04b443608497b73668365819343d0c2fe.tar.gz"; sha256 = "DFcLPvjQIxGEDADpP232ZRd7cOEKt6B48Ah29nIGTt4="; </ins> }; musl-patches = oe-core + "/meta/recipes-core/systemd/systemd"; in [ <del> (musl-patches + "/0003-missing_type.h-add-comparison_fn_t.patch") (musl-patches + "/0004-add-fallback-parse_printf_format-implementation.patch") (musl-patches + "/0005-src-basic-missing.h-check-for-missing-strndupa.patch") (musl-patches + "/0007-don-t-fail-if-GLOB_BRACE-and-GLOB_ALTDIRFUNC-is-not-.patch") (musl-patches + "/0008-add-missing-FTW_-macros-for-musl.patch") (musl-patches + "/0010-Use-uintmax_t-for-handling-rlim_t.patch") (musl-patches + "/0011-test-sizeof.c-Disable-tests-for-missing-typedefs-in-.patch") (musl-patches + "/0012-don-t-pass-AT_SYMLINK_NOFOLLOW-flag-to-faccessat.patch") (musl-patches + "/0013-Define-glibc-compatible-basename-for-non-glibc-syste.patch") (musl-patches + "/0014-Do-not-disable-buffering-when-writing-to-oom_score_a.patch") (musl-patches + "/0015-distinguish-XSI-compliant-strerror_r-from-GNU-specif.patch") (musl-patches + "/0018-avoid-redefinition-of-prctl_mm_map-structure.patch") (musl-patches + "/0022-do-not-disable-buffer-in-writing-files.patch") (musl-patches + "/0025-Handle-__cpu_mask-usage.patch") (musl-patches + "/0026-Handle-missing-gshadow.patch") (musl-patches + "/0028-missing_syscall.h-Define-MIPS-ABI-defines-for-musl.patch") (musl-patches + "/0001-pass-correct-parameters-to-getdents64.patch") (musl-patches + "/0002-Add-sys-stat.h-for-S_IFDIR.patch") </del> (musl-patches + "/0001-Adjust-for-musl-headers.patch") <del> (musl-patches + "/0001-test-bus-error-strerror-is-assumed-to-be-GNU-specifi.patch") </del> <ins> (musl-patches + "/0005-pass-correct-parameters-to-getdents64.patch") (musl-patches + "/0006-test-bus-error-strerror-is-assumed-to-be-GNU-specifi.patch") (musl-patches + "/0007-Add-sys-stat.h-for-S_IFDIR.patch") (musl-patches + "/0009-missing_type.h-add-comparison_fn_t.patch") (musl-patches + "/0010-add-fallback-parse_printf_format-implementation.patch") (musl-patches + "/0011-src-basic-missing.h-check-for-missing-strndupa.patch") (musl-patches + "/0012-don-t-fail-if-GLOB_BRACE-and-GLOB_ALTDIRFUNC-is-not-.patch") (musl-patches + "/0013-add-missing-FTW_-macros-for-musl.patch") (musl-patches + "/0014-Use-uintmax_t-for-handling-rlim_t.patch") (musl-patches + "/0015-test-sizeof.c-Disable-tests-for-missing-typedefs-in-.patch") (musl-patches + "/0016-don-t-pass-AT_SYMLINK_NOFOLLOW-flag-to-faccessat.patch") (musl-patches + "/0017-Define-glibc-compatible-basename-for-non-glibc-syste.patch") (musl-patches + "/0018-Do-not-disable-buffering-when-writing-to-oom_score_a.patch") (musl-patches + "/0019-distinguish-XSI-compliant-strerror_r-from-GNU-specif.patch") (musl-patches + "/0020-avoid-redefinition-of-prctl_mm_map-structure.patch") (musl-patches + "/0021-do-not-disable-buffer-in-writing-files.patch") (musl-patches + "/0022-Handle-__cpu_mask-usage.patch") (musl-patches + "/0023-Handle-missing-gshadow.patch") (musl-patches + "/0024-missing_syscall.h-Define-MIPS-ABI-defines-for-musl.patch") (musl-patches + "/0026-src-boot-efi-efi-string.c-define-wchar_t-from-__WCHA.patch") </ins> ] );