2023-01-11 07:51:40 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, fetchurl
|
|
|
|
, appimageTools
|
|
|
|
, makeWrapper
|
2024-06-20 14:57:18 +00:00
|
|
|
# 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
|
2024-05-15 15:35:15 +00:00
|
|
|
, autoPatchelfHook
|
2023-01-11 07:51:40 +00:00
|
|
|
, git
|
2023-03-30 22:05:00 +00:00
|
|
|
, nix-update-script
|
2023-01-11 07:51:40 +00:00
|
|
|
}:
|
2021-03-23 19:22:30 +00:00
|
|
|
|
2023-07-15 17:15:38 +00:00
|
|
|
stdenv.mkDerivation (finalAttrs: let
|
|
|
|
inherit (finalAttrs) pname version src appimageContents;
|
|
|
|
|
|
|
|
in {
|
2021-03-23 19:22:30 +00:00
|
|
|
pname = "logseq";
|
2024-05-15 15:35:15 +00:00
|
|
|
version = "0.10.9";
|
2021-03-23 19:22:30 +00:00
|
|
|
|
|
|
|
src = fetchurl {
|
|
|
|
url = "https://github.com/logseq/logseq/releases/download/${version}/logseq-linux-x64-${version}.AppImage";
|
2024-05-15 15:35:15 +00:00
|
|
|
hash = "sha256-XROuY2RlKnGvK1VNvzauHuLJiveXVKrIYPppoz8fCmc=";
|
2021-03-23 19:22:30 +00:00
|
|
|
name = "${pname}-${version}.AppImage";
|
|
|
|
};
|
|
|
|
|
|
|
|
appimageContents = appimageTools.extract {
|
2022-08-12 12:06:08 +00:00
|
|
|
inherit pname src version;
|
2021-03-23 19:22:30 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
dontUnpack = true;
|
|
|
|
dontConfigure = true;
|
|
|
|
dontBuild = true;
|
|
|
|
|
2024-05-15 15:35:15 +00:00
|
|
|
nativeBuildInputs = [ makeWrapper autoPatchelfHook ];
|
|
|
|
buildInputs = [ stdenv.cc.cc.lib ];
|
2021-03-23 19:22:30 +00:00
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
runHook preInstall
|
|
|
|
|
2023-03-27 19:17:25 +00:00
|
|
|
mkdir -p $out/bin $out/share/${pname} $out/share/applications
|
|
|
|
cp -a ${appimageContents}/{locales,resources} $out/share/${pname}
|
2021-03-23 19:22:30 +00:00
|
|
|
cp -a ${appimageContents}/Logseq.desktop $out/share/applications/${pname}.desktop
|
|
|
|
|
2023-03-27 19:17:25 +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-08-12 12:06:08 +00:00
|
|
|
|
2023-03-30 22:05:00 +00:00
|
|
|
mkdir -p $out/share/pixmaps
|
|
|
|
ln -s $out/share/${pname}/resources/app/icons/logseq.png $out/share/pixmaps/${pname}.png
|
|
|
|
|
2021-03-23 19:22:30 +00:00
|
|
|
substituteInPlace $out/share/applications/${pname}.desktop \
|
2023-03-27 19:17:25 +00:00
|
|
|
--replace Exec=Logseq Exec=${pname} \
|
2023-03-30 22:05:00 +00:00
|
|
|
--replace Icon=Logseq Icon=${pname}
|
2021-03-23 19:22:30 +00:00
|
|
|
|
|
|
|
runHook postInstall
|
|
|
|
'';
|
|
|
|
|
2023-03-27 19:17:25 +00:00
|
|
|
postFixup = ''
|
|
|
|
# set the env "LOCAL_GIT_DIRECTORY" for dugite so that we can use the git in nixpkgs
|
2024-06-20 14:57:18 +00:00
|
|
|
makeWrapper ${electron}/bin/electron $out/bin/${pname} \
|
2023-03-27 19:17:25 +00:00
|
|
|
--set "LOCAL_GIT_DIRECTORY" ${git} \
|
2023-04-12 12:48:02 +00:00
|
|
|
--add-flags $out/share/${pname}/resources/app \
|
2024-04-21 15:54:59 +00:00
|
|
|
--add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--ozone-platform-hint=auto --enable-features=WaylandWindowDecorations}}"
|
2023-03-27 19:17:25 +00:00
|
|
|
'';
|
|
|
|
|
2023-03-30 22:05:00 +00:00
|
|
|
passthru.updateScript = nix-update-script { };
|
2021-03-23 19:22:30 +00:00
|
|
|
|
2024-01-13 08:15:51 +00:00
|
|
|
meta = {
|
2024-06-20 14:57:18 +00:00
|
|
|
description = "Local-first, non-linear, outliner notebook for organizing and sharing your personal knowledge base";
|
2021-03-23 19:22:30 +00:00
|
|
|
homepage = "https://github.com/logseq/logseq";
|
2023-01-11 07:51:40 +00:00
|
|
|
changelog = "https://github.com/logseq/logseq/releases/tag/${version}";
|
2024-01-13 08:15:51 +00:00
|
|
|
license = lib.licenses.agpl3Plus;
|
2024-02-07 01:22:34 +00:00
|
|
|
sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
|
2024-01-13 08:15:51 +00:00
|
|
|
maintainers = with lib.maintainers; [ ];
|
2021-03-23 19:22:30 +00:00
|
|
|
platforms = [ "x86_64-linux" ];
|
2024-02-29 20:09:43 +00:00
|
|
|
mainProgram = "logseq";
|
2021-03-23 19:22:30 +00:00
|
|
|
};
|
2023-07-15 17:15:38 +00:00
|
|
|
})
|