Merge pull request #143065 from arkivm/gitkraken-darwin

gitkraken: add darwin support
This commit is contained in:
Domen Kožar 2021-11-14 08:50:24 -06:00 committed by GitHub
commit 8d45efbdac
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -3,114 +3,141 @@
, libX11, libXi, libxcb, libXext, libXcursor, glib, libXScrnSaver, libxkbfile, libXtst , libX11, libXi, libxcb, libXext, libXcursor, glib, libXScrnSaver, libxkbfile, libXtst
, nss, nspr, cups, fetchzip, expat, gdk-pixbuf, libXdamage, libXrandr, dbus , nss, nspr, cups, fetchzip, expat, gdk-pixbuf, libXdamage, libXrandr, dbus
, makeDesktopItem, openssl, wrapGAppsHook, at-spi2-atk, at-spi2-core, libuuid , makeDesktopItem, openssl, wrapGAppsHook, at-spi2-atk, at-spi2-core, libuuid
, e2fsprogs, krb5, libdrm, mesa , e2fsprogs, krb5, libdrm, mesa, unzip, copyDesktopItems
}: }:
with lib; with lib;
let let
curlWithGnuTls = curl.override { gnutlsSupport = true; sslSupport = false; }; curlWithGnuTls = curl.override { gnutlsSupport = true; sslSupport = false; };
in
stdenv.mkDerivation rec {
pname = "gitkraken"; pname = "gitkraken";
version = "8.1.0"; version = "8.1.0";
src = fetchzip { throwSystem = throw "Unsupported system: ${stdenv.hostPlatform.system}";
url = "https://release.axocdn.com/linux/GitKraken-v${version}.tar.gz";
sha256 = "1115616d642chnisil7gv6fxw699sryphrfrp92cq3vi6lcwqbn8"; srcs = {
x86_64-linux = fetchzip {
url = "https://release.axocdn.com/linux/GitKraken-v${version}.tar.gz";
sha256 = "sha256-yC7MGTVxD8xEutlleH3WKRnendnv0KijhUwQ00wwJYQ";
};
x86_64-darwin = fetchzip {
url = "https://release.axocdn.com/darwin/GitKraken-v${version}.zip";
sha256 = "sha256-SP+LCsxjl5YNOu4rDZOiDIqkynGE+iiLJtxi8tFugKM=";
};
aarch64-darwin = srcs.x86_64-darwin;
}; };
dontBuild = true; src = srcs.${stdenv.hostPlatform.system} or throwSystem;
dontConfigure = true;
libPath = makeLibraryPath [
stdenv.cc.cc.lib
curlWithGnuTls
udev
libX11
libXext
libXcursor
libXi
libxcb
glib
libXScrnSaver
libxkbfile
libXtst
nss
nspr
cups
alsa-lib
expat
gdk-pixbuf
dbus
libXdamage
libXrandr
atk
pango
cairo
freetype
fontconfig
libXcomposite
libXfixes
libXrender
gtk3
libgnome-keyring
openssl
at-spi2-atk
at-spi2-core
libuuid
e2fsprogs
krb5
libdrm
mesa
];
desktopItem = makeDesktopItem {
name = pname;
exec = "gitkraken";
icon = "gitkraken";
desktopName = "GitKraken";
genericName = "Git Client";
categories = "Development;";
comment = "Graphical Git client from Axosoft";
};
nativeBuildInputs = [ makeWrapper wrapGAppsHook ];
buildInputs = [ gtk3 gnome.adwaita-icon-theme ];
installPhase = ''
runHook preInstall
mkdir -p $out/share/gitkraken/
cp -R $src/* $out/share/gitkraken/
mkdir -p $out/bin
ln -s $out/share/gitkraken/gitkraken $out/bin/gitkraken
mkdir -p $out/share/applications
ln -s ${desktopItem}/share/applications/* $out/share/applications
mkdir -p $out/share/pixmaps
cp gitkraken.png $out/share/pixmaps/gitkraken.png
runHook postInstall
'';
postFixup = ''
pushd $out/share/gitkraken
patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" gitkraken
for file in $(find . -type f \( -name \*.node -o -name gitkraken -o -name \*.so\* \) ); do
patchelf --set-rpath ${libPath}:$out/share/gitkraken $file || true
done
popd
'';
meta = { meta = {
homepage = "https://www.gitkraken.com/"; homepage = "https://www.gitkraken.com/";
description = "The downright luxurious and most popular Git client for Windows, Mac & Linux"; description = "The downright luxurious and most popular Git client for Windows, Mac & Linux";
license = licenses.unfree; license = licenses.unfree;
platforms = platforms.linux; platforms = builtins.attrNames srcs;
maintainers = with maintainers; [ xnwdd evanjs ]; maintainers = with maintainers; [ xnwdd evanjs arkivm ];
}; };
}
linux = stdenv.mkDerivation rec {
inherit pname version src meta;
dontBuild = true;
dontConfigure = true;
libPath = makeLibraryPath [
stdenv.cc.cc.lib
curlWithGnuTls
udev
libX11
libXext
libXcursor
libXi
libxcb
glib
libXScrnSaver
libxkbfile
libXtst
nss
nspr
cups
alsa-lib
expat
gdk-pixbuf
dbus
libXdamage
libXrandr
atk
pango
cairo
freetype
fontconfig
libXcomposite
libXfixes
libXrender
gtk3
libgnome-keyring
openssl
at-spi2-atk
at-spi2-core
libuuid
e2fsprogs
krb5
libdrm
mesa
];
desktopItems = [ (makeDesktopItem {
name = pname;
exec = pname;
icon = pname;
desktopName = "GitKraken";
genericName = "Git Client";
categories = "Development;";
comment = "Graphical Git client from Axosoft";
}) ];
nativeBuildInputs = [ copyDesktopItems makeWrapper wrapGAppsHook ];
buildInputs = [ gtk3 gnome.adwaita-icon-theme ];
installPhase = ''
runHook preInstall
mkdir -p $out/share/${pname}/
cp -R $src/* $out/share/${pname}
mkdir -p $out/bin
ln -s $out/share/${pname}/${pname} $out/bin/
mkdir -p $out/share/pixmaps
cp ${pname}.png $out/share/pixmaps/${pname}.png
runHook postInstall
'';
postFixup = ''
pushd $out/share/${pname}
patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" ${pname}
for file in $(find . -type f \( -name \*.node -o -name ${pname} -o -name \*.so\* \) ); do
patchelf --set-rpath ${libPath}:$out/share/${pname} $file || true
done
popd
'';
};
darwin = stdenv.mkDerivation {
inherit pname version src meta;
nativeBuildInputs = [ unzip ];
installPhase = ''
mkdir -p $out/Applications/GitKraken.app
cp -R . $out/Applications/GitKraken.app
'';
};
in
if stdenv.isDarwin
then darwin
else linux