about summary refs log tree commit diff
path: root/pkgs/applications/version-management/gitkraken
diff options
context:
space:
mode:
authorNicolas Goudry <goudry.nicolas@gmail.com>2023-12-17 11:20:42 +0100
committerNicolas Goudry <goudry.nicolas@gmail.com>2023-12-17 16:31:16 +0100
commit53c6ef9577a00d3563a6c6ba7d86b6aaed823ad4 (patch)
tree0871f7205b8316116b84e9797c1cfe3fff360b99 /pkgs/applications/version-management/gitkraken
parentab5993105a532859842d331e78d025560118a60d (diff)
gitkraken: devendor git
Diffstat (limited to 'pkgs/applications/version-management/gitkraken')
-rw-r--r--pkgs/applications/version-management/gitkraken/default.nix35
1 files changed, 25 insertions, 10 deletions
diff --git a/pkgs/applications/version-management/gitkraken/default.nix b/pkgs/applications/version-management/gitkraken/default.nix
index 0e25f63765e14..19f95883797ba 100644
--- a/pkgs/applications/version-management/gitkraken/default.nix
+++ b/pkgs/applications/version-management/gitkraken/default.nix
@@ -3,7 +3,8 @@
 , libX11, libXi, libxcb, libXext, libXcursor, glib, libXScrnSaver, libxkbfile, libXtst
 , nss, nspr, cups, fetchzip, expat, gdk-pixbuf, libXdamage, libXrandr, dbus
 , makeDesktopItem, openssl, wrapGAppsHook, at-spi2-atk, at-spi2-core, libuuid
-, e2fsprogs, krb5, libdrm, mesa, unzip, copyDesktopItems, libxshmfence, libxkbcommon
+, e2fsprogs, krb5, libdrm, mesa, unzip, copyDesktopItems, libxshmfence, libxkbcommon, git
+, libGL, zlib, cacert
 }:
 
 with lib;
@@ -91,12 +92,14 @@ let
       mesa
       libxshmfence
       libxkbcommon
+      libGL
+      zlib
     ];
 
     desktopItems = [ (makeDesktopItem {
-      name = pname;
-      exec = pname;
-      icon = pname;
+      name = "GitKraken";
+      exec = "gitkraken";
+      icon = "gitkraken";
       desktopName = "GitKraken";
       genericName = "Git Client";
       categories = [ "Development" ];
@@ -112,25 +115,37 @@ let
       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
+      cp gitkraken.png $out/share/pixmaps/
 
       runHook postInstall
     '';
 
     postFixup = ''
       pushd $out/share/${pname}
-      for file in ${pname} chrome-sandbox chrome_crashpad_handler; do
+      for file in gitkraken chrome-sandbox chrome_crashpad_handler; do
         patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" $file
       done
 
-      for file in $(find . -type f \( -name \*.node -o -name ${pname} -o -name \*.so\* \) ); do
+      for file in $(find . -type f \( -name \*.node -o -name gitkraken -o -name git -o -name git-\* -o -name scalar -o -name \*.so\* \) ); do
         patchelf --set-rpath ${libPath}:$out/share/${pname} $file || true
       done
       popd
+
+      # 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"
     '';
   };