Unverified Commit 4066d84d authored by Felix Bühler's avatar Felix Bühler Committed by GitHub
Browse files

m1n1: 1.4.21 → 1.5.0; add check phase; add branding (#430738)

parents 10d392c7 fd8c443c
Loading
Loading
Loading
Loading
+44 −2
Original line number Diff line number Diff line
@@ -4,19 +4,27 @@
  fetchFromGitHub,
  imagemagick,
  source-code-pro,
  python3Packages,
  nix-update-script,
  nixos-icons,
  withBranding ? true,
}:
stdenv.mkDerivation (finalAttrs: {
  pname = "m1n1";
  version = "1.4.21";
  version = "1.5.0";

  src = fetchFromGitHub {
    owner = "AsahiLinux";
    repo = "m1n1";
    tag = "v${finalAttrs.version}";
    hash = "sha256-0ZnDexY/Sf2TJFfUv/YelCctFJVENffWqBU0r0azD0M=";
    hash = "sha256-J1PZVaEdI6gx/qzsoVW1ehRQ/ZDKzdC1NgIGgBqxQ+0=";
  };

  postPatch = lib.optionalString withBranding ''
    ln -s ${nixos-icons}/share/icons/hicolor/128x128/apps/nix-snowflake.png data/custom_128.png
    ln -s ${nixos-icons}/share/icons/hicolor/256x256/apps/nix-snowflake.png data/custom_256.png
  '';

  nativeBuildInputs = [
    imagemagick
  ];
@@ -32,6 +40,7 @@ stdenv.mkDerivation (finalAttrs: {
  makeFlags = [
    "ARCH=${stdenv.cc.targetPrefix}"
    "RELEASE=1"
    (lib.optionalString withBranding "LOGO=custom")
  ];

  enableParallelBuilding = true;
@@ -47,12 +56,45 @@ stdenv.mkDerivation (finalAttrs: {
    runHook postInstall
  '';

  doCheck = stdenv.buildPlatform.canExecute stdenv.hostPlatform;

  nativeCheckInputs = with python3Packages; [
    pytest
  ];

  checkInputs = with python3Packages; [
    construct
    pyserial
  ];

  checkPhase = ''
    runHook preCheck

    pytest

    runHook postCheck
  '';

  passthru = {
    updateScript = nix-update-script { };
  };

  meta = {
    description = "Bootloader to bridge the Apple (XNU) boot to Linux boot";
    longDescription = ''
      m1n1 is the bootloader developed by the Asahi Linux project to
      bridge the Apple (XNU) boot ecosystem to the Linux boot ecosystem.

      What it does:

      - Initializes hardware
      - Puts up a pretty Nix logo
      - Loads embedded (appended) payloads, which can be:
         - Device Trees (FDTs), with automatic selection based on the platform
         - Initramfs images (compressed CPIO archives)
         - Kernel images in Linux ARM64 boot format (optionally compressed)
         - Configuration statements
    '';
    homepage = "https://github.com/AsahiLinux/m1n1";
    changelog = "https://github.com/AsahiLinux/m1n1/releases/tag/${finalAttrs.src.tag}";
    license = with lib.licenses; [