nixpkgs/pkgs/applications/version-management/gitkraken/default.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

181 lines
5.0 KiB
Nix
Raw Normal View History

{ lib, stdenv, libXcomposite, libgnome-keyring, makeWrapper, udev, curlWithGnuTls, alsa-lib
, libXfixes, atk, gtk3, libXrender, pango, gnome, cairo, freetype, fontconfig
2018-03-01 19:05:20 +00:00
, libX11, libXi, libxcb, libXext, libXcursor, glib, libXScrnSaver, libxkbfile, libXtst
, nss, nspr, cups, fetchzip, expat, gdk-pixbuf, libXdamage, libXrandr, dbus
2023-08-19 12:04:16 +00:00
, makeDesktopItem, openssl, wrapGAppsHook, makeShellWrapper, at-spi2-atk, at-spi2-core, libuuid
2023-12-17 10:20:42 +00:00
, e2fsprogs, krb5, libdrm, mesa, unzip, copyDesktopItems, libxshmfence, libxkbcommon, git
, libGL, zlib, cacert
2017-03-05 15:38:55 +00:00
}:
2021-01-15 13:21:58 +00:00
with lib;
2017-03-24 21:01:41 +00:00
2018-03-12 17:34:46 +00:00
let
pname = "gitkraken";
2024-03-07 15:02:51 +00:00
version = "9.13.0";
2017-03-05 15:38:55 +00:00
2021-10-27 01:30:20 +00:00
throwSystem = throw "Unsupported system: ${stdenv.hostPlatform.system}";
2021-10-27 01:30:20 +00:00
srcs = {
x86_64-linux = fetchzip {
url = "https://release.axocdn.com/linux/GitKraken-v${version}.tar.gz";
2024-03-07 15:02:51 +00:00
hash = "sha256-BBTa/MhfwTZ9YUJSGt8KocPn6f7m+W8G9yJr8I4NAtw=";
2021-10-27 01:30:20 +00:00
};
2021-10-27 01:30:20 +00:00
x86_64-darwin = fetchzip {
url = "https://release.axocdn.com/darwin/GitKraken-v${version}.zip";
2024-03-07 15:02:51 +00:00
hash = "sha256-+1N4U5vV8XdHdtPeanjU38c8fzfY0uV0AA6exEe/FzQ=";
2021-10-27 01:30:20 +00:00
};
2022-02-28 20:15:30 +00:00
aarch64-darwin = fetchzip {
url = "https://release.axocdn.com/darwin-arm64/GitKraken-v${version}.zip";
2024-03-07 15:02:51 +00:00
hash = "sha256-kNX8ptDL8vvFDhH3bDU24A2xN1D+tgpzsCj/zIGqctE=";
2022-02-28 20:15:30 +00:00
};
2021-10-27 01:30:20 +00:00
};
2021-10-27 01:30:20 +00:00
src = srcs.${stdenv.hostPlatform.system} or throwSystem;
2017-03-05 15:38:55 +00:00
2017-03-24 21:01:41 +00:00
meta = {
homepage = "https://www.gitkraken.com/";
2017-03-05 15:38:55 +00:00
description = "The downright luxurious and most popular Git client for Windows, Mac & Linux";
sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
2017-03-05 15:38:55 +00:00
license = licenses.unfree;
2021-10-27 01:30:20 +00:00
platforms = builtins.attrNames srcs;
2023-12-07 17:34:18 +00:00
maintainers = with maintainers; [ xnwdd evanjs arkivm nicolas-goudry ];
2023-11-27 01:17:53 +00:00
mainProgram = "gitkraken";
2021-10-27 01:30:20 +00:00
};
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
2022-02-28 20:15:30 +00:00
libxshmfence
libxkbcommon
2023-12-17 10:20:42 +00:00
libGL
zlib
2021-10-27 01:30:20 +00:00
];
desktopItems = [ (makeDesktopItem {
2023-12-17 10:20:42 +00:00
name = "GitKraken";
exec = "gitkraken";
icon = "gitkraken";
2021-10-27 01:30:20 +00:00
desktopName = "GitKraken";
genericName = "Git Client";
categories = [ "Development" ];
2021-10-27 01:30:20 +00:00
comment = "Graphical Git client from Axosoft";
}) ];
2023-08-19 12:04:16 +00:00
nativeBuildInputs = [ copyDesktopItems (wrapGAppsHook.override { makeWrapper = makeShellWrapper; }) ];
2021-10-27 01:30:20 +00:00
buildInputs = [ gtk3 gnome.adwaita-icon-theme ];
# avoid double-wrapping
dontWrapGApps = true;
2021-10-27 01:30:20 +00:00
installPhase = ''
runHook preInstall
mkdir -p $out/share/${pname}/
cp -R $src/* $out/share/${pname}
mkdir -p $out/share/pixmaps
2023-12-17 10:20:42 +00:00
cp gitkraken.png $out/share/pixmaps/
2021-10-27 01:30:20 +00:00
runHook postInstall
'';
2023-08-19 12:04:16 +00:00
preFixup = ''
gappsWrapperArgs+=(--add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--ozone-platform-hint=auto --enable-features=WaylandWindowDecorations}}")
'';
2021-10-27 01:30:20 +00:00
postFixup = ''
pushd $out/share/${pname}
2023-12-17 10:20:42 +00:00
for file in gitkraken chrome-sandbox chrome_crashpad_handler; do
patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" $file
done
2021-10-27 01:30:20 +00:00
2023-12-17 10:20:42 +00:00
for file in $(find . -type f \( -name \*.node -o -name gitkraken -o -name git -o -name git-\* -o -name scalar -o -name \*.so\* \) ); do
2021-10-27 01:30:20 +00:00
patchelf --set-rpath ${libPath}:$out/share/${pname} $file || true
done
popd
2023-12-17 10:20:42 +00:00
# SSL and permissions fix for bundled nodegit
pushd $out/share/${pname}/resources/app.asar.unpacked/node_modules/@axosoft/nodegit/build/Release
mv nodegit-ubuntu-18.node nodegit-ubuntu-18-ssl-1.1.1.node
mv nodegit-ubuntu-18-ssl-static.node nodegit-ubuntu-18.node
chmod 755 nodegit-ubuntu-18.node
popd
# Devendor bundled git
rm -rf $out/share/${pname}/resources/app.asar.unpacked/git
ln -s ${git} $out/share/${pname}/resources/app.asar.unpacked/git
# GitKraken expects the CA bundle to be located in the bundled git directory. Since we replace it with
# the one from nixpkgs, which doesn't provide a CA bundle, we need to explicitly set its location at runtime
makeWrapper $out/share/${pname}/gitkraken $out/bin/gitkraken \
--set GIT_SSL_CAINFO "${cacert}/etc/ssl/certs/ca-bundle.crt" \
"''${gappsWrapperArgs[@]}"
2021-10-27 01:30:20 +00:00
'';
};
darwin = stdenv.mkDerivation {
inherit pname version src meta;
nativeBuildInputs = [ unzip ];
installPhase = ''
2023-10-24 03:28:10 +00:00
runHook preInstall
2021-10-27 01:30:20 +00:00
mkdir -p $out/Applications/GitKraken.app
cp -R . $out/Applications/GitKraken.app
2023-10-24 03:28:10 +00:00
runHook postInstall
2021-10-27 01:30:20 +00:00
'';
2023-10-24 03:28:10 +00:00
dontFixup = true;
2017-03-05 15:38:55 +00:00
};
2021-10-27 01:30:20 +00:00
in
if stdenv.isDarwin
then darwin
else linux