nosql-workbench: unpack with 7zz

This commit is contained in:
Weijia Wang 2024-02-29 05:32:22 +01:00
parent 0858160853
commit f80431b147

View file

@ -4,7 +4,7 @@
fetchurl,
jdk21,
stdenv,
undmg
_7zz
}:
let
pname = "nosql-workbench";
@ -39,30 +39,19 @@ if stdenv.isDarwin then stdenv.mkDerivation {
sourceRoot = ".";
nativeBuildInputs = [ _7zz ];
buildInputs = [ jdk21 ];
# DMG file is using APFS which is unsupported by "undmg".
# Fix found: https://discourse.nixos.org/t/help-with-error-only-hfs-file-systems-are-supported-on-ventura/25873/8
# Instead, use "7zz" to extract the contents.
# "undmg" issue: https://github.com/matthewbauer/undmg/issues/4
unpackCmd = ''
echo "Creating temp directory"
mnt=$(TMPDIR=/tmp mktemp -d -t nix-XXXXXXXXXX)
runHook preUnpack
function finish {
echo "Ejecting temp directory"
/usr/bin/hdiutil detach $mnt -force
rm -rf $mnt
}
# Detach volume when receiving SIG "0"
trap finish EXIT
7zz x $curSrc
# Mount DMG file
echo "Mounting DMG file into \"$mnt\""
/usr/bin/hdiutil attach -nobrowse -mountpoint $mnt $curSrc
# Copy content to local dir for later use
echo 'Copying extracted content into "sourceRoot"'
cp -a $mnt/NoSQL\ Workbench.app $PWD/
runHook postUnpack
'';
installPhase = ''