3
0
Fork 0
forked from mirrors/nixpkgs

Merge pull request #177704 from SaltyKitkat/logseq_use_nixpkgs_git

logseq: make dugite use the `git` in nixpkgs
This commit is contained in:
Mario Rodas 2022-07-19 02:09:06 -05:00 committed by GitHub
commit 1440ce3e79
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,4 +1,4 @@
{ lib, stdenv, fetchurl, appimageTools, makeWrapper, autoPatchelfHook, electron, git, curl, expat, gcc, openssl, zlib }: { lib, stdenv, fetchurl, appimageTools, makeWrapper, electron, git }:
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
pname = "logseq"; pname = "logseq";
@ -19,8 +19,7 @@ stdenv.mkDerivation rec {
dontConfigure = true; dontConfigure = true;
dontBuild = true; dontBuild = true;
nativeBuildInputs = [ makeWrapper autoPatchelfHook ]; nativeBuildInputs = [ makeWrapper ];
buildInputs = [ stdenv.cc.cc curl expat openssl zlib ];
installPhase = '' installPhase = ''
runHook preInstall runHook preInstall
@ -29,6 +28,12 @@ stdenv.mkDerivation rec {
cp -a ${appimageContents}/{locales,resources} $out/share/${pname} cp -a ${appimageContents}/{locales,resources} $out/share/${pname}
cp -a ${appimageContents}/Logseq.desktop $out/share/applications/${pname}.desktop 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 \ substituteInPlace $out/share/applications/${pname}.desktop \
--replace Exec=Logseq Exec=${pname} \ --replace Exec=Logseq Exec=${pname} \
--replace Icon=Logseq Icon=$out/share/${pname}/resources/app/icons/logseq.png --replace Icon=Logseq Icon=$out/share/${pname}/resources/app/icons/logseq.png
@ -37,8 +42,9 @@ stdenv.mkDerivation rec {
''; '';
postFixup = '' 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} \ makeWrapper ${electron}/bin/electron $out/bin/${pname} \
--prefix PATH : ${lib.makeBinPath [ git ]} \ --set "LOCAL_GIT_DIRECTORY" ${git} \
--add-flags $out/share/${pname}/resources/app --add-flags $out/share/${pname}/resources/app
''; '';