From 85aa624126a93ca37364c1c2f196d9bdaeefedb2 Mon Sep 17 00:00:00 2001 From: Illia Bobyr Date: Mon, 13 Jan 2025 19:09:36 -0800 Subject: [PATCH] nix-profile-daemon.fish: XDG_DATA_DIRS: .profile/share It seems reasonable to add the `share` folder from the user profile into `$XDG_DATA_DIRS` both for daemon and profile execution. Nix could add package shared files into this folder regardless of how the nix daemon itself is running. --- scripts/nix-profile-daemon.fish.in | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/scripts/nix-profile-daemon.fish.in b/scripts/nix-profile-daemon.fish.in index 3d193412a..21a26da7c 100644 --- a/scripts/nix-profile-daemon.fish.in +++ b/scripts/nix-profile-daemon.fish.in @@ -21,14 +21,21 @@ function add_path --argument-names new_path end # Main configuration + +# Set up the per-user profile. + +set NIX_LINK $HOME/.nix-profile + +# Set up environment. +# This part should be kept in sync with nixpkgs:nixos/modules/programs/environment.nix set --export NIX_PROFILES "@localstatedir@/nix/profiles/default $HOME/.nix-profile" # Populate bash completions, .desktop files, etc if test -z "$XDG_DATA_DIRS" # According to XDG spec the default is /usr/local/share:/usr/share, don't set something that prevents that default - set --export XDG_DATA_DIRS "/usr/local/share:/usr/share:/nix/var/nix/profiles/default/share" + set --export XDG_DATA_DIRS "/usr/local/share:/usr/share:$NIX_LINK/share:/nix/var/nix/profiles/default/share" else - set --export XDG_DATA_DIRS "$XDG_DATA_DIRS:/nix/var/nix/profiles/default/share" + set --export XDG_DATA_DIRS "$XDG_DATA_DIRS:$NIX_LINK/share:/nix/var/nix/profiles/default/share" end # Set $NIX_SSL_CERT_FILE so that Nixpkgs applications like curl work. @@ -56,7 +63,8 @@ else end add_path "@localstatedir@/nix/profiles/default/bin" -add_path "$HOME/.nix-profile/bin" +add_path "$NIX_LINK/bin" +set --erase NIX_LINK # Cleanup