Is your feature request related to a problem? Please describe.
According to the spec $XDG_DATA_DIRS defaults to /usr/local/share:/usr/share if it's not explicitly set. So consider a barebones config'd system where $XDG_DATA_DIRS is not set. Most apps still work just fine since they just use the default. But whenever I do nix-shell, it tries to append the nix store specific data dir to the non existent $XDG_DATA_DIRS variable - so now $XDG_DATA_DIRS gets set to a value that just contains the nix store path and not the default path.
This means that when I start up a gtk app from my own system that is not included within the nix derivation, I get errors like "GSETTINGS schemas are not installed". I realize that I could just include every single dependency in the nix derivation to fix this. But I'd rather prefer using what I already have on my system.
Example:-
I'm on an arch linux machine with minimal config. $XDG_DATA_DIRS is not defined in my environment. But I do have all the schemas needed in /usr/share/. So VSCode works fine here. However, after I do nix-shell with a minimal shell.nix-
{ pkgs ? import <nixpkgs> {} }:
pkgs.mkShell {
nativeBuildInputs = [ ];
}
I notice that $XDG_DATA_DIRS is now set to /nix/store/<hash>-patchelf-0.14.3/share. I fire up VSCode and it just dies whenever it needs to access GSETTINGS schemas.
Describe the solution you'd like
Prior to appending paths to $XDG_DATA_DIRS, if the variable is not defined already, it should be set to /usr/local/share:/usr/share first.
Describe alternatives you've considered
I could add gtk dependencies and wrapGAppHook to the nix shell. Or, more likely, I could define $XDG_DATA_DIRS to its default value explicitly. So that nix appends to that default value, preserving both the nix store path and the system path.
Additional context
N/A
Is your feature request related to a problem? Please describe.
According to the spec
$XDG_DATA_DIRSdefaults to/usr/local/share:/usr/shareif it's not explicitly set. So consider a barebones config'd system where$XDG_DATA_DIRSis not set. Most apps still work just fine since they just use the default. But whenever I donix-shell, it tries to append the nix store specific data dir to the non existent$XDG_DATA_DIRSvariable - so now$XDG_DATA_DIRSgets set to a value that just contains the nix store path and not the default path.This means that when I start up a gtk app from my own system that is not included within the
nixderivation, I get errors like "GSETTINGS schemas are not installed". I realize that I could just include every single dependency in the nix derivation to fix this. But I'd rather prefer using what I already have on my system.Example:-
I'm on an arch linux machine with minimal config.
$XDG_DATA_DIRSis not defined in my environment. But I do have all the schemas needed in/usr/share/. So VSCode works fine here. However, after I donix-shellwith a minimalshell.nix-I notice that
$XDG_DATA_DIRSis now set to/nix/store/<hash>-patchelf-0.14.3/share. I fire up VSCode and it just dies whenever it needs to access GSETTINGS schemas.Describe the solution you'd like
Prior to appending paths to
$XDG_DATA_DIRS, if the variable is not defined already, it should be set to/usr/local/share:/usr/sharefirst.Describe alternatives you've considered
I could add gtk dependencies and
wrapGAppHookto the nix shell. Or, more likely, I could define$XDG_DATA_DIRSto its default value explicitly. So that nix appends to that default value, preserving both the nix store path and the system path.Additional context
N/A