Missing links in `/run/current-system/sw/share`

Hi

I recently noticed a strange behavior on NixOS, and I would like to understand it and find a workaround.

I have 2 NixOS installed, a desktop (with gnome) and a server (headless, no xserver), I noticed that on my server the /run/current-system/sw/share is missing a bunch of symlinks. I noticed it because I enabled autojump plugin to my zsh config, and on my server, the plugin is not able to load the autojump configuration file. The file /run/current-system/sw/share/autojump/autojump.zsh exists on my desktop, and doesn’t on my server.

I was able to reproduce this with a virtual machine.

First I install a simple nixos with autojump package

  environment.systemPackages = with pkgs; [ autojump ];

The autojump symlink is not created. There is not a single symlink created.

ls -l /run/current-system/sw/share

total 112
dr-xr-xr-x  2 root root 4096  1 janv.  1970 appdata
dr-xr-xr-x  2 root root 4096  1 janv.  1970 applications
dr-xr-xr-x  3 root root 4096  1 janv.  1970 bash-completion
dr-xr-xr-x  5 root root 4096  1 janv.  1970 dbus-1
dr-xr-xr-x  2 root root 4096  1 janv.  1970 desktop-directories
dr-xr-xr-x  2 root root 4096  1 janv.  1970 doc
dr-xr-xr-x  2 root root 4096  1 janv.  1970 emacs
dr-xr-xr-x  2 root root 4096  1 janv.  1970 hunspell
dr-xr-xr-x  3 root root 4096  1 janv.  1970 icons
dr-xr-xr-x  2 root root 4096  1 janv.  1970 info
dr-xr-xr-x  2 root root 4096  1 janv.  1970 kservices5
dr-xr-xr-x  2 root root 4096  1 janv.  1970 kservicetypes5
dr-xr-xr-x  2 root root 4096  1 janv.  1970 kxmlgui5
dr-xr-xr-x 19 root root 4096  1 janv.  1970 man
dr-xr-xr-x  2 root root 4096  1 janv.  1970 metainfo
dr-xr-xr-x 15 root root 4096  1 janv.  1970 mime
dr-xr-xr-x  2 root root 4096  1 janv.  1970 nano
dr-xr-xr-x  2 root root 4096  1 janv.  1970 org
dr-xr-xr-x  2 root root 4096  1 janv.  1970 pixmaps
dr-xr-xr-x  4 root root 4096  1 janv.  1970 polkit-1
dr-xr-xr-x  2 root root 4096  1 janv.  1970 sounds
dr-xr-xr-x  2 root root 4096  1 janv.  1970 systemd
dr-xr-xr-x  2 root root 4096  1 janv.  1970 terminfo
dr-xr-xr-x  2 root root 4096  1 janv.  1970 themes
dr-xr-xr-x  2 root root 4096  1 janv.  1970 thumbnailers
dr-xr-xr-x  2 root root 4096  1 janv.  1970 vim-plugins
dr-xr-xr-x  2 root root 4096  1 janv.  1970 vulkan
dr-xr-xr-x  3 root root 4096  1 janv.  1970 zsh

But is I install Gnome desktop with

  services.xserver.desktopManager.gnome.enable = true;
  services.xserver.displayManager.gdm.enable = true;

I get the autojump symlinks (and many other symlinks) …

ls -l /run/current-system/sw/share

[...]
lrwxrwxrwx   1 root root   74  1 janv.  1970 autojump -> /nix/store/75vxv4ibjlimcwyhvgl6cv9xa50xm5nj-autojump-22.5.3/share/autojump
[...]

I imagine there is a reason for this, but could someone explain it to me?
And is there a way to force the symlinks creation on headless installs?

Thanks

1 Like

This is fallout from this bug: DEs probably shouldn't link `/share` · Issue #47173 · NixOS/nixpkgs · GitHub

Some desktop environments set environment.pathsToLink = ["/share"];.

1 Like

Thanks for the link :+1:

If I understand well, there is a first “bug”, DE should add only needed links (and autojump is not in my case).

So there is should be a second “bug”: autojump should add it’s own link to share?

By the way @jtojnar thanks again because I found the workaround I was looking for :slight_smile:

  environment.pathsToLink = [ 
    "/share/autojump"
  ]; 
1 Like