nixpkgs/pkgs/applications/networking/instant-messengers/caprine-bin/build-from-dmg.nix
2022-01-16 22:09:18 +00:00

36 lines
719 B
Nix

{ stdenvNoCC
, lib
, fetchurl
, undmg
, pname
, version
, sha256
, metaCommon ? { }
}:
stdenvNoCC.mkDerivation {
inherit pname version;
src = fetchurl {
url = "https://github.com/sindresorhus/caprine/releases/download/v${version}/Caprine-${version}.dmg";
name = "Caprine-${version}.dmg";
inherit sha256;
};
sourceRoot = "Caprine.app";
nativeBuildInputs = [ undmg ];
installPhase = ''
mkdir -p "$out/Applications/Caprine.app"
cp -R . "$out/Applications/Caprine.app"
mkdir "$out/bin"
ln -s "$out/Applications/Caprine.app/Contents/MacOS/Caprine" "$out/bin/caprine"
'';
meta = metaCommon // {
platforms = with lib.platforms; darwin;
mainProgram = "caprine";
};
}