summary refs log tree commit diff
path: root/pkgs/applications/misc/logseq/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/applications/misc/logseq/default.nix')
-rw-r--r--pkgs/applications/misc/logseq/default.nix25
1 files changed, 16 insertions, 9 deletions
diff --git a/pkgs/applications/misc/logseq/default.nix b/pkgs/applications/misc/logseq/default.nix
index 7aa12ee730e..afd7c1309ce 100644
--- a/pkgs/applications/misc/logseq/default.nix
+++ b/pkgs/applications/misc/logseq/default.nix
@@ -2,8 +2,8 @@
 , stdenv
 , fetchurl
 , appimageTools
-, appimage-run
 , makeWrapper
+, electron
 , git
 }:
 
@@ -30,23 +30,30 @@ stdenv.mkDerivation rec {
   installPhase = ''
     runHook preInstall
 
-    mkdir -p $out/bin $out/share/${pname} $out/share/applications $out/share/${pname}/resources/app/icons
-    cp -a ${appimageContents}/resources/app/icons/logseq.png $out/share/${pname}/resources/app/icons/logseq.png
+    mkdir -p $out/bin $out/share/${pname} $out/share/applications
+    cp -a ${appimageContents}/{locales,resources} $out/share/${pname}
     cp -a ${appimageContents}/Logseq.desktop $out/share/applications/${pname}.desktop
 
-    # set the env "LOCAL_GIT_DIRECTORY" for dugite so that we can use the git in nixpkgs
-    makeWrapper ${appimage-run}/bin/appimage-run $out/bin/logseq \
-      --set "LOCAL_GIT_DIRECTORY" ${git} \
-      --add-flags ${src}
+    # 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
 
-    # Make the desktop entry run the app using appimage-run
     substituteInPlace $out/share/applications/${pname}.desktop \
-      --replace Exec=Logseq "Exec=$out/bin/logseq" \
+      --replace Exec=Logseq Exec=${pname} \
       --replace Icon=Logseq Icon=$out/share/${pname}/resources/app/icons/logseq.png
 
     runHook postInstall
   '';
 
+  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} \
+      --set "LOCAL_GIT_DIRECTORY" ${git} \
+      --add-flags $out/share/${pname}/resources/app
+  '';
+
   passthru.updateScript = ./update.sh;
 
   meta = with lib; {