Unverified Commit 939e432e authored by Weijia Wang's avatar Weijia Wang Committed by GitHub
Browse files

Merge pull request #284840 from wegank/7zz-hdiutil

airbuddy, aldente: unpack with 7zz
parents 3ecb98dd 3db9eb16
Loading
Loading
Loading
Loading
+6 −9
Original line number Diff line number Diff line
{ lib
, stdenvNoCC
, fetchurl
, undmg
, _7zz
}:

stdenvNoCC.mkDerivation (finalAttrs: {
@@ -19,18 +19,15 @@ stdenvNoCC.mkDerivation (finalAttrs: {
  dontBuild = true;
  dontFixup = true;

  nativeBuildInputs = [ undmg ];
  nativeBuildInputs = [ _7zz ];

  # AirBuddy.dmg is not HFS formatted, default unpackPhase fails
  # https://discourse.nixos.org/t/help-with-error-only-hfs-file-systems-are-supported-on-ventura
  # AirBuddy.dmg is APFS formatted, unpack with 7zz
  unpackCmd = ''
    mnt=$(mktemp -d)
    runHook preUnpack

    /usr/bin/hdiutil attach -nobrowse -readonly $src -mountpoint $mnt
    7zz x $src

    shopt -s extglob
    DEST="$PWD"
    (cd "$mnt"; cp -a !(Applications) "$DEST/")
    runHook postUnpack
  '';

  sourceRoot = "AirBuddy.app";
+6 −15
Original line number Diff line number Diff line
{ lib
, stdenvNoCC
, fetchurl
, undmg
, _7zz
}:

stdenvNoCC.mkDerivation (finalAttrs: {
@@ -16,24 +16,15 @@ stdenvNoCC.mkDerivation (finalAttrs: {
  dontBuild = true;
  dontFixup = true;

  nativeBuildInputs = [ undmg ];
  nativeBuildInputs = [ _7zz ];

  # AlDente.dmg is not HFS formatted, default unpackPhase fails
  # https://discourse.nixos.org/t/help-with-error-only-hfs-file-systems-are-supported-on-ventura
  # AlDente.dmg is APFS formatted, unpack with 7zz
  unpackCmd = ''
    if ! [[ "$curSrc" =~ \.dmg$ ]]; then return 1; fi
    mnt=$(mktemp -d -t ci-XXXXXXXXXX)
    runHook preUnpack

    function finish {
      /usr/bin/hdiutil detach $mnt -force
    }
    trap finish EXIT
    7zz x $src

    /usr/bin/hdiutil attach -nobrowse -readonly $src -mountpoint $mnt

    shopt -s extglob
    DEST="$PWD"
    (cd "$mnt"; cp -a !(Applications) "$DEST/")
    runHook postUnpack
  '';

  sourceRoot = "AlDente.app";