about summary refs log tree commit diff
path: root/pkgs/by-name/lo/logseq/package.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/by-name/lo/logseq/package.nix')
-rw-r--r--pkgs/by-name/lo/logseq/package.nix67
1 files changed, 35 insertions, 32 deletions
diff --git a/pkgs/by-name/lo/logseq/package.nix b/pkgs/by-name/lo/logseq/package.nix
index 6c0e0dd0d7bc..0f56d5def56d 100644
--- a/pkgs/by-name/lo/logseq/package.nix
+++ b/pkgs/by-name/lo/logseq/package.nix
@@ -4,16 +4,17 @@
 , appimageTools
 , unzip
 , makeWrapper
-# Notice: graphs will not sync without matching upstream's major electron version
-#         the specific electron version is set at top-level file to preserve override interface.
-#         whenever updating this package also sync electron version at top-level file.
-, electron
+  # Notice: graphs will not sync without matching upstream's major electron version
+  #         the specific electron version is set at top-level file to preserve override interface.
+  #         whenever updating this package also sync electron version at top-level file.
+, electron_27
 , autoPatchelfHook
 , git
 , nix-update-script
 }:
 
-stdenv.mkDerivation (finalAttrs: let
+stdenv.mkDerivation (finalAttrs:
+let
   inherit (finalAttrs) pname version src;
   inherit (stdenv.hostPlatform) system;
   selectSystem = attrs: attrs.${system} or (throw "Unsupported system: ${system}");
@@ -27,48 +28,50 @@ stdenv.mkDerivation (finalAttrs: let
     x86_64-darwin = "sha256-0i9ozqBSeV/y8v+YEmQkbY0V6JHOv6tKub4O5Fdx2fQ=";
     aarch64-darwin = "sha256-Uvv96XWxpFj14wPH0DwPT+mlf3Z2dy1g/z8iBt5Te7Q=";
   };
-in {
+in
+{
   pname = "logseq";
   version = "0.10.9";
   src = fetchurl {
     inherit hash;
     url = "https://github.com/logseq/logseq/releases/download/${version}/logseq-${suffix}";
-    name = lib.optionalString stdenv.isLinux "logseq-${version}.AppImage";
+    name = lib.optionalString stdenv.hostPlatform.isLinux "logseq-${version}.AppImage";
   };
 
   nativeBuildInputs = [ makeWrapper ]
-    ++ lib.optionals stdenv.isLinux [ autoPatchelfHook ]
-    ++ lib.optionals stdenv.isDarwin [ unzip ];
-  buildInputs = [ stdenv.cc.cc.lib ];
+    ++ lib.optionals stdenv.hostPlatform.isLinux [ autoPatchelfHook ]
+    ++ lib.optionals stdenv.hostPlatform.isDarwin [ unzip ];
+  buildInputs = [ (lib.getLib stdenv.cc.cc) ];
 
-  dontUnpack = stdenv.isLinux;
+  dontUnpack = stdenv.hostPlatform.isLinux;
   dontConfigure = true;
   dontBuild = true;
 
   installPhase = ''
     runHook preInstall
-  '' + lib.optionalString stdenv.isLinux (
-  let
-   appimageContents = appimageTools.extract { inherit pname src version; };
-  in
-  ''
-    mkdir -p $out/bin $out/share/logseq $out/share/applications
-    cp -a ${appimageContents}/{locales,resources} $out/share/logseq
-    cp -a ${appimageContents}/Logseq.desktop $out/share/applications/logseq.desktop
+  '' + lib.optionalString stdenv.hostPlatform.isLinux (
+    let
+      appimageContents = appimageTools.extract { inherit pname src version; };
+    in
+    ''
+      mkdir -p $out/bin $out/share/logseq $out/share/applications
+      cp -a ${appimageContents}/{locales,resources} $out/share/logseq
+      cp -a ${appimageContents}/Logseq.desktop $out/share/applications/logseq.desktop
 
-    # remove the `git` in `dugite` because we want the `git` in `nixpkgs`
-    chmod +w -R $out/share/logseq/resources/app/node_modules/dugite/git
-    chmod +w $out/share/logseq/resources/app/node_modules/dugite
-    rm -rf $out/share/logseq/resources/app/node_modules/dugite/git
-    chmod -w $out/share/logseq/resources/app/node_modules/dugite
+      # remove the `git` in `dugite` because we want the `git` in `nixpkgs`
+      chmod +w -R $out/share/logseq/resources/app/node_modules/dugite/git
+      chmod +w $out/share/logseq/resources/app/node_modules/dugite
+      rm -rf $out/share/logseq/resources/app/node_modules/dugite/git
+      chmod -w $out/share/logseq/resources/app/node_modules/dugite
 
-    mkdir -p $out/share/pixmaps
-    ln -s $out/share/logseq/resources/app/icons/logseq.png $out/share/pixmaps/logseq.png
+      mkdir -p $out/share/pixmaps
+      ln -s $out/share/logseq/resources/app/icons/logseq.png $out/share/pixmaps/logseq.png
 
-    substituteInPlace $out/share/applications/logseq.desktop \
-      --replace Exec=Logseq Exec=logseq \
-      --replace Icon=Logseq Icon=logseq
-  '') + lib.optionalString stdenv.isDarwin ''
+      substituteInPlace $out/share/applications/logseq.desktop \
+        --replace Exec=Logseq Exec=logseq \
+        --replace Icon=Logseq Icon=logseq
+    ''
+  ) + lib.optionalString stdenv.hostPlatform.isDarwin ''
     mkdir -p $out/{Applications/Logseq.app,bin}
     cp -R . $out/Applications/Logseq.app
     makeWrapper $out/Applications/Logseq.app/Contents/MacOS/Logseq $out/bin/logseq
@@ -76,9 +79,9 @@ in {
     runHook postInstall
   '';
 
-  postFixup = lib.optionalString stdenv.isLinux ''
+  postFixup = lib.optionalString stdenv.hostPlatform.isLinux ''
     # set the env "LOCAL_GIT_DIRECTORY" for dugite so that we can use the git in nixpkgs
-    makeWrapper ${electron}/bin/electron $out/bin/logseq \
+    makeWrapper ${electron_27}/bin/electron $out/bin/logseq \
       --set "LOCAL_GIT_DIRECTORY" ${git} \
       --add-flags $out/share/logseq/resources/app \
       --add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--ozone-platform-hint=auto --enable-features=WaylandWindowDecorations}}"