refactor(nix/darwin): Try both undmg and 7zz to extract dmg files

This commit is contained in:
Ahmad Ansori Palembani 2024-11-05 12:28:08 +07:00
parent bb5bb2ad82
commit be06d69dd6
Signed by: null2264
GPG key ID: BA64F8B60AF3EFB6
3 changed files with 11 additions and 9 deletions

View file

@ -1,5 +1,12 @@
# REF: https://github.com/bandithedoge/nixpkgs-firefox-darwin/blob/ceaca2359e5371ccef3f92a36baf7c438b354afb/overlay.nix
{ stdenv, undmg, pname, version, sourceRoot ? ".", appFileName, src, meta, nativeBuildInputs ? [ undmg ] }:
{ stdenv, undmg, _7zz, pname, version, sourceRoot ? ".", appFileName, src, meta
, nativeBuildInputs ? [ undmg _7zz ]
, unpackPhase ? "undmg $src || 7zz x -snld $src"
, installPhase ? ''
mkdir -p $out/Applications
cp -R ${appFileName} "$out/Applications/"
''
}:
stdenv.mkDerivation rec {
inherit pname version;
@ -9,10 +16,7 @@ stdenv.mkDerivation rec {
inherit sourceRoot;
phases = [ "unpackPhase" "installPhase" ];
installPhase = ''
mkdir -p $out/Applications
cp -R ${appFileName} "$out/Applications/"
'';
inherit unpackPhase installPhase;
inherit meta;
}

View file

@ -6,7 +6,7 @@ let
version = "1.5.0";
in {
heliport = mkApp {
inherit (final) stdenv undmg;
inherit (final) stdenv undmg _7zz;
pname = "HeliPort";
appFileName = "HeliPort.app";

View file

@ -6,14 +6,12 @@ let
version = "1.5.3";
in {
vesktop = mkApp {
inherit (final) stdenv undmg;
inherit (final) stdenv undmg _7zz;
pname = "Vesktop";
appFileName = "Vesktop*.app";
inherit version;
nativeBuildInputs = [ final._7zz ];
src = final.fetchurl {
url = "https://github.com/Vencord/Vesktop/releases/download/v${version}/Vesktop-${version}-universal.dmg";
hash = "sha256-ceOUNHSOaEqCbzkM64RtUu0Yhrq4tThcXZTDd+OsEXI";