Unverified Commit 1440ce3e authored by Mario Rodas's avatar Mario Rodas Committed by GitHub
Browse files

Merge pull request #177704 from SaltyKitkat/logseq_use_nixpkgs_git

logseq: make dugite use the `git` in nixpkgs
parents 0e94b17c 231b0420
Loading
Loading
Loading
Loading
+10 −4
Original line number Diff line number Diff line
{ lib, stdenv, fetchurl, appimageTools, makeWrapper, autoPatchelfHook, electron, git, curl, expat, gcc, openssl, zlib }:
{ lib, stdenv, fetchurl, appimageTools, makeWrapper, electron, git }:

stdenv.mkDerivation rec {
  pname = "logseq";
@@ -19,8 +19,7 @@ stdenv.mkDerivation rec {
  dontConfigure = true;
  dontBuild = true;

  nativeBuildInputs = [ makeWrapper autoPatchelfHook ];
  buildInputs = [ stdenv.cc.cc curl expat openssl zlib ];
  nativeBuildInputs = [ makeWrapper ];

  installPhase = ''
    runHook preInstall
@@ -29,6 +28,12 @@ stdenv.mkDerivation rec {
    cp -a ${appimageContents}/{locales,resources} $out/share/${pname}
    cp -a ${appimageContents}/Logseq.desktop $out/share/applications/${pname}.desktop

    # remove the `git` in `dugite` because we want the `git` in `nixpkgs`
    chmod +w -R $out/share/${pname}/resources/app/node_modules/dugite/git
    chmod +w $out/share/${pname}/resources/app/node_modules/dugite
    rm -rf $out/share/${pname}/resources/app/node_modules/dugite/git
    chmod -w $out/share/${pname}/resources/app/node_modules/dugite

    substituteInPlace $out/share/applications/${pname}.desktop \
      --replace Exec=Logseq Exec=${pname} \
      --replace Icon=Logseq Icon=$out/share/${pname}/resources/app/icons/logseq.png
@@ -37,8 +42,9 @@ stdenv.mkDerivation rec {
  '';

  postFixup = ''
    # set the env "LOCAL_GIT_DIRECTORY" for dugite so that we can use the git in nixpkgs
    makeWrapper ${electron}/bin/electron $out/bin/${pname} \
      --prefix PATH : ${lib.makeBinPath [ git ]} \
      --set "LOCAL_GIT_DIRECTORY" ${git} \
      --add-flags $out/share/${pname}/resources/app
  '';