Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ index 5a349a2..f967102 100644
}
],
- osxSign: {
- identity: 'Developer ID Application: Tiansheng Qin',
- identity: 'Developer ID Application: Logseq Inc. (K378MFWK59)',
- 'hardened-runtime': true,
- entitlements: 'entitlements.plist',
- 'entitlements-inherit': 'entitlements.plist',
Expand Down
2,834 changes: 2,834 additions & 0 deletions pkgs/by-name/lo/logseq-og/fix-electron-40-and-above.patch

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -21,22 +21,22 @@
xcbuild,
zip,

electron_39,
electron_43,
git,
}:

let
electron = electron_39;
electron = electron_43;
in
stdenv.mkDerivation (finalAttrs: {
pname = "logseq";
version = "0.10.15";
pname = "logseq-og";
version = "1.0.0-unstable-2026-05-28";

src = fetchFromGitHub {
owner = "logseq";
repo = "logseq";
tag = finalAttrs.version;
hash = "sha256-knosNA2Gqy10Kr9HWnBdYNlV51zzgFuL8cdioVlAk0Q=";
repo = "og";
rev = "6e7afa8eb040686ff057156ee877193b581dd369";
hash = "sha256-LJuZDyfGQW28ARn9RTqQ1bRI1htfoqt8zhb6UuJLek0=";
};

patches = [
Expand All @@ -58,16 +58,13 @@ stdenv.mkDerivation (finalAttrs: {
./electron-forge-package-instead-of-make.patch
./electron-forge-disable-signing.patch

# bumps better-sqlite3 to work with electron 39+
# also fixes outdated yarn.lock
./bump-better-sqlite3.patch

# zip extraction fails on newer nodejs versions without this fix
./bump-yauzl.patch
# See: https://github.com/logseq/og/issues/32
# See: https://github.com/logseq/og/pull/50
./fix-electron-40-and-above.patch
];

mavenRepo = stdenv.mkDerivation {
name = "logseq-${finalAttrs.version}-maven-deps";
name = "logseq-og-${finalAttrs.version}-maven-deps";
inherit (finalAttrs) src patches;

nativeBuildInputs = [ clojure ];
Expand Down Expand Up @@ -107,35 +104,44 @@ stdenv.mkDerivation (finalAttrs: {
};

yarnOfflineCacheRoot = fetchYarnDeps {
name = "logseq-${finalAttrs.version}-yarn-deps-root";
name = "logseq-og-${finalAttrs.version}-yarn-deps-root";
inherit (finalAttrs) src patches;
hash = "sha256-xfAJ38shd92KdRfh/P7BH4eolZHQmzl4raoH1aZpGRk=";
hash = "sha256-BHf63Y19W9Zl/r5rHQ77voBQykQL1s3gR8SJZRxexZs=";
};

# ./static and ./resources are combined into ./static by the build process
# ./static contains the lockfile and ./resources contains everything else
yarnOfflineCacheStaticResources = fetchYarnDeps {
name = "logseq-${finalAttrs.version}-yarn-deps-static-resources";
name = "logseq-og-${finalAttrs.version}-yarn-deps-static-resources";
inherit (finalAttrs) src patches;
postPatch = "cd ./static";
hash = "sha256-TFisR5GwcKmuddGhe0i6rAmr2wDWzed/mXnxVGARYK0=";
hash = "sha256-nxTsE63pw1m2YE4WJhEAg4lQRPKBjnu/8r2WjvgfQGQ=";
};

yarnOfflineCacheAmplify = fetchYarnDeps {
name = "logseq-${finalAttrs.version}-yarn-deps-amplify";
name = "logseq-og-${finalAttrs.version}-yarn-deps-amplify";
inherit (finalAttrs) src patches;
postPatch = "cd ./packages/amplify";
hash = "sha256-IOhSwIf5goXCBDGHCqnsvWLf3EUPqq75xfQg55snIp4=";
};

yarnOfflineCacheTldraw = fetchYarnDeps {
name = "logseq-${finalAttrs.version}-yarn-deps-tldraw";
name = "logseq-og-${finalAttrs.version}-yarn-deps-tldraw";
inherit (finalAttrs) src patches;
postPatch = "cd ./tldraw";
hash = "sha256-CtMl3MPlyO5nWfFhCC1SLb/+1HUM3YfFATAPqJg3rUo=";
};

# this and related code below is only needed for regenerating lsplugin.*.js
yarnOfflineCacheLibs = fetchYarnDeps {
name = "logseq-og-${finalAttrs.version}-yarn-deps-libs";
inherit (finalAttrs) src patches;
postPatch = "cd ./libs";
hash = "sha256-m5ZwYpRrTUeSFfbeViBcABaP2bAhY6p/ZQptmU4YxFY=";
};

strictDeps = true;
__structuredAttrs = true;

nativeBuildInputs =
let
Expand Down Expand Up @@ -193,13 +199,18 @@ stdenv.mkDerivation (finalAttrs: {
popd
popd

pushd libs
yarnOfflineCache="$yarnOfflineCacheLibs" yarnConfigHook
popd

# this has to be done after everything is set up, because for some reason
# the shebangs somehow get unpatched... I don't know why...
patchShebangs node_modules
patchShebangs static/node_modules
patchShebangs packages/amplify/node_modules
patchShebangs tldraw/node_modules
patchShebangs tldraw/apps/tldraw-logseq/node_modules
patchShebangs libs/node_modules

yarn --offline --cwd tldraw postinstall

Expand All @@ -210,8 +221,32 @@ stdenv.mkDerivation (finalAttrs: {

export npm_config_nodedir=${electron.headers}

# make sure we're using the files regenerated from the .ts files
rm resources/js/lsplugin.*.js

pushd libs

# if we don't remove this, it will wait for Ctrl+C to terminate
substituteInPlace webpack.config.core.js \
--replace-fail "config.plugins.push(new BundleAnalyzerPlugin())" ""

npm run build
npm run build:core
mv dist/lsplugin.*.js ../resources/js/

popd

pushd static

# don't use prebuilt binaries for better-sqlite3
pushd node_modules/better-sqlite3
rm -r prebuilds
npm run build-release
shopt -s extglob
rm -r build/Release/!(better_sqlite3.node)
shopt -u extglob
popd

# we want to use our own git, don't try downloading it
substituteInPlace node_modules/dugite/package.json \
--replace-fail '"postinstall"' '"_postinstall"'
Expand Down Expand Up @@ -256,50 +291,50 @@ stdenv.mkDerivation (finalAttrs: {
find static/out/*/resources/app/node_modules -type f -executable -exec remove-references-to -t ${nodejs-slim} '{}' \;
''
+ lib.optionalString stdenv.hostPlatform.isLinux ''
install -Dm644 static/icons/logseq.png "$out/share/icons/hicolor/512x512/apps/logseq.png"
install -Dm644 static/icons/logseq.png "$out/share/icons/hicolor/512x512/apps/logseq-og.png"

mkdir -p $out/share/logseq
cp -r static/out/*/{locales,resources{,.pak}} $out/share/logseq
mkdir -p "$out/share/logseq-og"
cp -r static/out/*/{locales,resources{,.pak}} "$out/share/logseq-og"

makeWrapper ${lib.getExe electron} $out/bin/logseq \
--add-flags $out/share/logseq/resources/app \
makeWrapper ${lib.getExe electron} "$out/bin/logseq-og" \
--add-flags "$out/share/logseq-og/resources/app" \
--add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--ozone-platform-hint=auto --enable-features=WaylandWindowDecorations --enable-wayland-ime=true --wayland-text-input-version=3}}" \
--set-default LOCAL_GIT_DIRECTORY ${git} \
--inherit-argv0
''
+ lib.optionalString stdenv.hostPlatform.isDarwin ''
mkdir -p $out/Applications
cp -r static/out/*/Logseq.app $out/Applications
mkdir -p "$out/Applications"
cp -r static/out/*/Logseq-OG.app "$out/Applications"

wrapProgram $out/Applications/Logseq.app/Contents/MacOS/Logseq \
wrapProgram "$out/Applications/Logseq-OG.app/Contents/MacOS/Logseq-OG" \
--set-default LOCAL_GIT_DIRECTORY ${git}

makeWrapper $out/Applications/Logseq.app/Contents/MacOS/Logseq $out/bin/logseq
makeWrapper "$out/Applications/Logseq-OG.app/Contents/MacOS/Logseq-OG" "$out/bin/logseq-og"
''
+ ''
runHook postInstall
'';

desktopItems = [
(makeDesktopItem {
name = "Logseq";
desktopName = "Logseq";
exec = "logseq %U";
name = "Logseq-OG";
desktopName = "Logseq OG";
exec = "logseq-og %U";
terminal = false;
icon = "logseq";
startupWMClass = "Logseq";
icon = "logseq-og";
startupWMClass = "Logseq OG";
comment = "A privacy-first, open-source platform for knowledge management and collaboration.";
mimeTypes = [ "x-scheme-handler/logseq" ];
mimeTypes = [ "x-scheme-handler/logseq-og" ];
categories = [ "Utility" ];
})
];

meta = {
description = "Privacy-first, open-source platform for knowledge management and collaboration";
homepage = "https://github.com/logseq/logseq";
homepage = "https://github.com/logseq/og";
license = lib.licenses.agpl3Only;
maintainers = with lib.maintainers; [ tomasajt ];
mainProgram = "logseq";
mainProgram = "logseq-og";
platforms = electron.meta.platforms;
};
})
129 changes: 0 additions & 129 deletions pkgs/by-name/lo/logseq/bump-better-sqlite3.patch

This file was deleted.

Loading
Loading