I’ve been using NixOS for a little less than 2 weeks and have really settled into it, but there’s a weird issue I’ve experienced. I was setting up XDG Desktop Portals to get screen recording/sharing to work but I stumbled upon this:
xdg-desktop-portal.service fails with xdg-desktop-portal.service: Unable to locate executable '/usr/lib/xdg-desktop-portal': No such file or directory and then xdg-desktop-portal.service: Failed at step EXEC spawning /usr/lib/xdg-desktop-portal: No such file or directory.
Initially I worked around this by creating the following activation script that linked the executable to /usr/lib:
This worked. But I decided to revisit this issue yesterday when another issue popped up (also because there HAS to be something I’m doing wrong and using this activation script can’t be the only solution): OBS studio recordings using the pipewire screen capture which would work perfectly until then, started freezing on a single frame of the recording. Same with streams via Discord (Vesktop).
But well, all I’m asking about is that first issue. If resolving it doesn’t fix the other issue, I’ll probably make a separate topic for it.
One other thing, here’s my xdg.portal in my configuration.nix:
Doesn’t change anything for me. I’m just not sure what to do or where to even ask. This shouldn’t be happening. I’m starting to think that something is wrong with my installation and the activation script might be the only “fix”.
Cool, there’s the issue, but NixOS configuration.nix is the only way I’m doing anything related to xdg-desktop-portals. So if I edit it won’t this file just be regenerated wrong on nixos-rebuild switch?
It shouldn’t be. Wonder how it ended up there in the first place, the canonical location for that file is /etc/systemd/user/xdg-desktop-portal.service. All user units installed by NixOS should be in that directory; you probably have another copy there, but the user-installed file overrides it.
You must have either copied it from an old host (maybe stow, or perhaps you kept a home partition from a previous install?) or used home-manager to put it there. Or some weird autofix feature in a program you use? I don’t know, the fact that that file exists is bizzarre to me.
The NixOS-installed unit looks very different, too, it depends on dbus (arguably incorrectly, Type=dbus does do that automatically). No idea where your unit came from, looks like it’s from another distro.
Huh. I see. Yeah. Now I see exactly what the problem is. I forgot to delete .config/systemd from my backup dotfiles! It stowed and ruined everything. Thanks for the help.