6 # graphs will not sync without matching upstream's major electron version
12 stdenv.mkDerivation (finalAttrs: let
13 inherit (finalAttrs) pname version src appimageContents;
20 url = "https://github.com/logseq/logseq/releases/download/${version}/logseq-linux-x64-${version}.AppImage";
21 hash = "sha256-kVnQ33gozrL6BOWQxUfiMypiIZOffeT2cMVMHIfsaWg=";
22 name = "${pname}-${version}.AppImage";
25 appimageContents = appimageTools.extract {
26 inherit pname src version;
33 nativeBuildInputs = [ makeWrapper ];
38 mkdir -p $out/bin $out/share/${pname} $out/share/applications
39 cp -a ${appimageContents}/{locales,resources} $out/share/${pname}
40 cp -a ${appimageContents}/Logseq.desktop $out/share/applications/${pname}.desktop
42 # remove the `git` in `dugite` because we want the `git` in `nixpkgs`
43 chmod +w -R $out/share/${pname}/resources/app/node_modules/dugite/git
44 chmod +w $out/share/${pname}/resources/app/node_modules/dugite
45 rm -rf $out/share/${pname}/resources/app/node_modules/dugite/git
46 chmod -w $out/share/${pname}/resources/app/node_modules/dugite
48 mkdir -p $out/share/pixmaps
49 ln -s $out/share/${pname}/resources/app/icons/logseq.png $out/share/pixmaps/${pname}.png
51 substituteInPlace $out/share/applications/${pname}.desktop \
52 --replace Exec=Logseq Exec=${pname} \
53 --replace Icon=Logseq Icon=${pname}
59 # set the env "LOCAL_GIT_DIRECTORY" for dugite so that we can use the git in nixpkgs
60 makeWrapper ${electron_27}/bin/electron $out/bin/${pname} \
61 --set "LOCAL_GIT_DIRECTORY" ${git} \
62 --add-flags $out/share/${pname}/resources/app \
63 --add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--ozone-platform-hint=auto --enable-features=WaylandWindowDecorations}}"
66 passthru.updateScript = nix-update-script { };
69 description = "A local-first, non-linear, outliner notebook for organizing and sharing your personal knowledge base";
70 homepage = "https://github.com/logseq/logseq";
71 changelog = "https://github.com/logseq/logseq/releases/tag/${version}";
72 license = lib.licenses.agpl3Plus;
73 sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
74 maintainers = with lib.maintainers; [ ];
75 platforms = [ "x86_64-linux" ];
76 mainProgram = "logseq";