Fixing Dolphin Application Associations After Installing Nix on Arch/Hyprland

2026-08-22
93 views
2988 chars
dolphin
issue

H1TL;DR

Nix changes $XDG_DATA_DIRS, which invalidates the KSycoca cache and prevents Dolphin from opening files with their associated applications. Rebuild the cache with kbuildsycoca6 --noincremental to fix it.

H1Background

I use Arch Linux and installed Nix on it about two months ago to learn more about it. Later, I noticed that Dolphin worked inconsistently: sometimes it could not open files with their associated applications, and I could not choose an application manually either. At first, I assumed this was a conflict between Hyprland and Dolphin, but eventually it became frustrating enough that I began investigating.

H1Investigation

I first checked $XDG_MENU_PREFIX. Outside a KDE desktop environment, the required .menu files for Dolphin are not generated automatically. The archlinux-xdg-menu package must be installed to generate them, and $XDG_MENU_PREFIX must be set to arch- instead of plasma-.

The relevant files are located in /etc/xdg/menus/:

shell
⋊> ~ ls -l /etc/xdg/menus 17:38:14 total 48 drwxr-xr-x 1 root root 30 Mar 2 18:10 applications-merged/ -rw-r--r-- 1 root root 3544 Jan 8 2026 arch-applications.menu -rw-r--r-- 1 root root 5705 Apr 21 13:21 lxqt-applications-compact.menu -rw-r--r-- 1 root root 4060 Apr 21 13:21 lxqt-applications-fm.menu -rw-r--r-- 1 root root 5526 Apr 21 13:21 lxqt-applications.menu -rw-r--r-- 1 root root 2219 Apr 21 13:21 lxqt-config.menu -rw-r--r-- 1 root root 5549 Apr 21 13:21 lxqt-panel-applications.menu -rw-r--r-- 1 root root 9904 Aug 5 15:51 plasma-applications.menu ⋊> ~ # plasma-applications.menu is generated automatically in a KDE environment # arch-applications.menu is generated by archlinux-xdg-menu

This configuration was correct, but Dolphin still could not open files normally, so I continued checking other settings.

H1Finding the Cause

Inspecting the environment variables showed:

shell
⋊> ~ echo "$XDG_DATA_DIRS" /usr/local/share:/usr/share:/home/dragonren/.nix-profile/share:/nix/var/nix/profiles/default/share

The Nix paths stood out, so I suspected a conflict caused by the changed paths.

I then tried running:

shell
env XDG_DATA_DIRS=/usr/local/share:/usr/share dolphin

Dolphin worked normally again, strongly suggesting that the issue was caused by Nix modifying this variable.

The purpose of this behavior in Nix's official script is clearly to include additional data directories automatically. During the investigation, Dolphin could still recognize MIME types correctly, so this was not a MIME-type issue; it was more likely an application-association issue.

I then debugged Dolphin and found the following log:

log
[2.341 debug kf.service.services] query for mimeType "application/zip" returning 0 offers

Application associations are provided by KService / KSycoca, so I inferred that KService was the source of the problem. KSycoca builds its cache using $XDG_DATA_DIRS. After Nix adds new paths, it may try to read a different cache file:

log
Opening ksycoca from "/home/dragonren/.cache/ksycoca6_en_o72+Pq+2OmLMTz2+ouIXYbB7LU8="

Therefore, changing $XDG_DATA_DIRS had almost certainly invalidated the original cache.

H1Solution

Rebuild the cache with:

shell
kbuildsycoca6 --noincremental
  • If your environment changes frequently or the cache is often invalidated, consider a cron job or systemd timer.
  • You can also add this command directly to Hyprland's startup configuration (exec-once).

Problem solved.

Contents

No headings found