obsidian: use the bundled Electron in Obsidian binary instead of from nixpkgs#519466
obsidian: use the bundled Electron in Obsidian binary instead of from nixpkgs#519466hesprs wants to merge 1 commit into
Conversation
… nixpkgs Obsidian's Nix derivation fetches the compiled Obsidian tarball from Obsidian GitHub release. The fetched tarball already has Electron bundled. Original derivation enforces Obsidian to use electron_39 from Nixpkgs instead of the one comes with it. Obsidian team seems to have patched Electron itself in the updates between v1.11.4 and v1.12.7. Using electron_39 in Nixpkgs invalidates the patch and causes certain bugs. A known one is https://forum.obsidian.md/t/keyboard-triggered-context-menu-does-not-show-spell-suggestions/114141 This commit removes electron_39 and _7zz dependency, making Obsidian depend on the Electron that is complied with it. This commit also attempts to improve Electron's secret store auto-detection. The original detection fails on non-KDE or non-Gnome environments. A wrapper script is added to detect the currently running secret service and set the secret store backend flag instead of relying on matching user's desktop environment. This issue has already been improved in Electron 42: electron/electron#49054. But since Obsidian uses Obsidian 39, this patch is still needed.
|
what is the difference between this pr and #519461? |
|
That PR fails the commit message lint check and contains multiple commits. This PR has only one done cleanly. |
|
I understand this PR fixes a real problem, however I'm not sure how I feel about switching to a binary distribution of Electron (that is being binary-patched anyway, by the derivation), instead of relying on the one built by Hydra.
I read through the discussion, but I haven't seen any mentions made by the maintainers about custom patches made on Electron. While Electron is MIT-licensed (hence Obsidian's team is not forced to release the source code with their modifications) I am sure they have interest in upstreaming any improvements they make to it. Have you tried keeping the other changes you made in this PR, but keeping |
|
Also: there's no need to open a new PR every time you want to change something, or a check is failing. Just amend the commits. |
I made this conclusion by doing experiments and control variables. The experiments are:
Variables controlled:
Deduction:
Obviously, Electron itself is changed (I guess it was a patch by Obsidian team) between 1 and 2.
Maybe we can try, but I think is less feasible to ask a proprietary software team about this.
I used to use an overlay: https://forum.obsidian.md/t/how-does-obsidian-linux-find-system-secret-storage/113465/2 Secret store worked, spell check still failed.
My bad, I'm not so skillful at rewriting Git history though. |
w-lfchen
left a comment
There was a problem hiding this comment.
enforces Obsidian to use electron_39
you can override it
Obsidian team seems to have patched Electron itself in the updates between v1.11.4 and v1.12.7
proof?
This commit also attempts to improve Electron's secret store auto-detection.
this should be done in a separate commit, maybe even a separate pr.
and shouldn't this be directed at electron?
using obsidian's electron invalidates any nix-specific patches to electron. i am opposed to doing that.
| imagemagick | ||
| ]; | ||
|
|
||
| buildInputs = with pkgs; [ |
There was a problem hiding this comment.
we are in nixpkgs, using pkgs anywhere is just wrong. he derivation is passed to callPackage, which resolves the arguments.
your entire derivation is full of this pattern, and needs to be rewritten without it.
| cp -a ./* $out/share/obsidian/ | ||
|
|
||
| OBSIDIAN_BIN="$out/share/obsidian/obsidian" | ||
| chmod +x "$OBSIDIAN_BIN" |
There was a problem hiding this comment.
shouldn't the binary already be executable?
|
also, your commit description is not long enough. it is clearly missing a recipe for a delicious chocolate cake, please amend the commit accordingly. |
|
I just figured out everything. The bug that I described is not caused by any "patch" from Obsidian team. It is caused by fetchurl,
lib,
makeWrapper,
electron,
makeDesktopItem,
imagemagick,
autoPatchelfHook,
writeScript,
_7zz,
commandLineArgs ? "",
}:
In #510075, Electron was pinned at 39. But since that happened after my update, my version stopped at the broken 41 version. I didn't know the update and assumed I was seeing the bug with Electron 39 when making this PR. The correct fix is simply updating my flakes. I feel extremely sorry about the back and forth and my unreasonable allegations. Please forgive my ignorance and arrogance during the discussion on this issue. I will close this PR right now and there won't be more PRs about this. |
Obsidian's Nix derivation fetches the compiled Obsidian tarball from Obsidian GitHub release. The fetched tarball already has Electron bundled.
Original derivation enforces Obsidian to use
electron_39from Nixpkgs instead of the one comes with it. Obsidian team seems to have patched Electron itself in the updates between v1.11.4 and v1.12.7. Usingelectron_39in Nixpkgs invalidates the patch and causes certain bugs. A known one is https://forum.obsidian.md/t/keyboard-triggered-context-menu-does-not-show-spell-suggestions/114141This commit removes
electron_39and_7zzdependency, making Obsidian depend on the Electron that is complied with it.This commit also attempts to improve Electron's secret store auto-detection. The original detection fails on non-KDE or non-Gnome environments. A wrapper script is added to detect the currently running secret service and set the secret store backend flag instead of relying on matching user's desktop environment. This issue has already been improved in Electron 42: electron/electron#49054. But since Obsidian uses Obsidian 39, this patch is still needed.
Things done
passthru.tests.nixpkgs-reviewon this PR. See nixpkgs-review usage../result/bin/.