2022-12-29 20:45:51 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, fetchurl
|
|
|
|
, appimageTools
|
|
|
|
, makeWrapper
|
2023-07-26 19:11:20 +00:00
|
|
|
# graphs will not sync without matching upstream's major electron version
|
2023-12-14 08:29:52 +00:00
|
|
|
, electron_27
|
2022-12-29 20:45:51 +00:00
|
|
|
, git
|
2023-03-28 08:28:11 +00:00
|
|
|
, nix-update-script
|
2022-12-29 20:45:51 +00:00
|
|
|
}:
|
2021-03-20 16:57:39 +00:00
|
|
|
|
2023-07-07 07:47:55 +00:00
|
|
|
stdenv.mkDerivation (finalAttrs: let
|
|
|
|
inherit (finalAttrs) pname version src appimageContents;
|
|
|
|
|
|
|
|
in {
|
2021-03-20 16:57:39 +00:00
|
|
|
pname = "logseq";
|
2024-03-01 11:45:57 +00:00
|
|
|
version = "0.10.7";
|
2021-03-20 16:57:39 +00:00
|
|
|
|
|
|
|
src = fetchurl {
|
|
|
|
url = "https://github.com/logseq/logseq/releases/download/${version}/logseq-linux-x64-${version}.AppImage";
|
2024-03-01 11:45:57 +00:00
|
|
|
hash = "sha256-EC83D7tSpoDV6h363yIdX9IrTfoMd4b0hTVdW1T0pXg=";
|
2021-03-20 16:57:39 +00:00
|
|
|
name = "${pname}-${version}.AppImage";
|
|
|
|
};
|
|
|
|
|
|
|
|
appimageContents = appimageTools.extract {
|
2022-08-08 16:10:37 +00:00
|
|
|
inherit pname src version;
|
2021-03-20 16:57:39 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
dontUnpack = true;
|
|
|
|
dontConfigure = true;
|
|
|
|
dontBuild = true;
|
|
|
|
|
2022-06-15 02:44:34 +00:00
|
|
|
nativeBuildInputs = [ makeWrapper ];
|
2021-03-20 16:57:39 +00:00
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
runHook preInstall
|
|
|
|
|
2023-03-01 09:21:03 +00:00
|
|
|
mkdir -p $out/bin $out/share/${pname} $out/share/applications
|
|
|
|
cp -a ${appimageContents}/{locales,resources} $out/share/${pname}
|
2021-03-20 16:57:39 +00:00
|
|
|
cp -a ${appimageContents}/Logseq.desktop $out/share/applications/${pname}.desktop
|
|
|
|
|
2023-03-01 09:21:03 +00:00
|
|
|
# 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
|
2022-06-15 02:44:34 +00:00
|
|
|
|
2023-03-28 19:50:12 +00:00
|
|
|
mkdir -p $out/share/pixmaps
|
|
|
|
ln -s $out/share/${pname}/resources/app/icons/logseq.png $out/share/pixmaps/${pname}.png
|
|
|
|
|
2021-03-20 16:57:39 +00:00
|
|
|
substituteInPlace $out/share/applications/${pname}.desktop \
|
2023-03-01 09:21:03 +00:00
|
|
|
--replace Exec=Logseq Exec=${pname} \
|
2023-03-28 19:50:12 +00:00
|
|
|
--replace Icon=Logseq Icon=${pname}
|
2021-03-20 16:57:39 +00:00
|
|
|
|
|
|
|
runHook postInstall
|
|
|
|
'';
|
|
|
|
|
2023-03-01 09:21:03 +00:00
|
|
|
postFixup = ''
|
|
|
|
# set the env "LOCAL_GIT_DIRECTORY" for dugite so that we can use the git in nixpkgs
|
2023-12-14 08:29:52 +00:00
|
|
|
makeWrapper ${electron_27}/bin/electron $out/bin/${pname} \
|
2023-03-01 09:21:03 +00:00
|
|
|
--set "LOCAL_GIT_DIRECTORY" ${git} \
|
2022-11-30 22:43:47 +00:00
|
|
|
--add-flags $out/share/${pname}/resources/app \
|
2023-05-06 00:49:24 +00:00
|
|
|
--add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--ozone-platform-hint=auto --enable-features=WaylandWindowDecorations}}" \
|
|
|
|
--prefix LD_LIBRARY_PATH : "${lib.makeLibraryPath [ stdenv.cc.cc.lib ]}"
|
2023-03-01 09:21:03 +00:00
|
|
|
'';
|
|
|
|
|
2023-03-28 08:28:11 +00:00
|
|
|
passthru.updateScript = nix-update-script { };
|
2021-03-20 16:57:39 +00:00
|
|
|
|
2023-12-14 08:29:52 +00:00
|
|
|
meta = {
|
2021-03-20 16:57:39 +00:00
|
|
|
description = "A local-first, non-linear, outliner notebook for organizing and sharing your personal knowledge base";
|
|
|
|
homepage = "https://github.com/logseq/logseq";
|
2022-12-29 20:45:51 +00:00
|
|
|
changelog = "https://github.com/logseq/logseq/releases/tag/${version}";
|
2023-12-14 08:29:52 +00:00
|
|
|
license = lib.licenses.agpl3Plus;
|
2024-01-29 22:48:04 +00:00
|
|
|
sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
|
2023-12-14 08:29:52 +00:00
|
|
|
maintainers = with lib.maintainers; [ ];
|
2021-03-20 16:57:39 +00:00
|
|
|
platforms = [ "x86_64-linux" ];
|
2024-02-11 02:19:15 +00:00
|
|
|
mainProgram = "logseq";
|
2021-03-20 16:57:39 +00:00
|
|
|
};
|
2023-07-07 07:47:55 +00:00
|
|
|
})
|