NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
17.87k stars 13.94k forks source link

Libreoffice `.desktop` files not installed in user environment #34806

Closed samdroid-apps closed 6 years ago

samdroid-apps commented 6 years ago

Issue description

The libreoffice .desktop files do not appear to be properly installed in the user path. This creates the following problems:

Steps to reproduce

Add libreoffice-fresh to user environment

Open gnome shell overview, notice libreoffice is not listed

Analysis

Running find on the environment, we can see that libreoffice's desktop files are not linked into the environment:

> find /etc/per-user-pkgs/sam/share | grep office
/etc/per-user-pkgs/sam/share/gsettings-schemas/collected-for-libreoffice
/etc/per-user-pkgs/sam/share/gsettings-schemas/collected-for-libreoffice/glib-2.0
/etc/per-user-pkgs/sam/share/gsettings-schemas/collected-for-libreoffice/glib-2.0/schemas
/etc/per-user-pkgs/sam/share/icons/soffice.ico

Visiting the libreoffice path (aka cd $(dirname $(readlink $(which libreoffice)))), we can see that /share/applications is linked to /lib/libreoffice/share/xdg. That contains the expected .desktop files.

However, these files are never linked into the user environment.

I believe that the buildenv builder is broken by applications being a symlink, as it iterates over the whole collection of files with their real paths (rather than with the symlink). But I'm not amazing with perl; so that is just speculation.

Technical details

jtojnar commented 6 years ago

On 6c064e6b1f3, I can see the desktop files under ~/.nix-profile/share/applications when I install LibreOffice using nix-env -f '<nixpkgs>' -iA libreoffice-fresh:

$ la ~/.nix-profile/share/applications/ | grep libreoffice
lrwxrwxrwx  1 root root   95 Jan  1  1970 base.desktop -> /nix/store/aigkflj6qimc6gl3naqwx7xk1np99ipz-libreoffice-6.0.2.1/share/applications/base.desktop
lrwxrwxrwx  1 root root   95 Jan  1  1970 calc.desktop -> /nix/store/aigkflj6qimc6gl3naqwx7xk1np99ipz-libreoffice-6.0.2.1/share/applications/calc.desktop
lrwxrwxrwx  1 root root   95 Jan  1  1970 draw.desktop -> /nix/store/aigkflj6qimc6gl3naqwx7xk1np99ipz-libreoffice-6.0.2.1/share/applications/draw.desktop
lrwxrwxrwx  1 root root   98 Jan  1  1970 impress.desktop -> /nix/store/aigkflj6qimc6gl3naqwx7xk1np99ipz-libreoffice-6.0.2.1/share/applications/impress.desktop
lrwxrwxrwx  1 root root   95 Jan  1  1970 math.desktop -> /nix/store/aigkflj6qimc6gl3naqwx7xk1np99ipz-libreoffice-6.0.2.1/share/applications/math.desktop
lrwxrwxrwx  1 root root   97 Jan  1  1970 qstart.desktop -> /nix/store/aigkflj6qimc6gl3naqwx7xk1np99ipz-libreoffice-6.0.2.1/share/applications/qstart.desktop
lrwxrwxrwx  1 root root  102 Jan  1  1970 startcenter.desktop -> /nix/store/aigkflj6qimc6gl3naqwx7xk1np99ipz-libreoffice-6.0.2.1/share/applications/startcenter.desktop
lrwxrwxrwx  1 root root   97 Jan  1  1970 writer.desktop -> /nix/store/aigkflj6qimc6gl3naqwx7xk1np99ipz-libreoffice-6.0.2.1/share/applications/writer.desktop
lrwxrwxrwx  1 root root  101 Jan  1  1970 xsltfilter.desktop -> /nix/store/aigkflj6qimc6gl3naqwx7xk1np99ipz-libreoffice-6.0.2.1/share/applications/xsltfilter.desktop

I can see them in the GNOME Shell Applications menu as well.

What is missing, however, are icons. I suppose that is because the expression replaces Icon=libreofficedev6.0-, while the files contain Icon=libreoffice6.0-. cc @7c6f434c

7c6f434c commented 6 years ago

@jtojnar You are right.

But this should be fix in the actual Libreoffice expression and not in the cheap-to-change wrapper… Sigh. I think it is time to update LO anyway, and I don't want to change the icon handling separately myself, but I also don't think I will even start looking at doing the update before end of the week (Thursday?). If anyone wants to either update the regular expression to libreoffice(dev)? and test this, or update LibreOffice, or both — please push it if it builds and starts (if you have push access) or ping me in the PR otherwise.

jtojnar commented 6 years ago

Fixed by https://github.com/NixOS/nixpkgs/commit/1cb0cfba0197e305a39fdafc92f4d8e6d5f220a3#diff-59f30d5fac3f23fc5d24fd476803c5beR187