nixpkgs/pkgs/applications/misc/logseq/default.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

80 lines
2.6 KiB
Nix
Raw Normal View History

2022-12-29 20:45:51 +00:00
{ lib
, stdenv
, fetchurl
, appimageTools
, makeWrapper
# graphs will not sync without matching upstream's major electron version
, electron_27
2022-12-29 20:45:51 +00:00
, git
, nix-update-script
2022-12-29 20:45:51 +00:00
}:
2021-03-20 16:57:39 +00:00
stdenv.mkDerivation (finalAttrs: let
inherit (finalAttrs) pname version src appimageContents;
in {
2021-03-20 16:57:39 +00:00
pname = "logseq";
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";
hash = "sha256-EC83D7tSpoDV6h363yIdX9IrTfoMd4b0hTVdW1T0pXg=";
2021-03-20 16:57:39 +00:00
name = "${pname}-${version}.AppImage";
};
appimageContents = appimageTools.extract {
inherit pname src version;
2021-03-20 16:57:39 +00:00
};
dontUnpack = true;
dontConfigure = true;
dontBuild = true;
nativeBuildInputs = [ makeWrapper ];
2021-03-20 16:57:39 +00:00
installPhase = ''
runHook preInstall
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
# 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
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 \
--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
'';
postFixup = ''
# set the env "LOCAL_GIT_DIRECTORY" for dugite so that we can use the git in nixpkgs
makeWrapper ${electron_27}/bin/electron $out/bin/${pname} \
--set "LOCAL_GIT_DIRECTORY" ${git} \
2022-11-30 22:43:47 +00:00
--add-flags $out/share/${pname}/resources/app \
--add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--ozone-platform-hint=auto --enable-features=WaylandWindowDecorations}}" \
--prefix LD_LIBRARY_PATH : "${lib.makeLibraryPath [ stdenv.cc.cc.lib ]}"
'';
passthru.updateScript = nix-update-script { };
2021-03-20 16:57:39 +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}";
license = lib.licenses.agpl3Plus;
2024-01-29 22:48:04 +00:00
sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
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
};
})