nixpkgs/pkgs/by-name/gi/gitkraken/package.nix

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

255 lines
5.7 KiB
Nix
Raw Normal View History

2024-08-09 22:37:29 +00:00
{
lib,
stdenv,
libXcomposite,
libgnome-keyring,
makeWrapper,
udev,
curlWithGnuTls,
alsa-lib,
libXfixes,
atk,
gtk3,
libXrender,
pango,
adwaita-icon-theme,
cairo,
freetype,
fontconfig,
libX11,
libXi,
libxcb,
libXext,
libXcursor,
glib,
libXScrnSaver,
libxkbfile,
libXtst,
nss,
nspr,
cups,
fetchzip,
expat,
gdk-pixbuf,
libXdamage,
libXrandr,
dbus,
makeDesktopItem,
openssl,
wrapGAppsHook3,
buildPackages,
2024-08-09 22:37:29 +00:00
at-spi2-atk,
at-spi2-core,
libuuid,
e2fsprogs,
krb5,
libdrm,
mesa,
unzip,
copyDesktopItems,
libxshmfence,
libxkbcommon,
git,
libGL,
zlib,
cacert,
2017-03-05 15:38:55 +00:00
}:
2018-03-12 17:34:46 +00:00
let
pname = "gitkraken";
2024-11-25 10:04:10 +00:00
version = "10.5.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-11-25 10:04:10 +00:00
hash = "sha256-zgzKwQCt1FoBgzVn1WrllANuBvYxKjPJNhVq0JqiXCM=";
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-11-25 10:04:10 +00:00
hash = "sha256-H1rxvCGo0m8g5XSUcuREMfe+Im/QsL6nsDbPQDo09j4=";
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-11-25 10:04:10 +00:00
hash = "sha256-OsCbTtGNo+heQQL6OEeUq64Dlbs86FUpfqEJ80PnV2o=";
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
2024-08-13 20:06:15 +00:00
meta = with lib; {
2024-05-15 21:43:11 +00:00
homepage = "https://www.gitkraken.com/git-client";
description = "Simplifying Git for any OS";
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;
2024-08-09 22:37:29 +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 {
2024-08-09 22:37:29 +00:00
inherit
pname
version
src
meta
;
2021-10-27 01:30:20 +00:00
dontBuild = true;
dontConfigure = true;
2024-08-13 20:06:15 +00:00
libPath = lib.makeLibraryPath [
stdenv.cc.cc
2021-10-27 01:30:20 +00:00
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
];
2024-08-09 22:37:29 +00:00
desktopItems = [
(makeDesktopItem {
name = "GitKraken Desktop";
exec = "gitkraken";
icon = "gitkraken";
desktopName = "GitKraken Desktop";
genericName = "Git Client";
categories = [ "Development" ];
comment = "Unleash your repo";
})
];
2021-10-27 01:30:20 +00:00
2024-08-09 22:37:29 +00:00
nativeBuildInputs = [
copyDesktopItems
# override doesn't preserve splicing https://github.com/NixOS/nixpkgs/issues/132651
# Has to use `makeShellWrapper` from `buildPackages` even though `makeShellWrapper` from the inputs is spliced because `propagatedBuildInputs` would pick the wrong one because of a different offset.
(buildPackages.wrapGAppsHook3.override { makeWrapper = buildPackages.makeShellWrapper; })
2024-08-09 22:37:29 +00:00
];
buildInputs = [
gtk3
adwaita-icon-theme
];
2021-10-27 01:30:20 +00:00
# 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 --enable-wayland-ime=true}}")
2023-08-19 12:04:16 +00:00
'';
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 {
2024-08-09 22:37:29 +00:00
inherit
pname
version
src
meta
;
nativeBuildInputs = [
unzip
makeWrapper
];
2021-10-27 01:30:20 +00:00
installPhase = ''
2023-10-24 03:28:10 +00:00
runHook preInstall
2024-06-26 03:08:44 +00:00
mkdir -p $out/Applications/GitKraken.app $out/bin
2021-10-27 01:30:20 +00:00
cp -R . $out/Applications/GitKraken.app
2023-10-24 03:28:10 +00:00
2024-06-26 03:08:44 +00:00
makeWrapper $out/Applications/GitKraken.app/Contents/MacOS/GitKraken $out/bin/gitkraken
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
2024-08-09 22:37:29 +00:00
if stdenv.hostPlatform.isDarwin then darwin else linux