Skip to content
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

zotero can't open pdf/open links #48814

Closed
teto opened this issue Oct 22, 2018 · 18 comments
Closed

zotero can't open pdf/open links #48814

teto opened this issue Oct 22, 2018 · 18 comments

Comments

@teto
Copy link
Member

teto commented Oct 22, 2018

Issue description

I've installed zotero via nix-env and met 2 annoying problems:

  • (zotero:2956): WARNING **: Could not launch default application for URI: Operation not supported => can't click on links
  • and
qt.qpa.plugin: Could not find the Qt platform plugin "xcb" in ""
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

which prevents me from opening pdfs for some reason :/

Steps to reproduce

Install zotero and try to open pdf/click link.

Technical details

nixos-unstable/sandboxed mode.

@Ma27
Copy link
Member

Ma27 commented Oct 30, 2018

currently building this locally, I'll try to reproduce it :)

@Ma27
Copy link
Member

Ma27 commented Oct 30, 2018

regarding the URL opening issue, thebig problem with zotero is that it seems to love hardcoding things into /usr/bin, so the easiest workaround is to add all of the needed things into our artificial FHS environment:

diff --git a/pkgs/applications/office/zotero/default.nix b/pkgs/applications/office/zotero/default.nix
index b070958b756..29172bff28e 100644
--- a/pkgs/applications/office/zotero/default.nix
+++ b/pkgs/applications/office/zotero/default.nix
@@ -1,7 +1,7 @@
 { stdenv, fetchurl, buildFHSUserEnv, makeDesktopItem, runCommand, bash, wrapGAppsHook, gsettings-desktop-schemas, gtk3, gnome3 }:
 
 let
-version = "5.0.35.1";
+version = "5.0.57";
 meta = with stdenv.lib; {
   homepage = https://www.zotero.org;
   description = "Collect, organize, cite, and share your research sources";
@@ -15,7 +15,7 @@ zoteroSrc = stdenv.mkDerivation rec {
 
   src = fetchurl {
     url = "https://download.zotero.org/client/release/${version}/Zotero-${version}_linux-x86_64.tar.bz2";
-    sha256 = "0d2imvp84svllrnja1dl4nldp634z632g5xkm2q9v7j3dwbzw1hw";
+    sha256 = "030x780cz178wrd2q75yzibcz9wnxxyb12bblvcjpdsjrd09d5ij";
   };
 
   buildInputs= [ wrapGAppsHook gsettings-desktop-schemas gtk3 gnome3.adwaita-icon-theme gnome3.dconf ];
@@ -34,7 +34,7 @@ fhsEnv = buildFHSUserEnv {
   targetPkgs = pkgs: with pkgs; with xorg; [
     gtk3 dbus-glib
     libXt nss
-    libX11
+    libX11 xdg_utils coreutils firefox which
   ];
 };

But the question is if the can't provide a better solution, we shouldn't force folks to use firefox,but $BROWSER in general, however we can't add all browsers into the FHS closure and I'm currently not sure whatto do about this, but such a patch may solve at least your issues :)

@iimog
Copy link
Member

iimog commented Nov 1, 2018

@Ma27 thanks for looking into this. Had the same problem as @teto and can confirm that on my system your solution works. I also added evince to the list of targetPkgs to have pdfs opened there. I see that this is not the best generic solution. Might it be possible to add just the basics (xdg_utils, coreutils, which) by default and controll additional tools like browser or pdf viewer via overlays? This would probably need documentation... Or maybe provide a default browser/pdf viewer and have it adjustable via overlay?

@teto
Copy link
Member Author

teto commented Nov 1, 2018

thanks for looking into it. Zotero is open source any reason we use a FHS ? I am not familiar with FSH much but it seems to be a pain/break normal expectations.
I guess it's because it relies on firefox one way or another and is not easy to build ?

@Ma27
Copy link
Member

Ma27 commented Nov 1, 2018

@iimog yeah, I thought which packages to add, but I'm not entirely sure how to proceed here.

@teto I had a look into the history of the derivation and it seems as this decision was taken intentionally to work around the excessive /usr/bin usage. There are several examples of package types (such as electron applications) that are fairly hard to build from source, maybe zotero is a similar case. In the long term I guess that this is the best solution (and also avoids FHS hackery), but I'm not sure when I have sufficient time to look into the source and package build (given that it seems to be quite an effort). If you want to do this, feel free, otherwise I'd try to reserve some time to give it a try :)

@teto
Copy link
Member Author

teto commented Nov 9, 2018

My focus is now on trying to sync my zotero files via webfs otherwise I will fallback on mendeley (which doesn't fully work either and is closed source arg..). I have been trying to use nextcloud but while it works locally, I have some trouble installing it on my server.

Getting rid of the FHS would be better but yeah it's probably quite an effort as zotero is firefox-based (if i get it right). Until I can sync my zotero files via webfs, I can't really ask anything from you so no pressure :)

@Ma27
Copy link
Member

Ma27 commented Nov 9, 2018

whats the problem with the sync? A missing library as well or is there a reported upstream bug? I guess for now it's the best solution IMHO to override targetPkgs of the FHS expression until somebody (maybe me in the next weeks, hopefully) actually implements a source build for this package.

Regarding nextcloud: we can talk in the IRC if you're experiencing issues, I may help (running nextcloud for ~2 months successfully on one of my NixOS servers :))

@teto
Copy link
Member Author

teto commented Nov 13, 2018

no problem, just you are limited to 300M in the freeplan and I needed more space but I don't want to pay for it. I managed to make nextcloud work, just need to try it with zotero now.

@teto
Copy link
Member Author

teto commented Nov 22, 2018

zotero's webfs sync work perfectly with nextcloud so consider me interested in an improved zotero :)

@lambdafu
Copy link
Contributor

I just encountered this bug, but I am pretty much a NixOS noob. Maybe it's possible to replace the firefox in the FHS with a script that calls xdg-open?

@Ma27
Copy link
Member

Ma27 commented Dec 11, 2018

Yeah that's an idea. I'm not sure anymore how exactly this worked (it's been a while since I debugged this), but IMHO this is something that could go upstream as well :)

@matthewbauer
Copy link
Member

Discussion on this issue is in #42893.

@NickHu
Copy link
Contributor

NickHu commented Jan 27, 2019

@matthewbauer The solution described in #42893 doesn't seem to work for me, I'm still unable to get zotero to launch okular

@matthewbauer matthewbauer reopened this Jan 27, 2019
@NickHu
Copy link
Contributor

NickHu commented Jan 28, 2019

I managed to get zotero to launch okular (both installed system-wide) without modifying either derivation and setting QT_QPA_PLATFORM_PLUGIN_PATH=/run/current-system/sw/lib/qt-5.12/plugins

@timor
Copy link
Member

timor commented Jan 28, 2019

@NickHu

... and setting QT_QPA_PLATFORM_PLUGIN_PATH=/run/current-system/sw/lib/qt-5.12/plugins

Could you tell me where exactly you set that?

@knedlsepp
Copy link
Member

Let's hope for #54525 to fix this

@NickHu
Copy link
Contributor

NickHu commented Feb 2, 2019

@NickHu

... and setting QT_QPA_PLATFORM_PLUGIN_PATH=/run/current-system/sw/lib/qt-5.12/plugins

Could you tell me where exactly you set that?

In $HOME/.xprofile, add something like

export QT_QPA_PLATFORM_PLUGIN_PATH=/run/current-system/sw/lib/qt-5.12/plugins

@teto
Copy link
Member Author

teto commented Aug 2, 2019

i don't use zotero anymore, I suppose this has been fixed.

@teto teto closed this as completed Aug 2, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants