Some checks failed
Periodic Merges (6h) / master → staging-nixos (push) Failing after 12m50s
Periodic Merges (6h) / master → staging-next (push) Failing after 12m54s
Periodic Merges (24h) / merge-base(master,staging) → haskell-updates (push) Failing after 11m54s
Periodic Merges (6h) / staging-next → staging (push) Failing after 12m13s
Periodic Merges (24h) / staging-next-25.05 → staging-25.05 (push) Failing after 13m24s
Periodic Merges (24h) / release-25.05 → staging-next-25.05 (push) Failing after 14m28s
54 lines
1.3 KiB
Nix
54 lines
1.3 KiB
Nix
{
|
|
stdenv,
|
|
fetchurl,
|
|
undmg,
|
|
meta,
|
|
pname,
|
|
version,
|
|
url,
|
|
hash,
|
|
passthru,
|
|
}:
|
|
stdenv.mkDerivation {
|
|
inherit meta pname version;
|
|
|
|
src = fetchurl {
|
|
inherit url hash;
|
|
};
|
|
|
|
nativeBuildInputs = [ undmg ];
|
|
|
|
sourceRoot = ".";
|
|
|
|
installPhase = ''
|
|
runHook preInstall
|
|
mkdir -p $out/Applications
|
|
cp -r *.app $out/Applications
|
|
runHook postInstall
|
|
'';
|
|
|
|
# LM Studio ships Scripts inside the App Bundle, which may be messed up by standard fixups
|
|
dontFixup = true;
|
|
|
|
# undmg doesn't support APFS and 7zz does break the xattr. Took that approach from https://github.com/NixOS/nixpkgs/blob/a3c6ed7ad2649c1a55ffd94f7747e3176053b833/pkgs/by-name/in/insomnia/package.nix#L52
|
|
unpackCmd = ''
|
|
echo "Creating temp directory"
|
|
mnt=$(TMPDIR=/tmp mktemp -d -t nix-XXXXXXXXXX)
|
|
function finish {
|
|
echo "Ejecting temp directory"
|
|
/usr/bin/hdiutil detach $mnt -force
|
|
rm -rf $mnt
|
|
}
|
|
# Detach volume when receiving SIG "0"
|
|
trap finish EXIT
|
|
# 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/LM\ Studio.app $PWD/
|
|
'';
|
|
|
|
inherit passthru;
|
|
}
|