|
| 1 | +{ |
| 2 | + lib, |
| 3 | + stdenv, |
| 4 | + fetchFromGitHub, |
| 5 | + imagemagick, |
| 6 | + source-code-pro, |
| 7 | + nix-update-script, |
| 8 | +}: |
| 9 | +stdenv.mkDerivation (finalAttrs: { |
| 10 | + pname = "m1n1"; |
| 11 | + version = "1.4.21"; |
| 12 | + |
| 13 | + src = fetchFromGitHub { |
| 14 | + owner = "AsahiLinux"; |
| 15 | + repo = "m1n1"; |
| 16 | + tag = "v${finalAttrs.version}"; |
| 17 | + hash = "sha256-0ZnDexY/Sf2TJFfUv/YelCctFJVENffWqBU0r0azD0M="; |
| 18 | + }; |
| 19 | + |
| 20 | + nativeBuildInputs = [ |
| 21 | + imagemagick |
| 22 | + ]; |
| 23 | + |
| 24 | + postConfigure = '' |
| 25 | + patchShebangs --build font/makefont.sh |
| 26 | + FONT_PATH=${source-code-pro}/share/fonts/opentype/SourceCodePro-Bold.otf |
| 27 | + rm font/{SourceCodePro-Bold.ttf,font.bin,font_retina.bin} |
| 28 | + ./font/makefont.sh 8 16 12 $FONT_PATH font/font.bin |
| 29 | + ./font/makefont.sh 16 32 25 $FONT_PATH font/font_retina.bin |
| 30 | + ''; |
| 31 | + |
| 32 | + makeFlags = [ |
| 33 | + "ARCH=${stdenv.cc.targetPrefix}" |
| 34 | + "RELEASE=1" |
| 35 | + ]; |
| 36 | + |
| 37 | + enableParallelBuilding = true; |
| 38 | + |
| 39 | + installPhase = '' |
| 40 | + runHook preInstall |
| 41 | +
|
| 42 | + install -Dm644 build/m1n1.bin -t $out/lib/m1n1/ |
| 43 | +
|
| 44 | + install -Dm644 3rdparty_licenses/LICENSE.* -t $out/share/doc/m1n1/licenses/ |
| 45 | + install -Dm644 LICENSE -t $out/share/doc/m1n1/licenses/ |
| 46 | +
|
| 47 | + runHook postInstall |
| 48 | + ''; |
| 49 | + |
| 50 | + passthru = { |
| 51 | + updateScript = nix-update-script { }; |
| 52 | + }; |
| 53 | + |
| 54 | + meta = { |
| 55 | + description = "Bootloader to bridge the Apple (XNU) boot to Linux boot"; |
| 56 | + homepage = "https://github.com/AsahiLinux/m1n1"; |
| 57 | + changelog = "https://github.com/AsahiLinux/m1n1/releases/tag/${finalAttrs.src.tag}"; |
| 58 | + license = with lib.licenses; [ |
| 59 | + # m1n1 embeds several libraries, all of which cannot be |
| 60 | + # unvendored easily. |
| 61 | + |
| 62 | + # m1n1, minlzma, musl-libc |
| 63 | + mit |
| 64 | + # libfdt: dual BSD2 and GPL-2-or-later |
| 65 | + # tinf: zlib |
| 66 | + # arm-trusted-firmware: BSD3 |
| 67 | + # dlmalloc: CC0 |
| 68 | + # PDCLib: CC0 |
| 69 | + # Source Code Pro: OFL1.1 |
| 70 | + # dwc3: BSD3 and GPL-2-or-later |
| 71 | + cc0 |
| 72 | + ofl |
| 73 | + zlib |
| 74 | + bsd2 |
| 75 | + gpl2Plus |
| 76 | + bsd3 |
| 77 | + asl20 |
| 78 | + ]; |
| 79 | + maintainers = with lib.maintainers; [ normalcea ]; |
| 80 | + platforms = lib.platforms.aarch64; |
| 81 | + }; |
| 82 | +}) |
0 commit comments