-
-
Notifications
You must be signed in to change notification settings - Fork 19.4k
obsidian: use the bundled Electron in Obsidian binary instead of from nixpkgs #519466
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,14 +1,13 @@ | ||
| { | ||
| stdenv, | ||
| fetchurl, | ||
| lib, | ||
| fetchurl, | ||
| makeWrapper, | ||
| electron_39, # as in upstream bundle, see https://github.com/NixOS/nixpkgs/pull/510075 | ||
| autoPatchelfHook, | ||
| makeDesktopItem, | ||
| imagemagick, | ||
| autoPatchelfHook, | ||
| writeScript, | ||
| _7zz, | ||
| pkgs, | ||
| commandLineArgs ? "", | ||
| }: | ||
| let | ||
|
|
@@ -77,22 +76,67 @@ let | |
| makeWrapper | ||
| imagemagick | ||
| ]; | ||
|
|
||
| buildInputs = with pkgs; [ | ||
| stdenv.cc.cc.lib | ||
| alsa-lib | ||
| atk | ||
| at-spi2-atk | ||
| at-spi2-core | ||
| cups | ||
| dbus | ||
| gtk3 | ||
| gsettings-desktop-schemas | ||
| libdrm | ||
| libglvnd | ||
| libsecret | ||
| libxkbcommon | ||
| mesa | ||
| nspr | ||
| nss | ||
| systemd | ||
| vulkan-loader | ||
| libx11 | ||
| libxcomposite | ||
| libxdamage | ||
| libxfixes | ||
| libxrandr | ||
| libxcb | ||
| ]; | ||
|
|
||
| installPhase = '' | ||
| runHook preInstall | ||
| mkdir -p $out/bin | ||
| makeWrapper ${electron_39}/bin/electron $out/bin/obsidian \ | ||
| --add-flags $out/share/obsidian/app.asar \ | ||
|
|
||
| mkdir -p $out/bin $out/share/obsidian | ||
| cp -a ./* $out/share/obsidian/ | ||
|
|
||
| OBSIDIAN_BIN="$out/share/obsidian/obsidian" | ||
| chmod +x "$OBSIDIAN_BIN" | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. shouldn't the binary already be executable? |
||
|
|
||
| makeWrapper "$OBSIDIAN_BIN" $out/bin/obsidian \ | ||
| --run 'if ${pkgs.procps}/bin/pgrep -f "gnome-keyring" >/dev/null 2>&1; then export _OBS_PASS="--password-store=gnome-libsecret"; elif ${pkgs.procps}/bin/pgrep -f "kwallet" >/dev/null 2>&1; then export _OBS_PASS="--password-store=kwallet6"; else export _OBS_PASS=""; fi' \ | ||
| --add-flags "\$_OBS_PASS" \ | ||
| --add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--ozone-platform=wayland --enable-wayland-ime=true --wayland-text-input-version=3}}" \ | ||
| --add-flags ${lib.escapeShellArg commandLineArgs} | ||
| install -m 755 -D obsidian-cli $out/bin/obsidian-cli | ||
| install -m 444 -D resources/app.asar $out/share/obsidian/app.asar | ||
| install -m 444 -D resources/obsidian.asar $out/share/obsidian/obsidian.asar | ||
| install -m 444 -D "${desktopItem}/share/applications/"* \ | ||
| -t $out/share/applications/ | ||
| --add-flags ${lib.escapeShellArg commandLineArgs} \ | ||
| --set LD_LIBRARY_PATH "${ | ||
| lib.makeLibraryPath [ | ||
| pkgs.libglvnd | ||
| pkgs.mesa | ||
| pkgs.vulkan-loader | ||
| pkgs.libsecret | ||
| ] | ||
| }" \ | ||
| --set GSETTINGS_SCHEMA_DIR "${pkgs.gsettings-desktop-schemas}/share/gsettings-schemas/${pkgs.gsettings-desktop-schemas.name}:${pkgs.gtk3}/share/gsettings-schemas/${pkgs.gtk3.name}" \ | ||
| --prefix XDG_DATA_DIRS : "${pkgs.gtk3}/share:${pkgs.gsettings-desktop-schemas}/share" | ||
|
|
||
| install -m 755 -D "$out/share/obsidian/obsidian-cli" $out/bin/obsidian-cli | ||
| install -m 444 -D "${desktopItem}/share/applications/"* -t $out/share/applications/ | ||
|
|
||
| for size in 16 24 32 48 64 128 256 512; do | ||
| mkdir -p $out/share/icons/hicolor/"$size"x"$size"/apps | ||
| magick -background none ${icon} -resize "$size"x"$size" $out/share/icons/hicolor/"$size"x"$size"/apps/obsidian.png | ||
| done | ||
|
|
||
| runHook postInstall | ||
| ''; | ||
|
|
||
|
|
@@ -116,7 +160,6 @@ let | |
| sourceRoot = "${appname}.app"; | ||
| nativeBuildInputs = [ | ||
| makeWrapper | ||
| _7zz | ||
| ]; | ||
| installPhase = '' | ||
| runHook preInstall | ||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.