mirror of
https://github.com/nix-community/home-manager.git
synced 2025-11-08 19:46:05 +01:00
In some setups, this would cause missing Gio modules that cause e.g. Nautilus to not be able to view the XDG trash, and potentially other issues. Fixes:ec8205c3("dconf: set env var") Fixes: #7143 (cherry picked from commitd3a3aee558) Signed-off-by: Austin Horstman <khaneliman12@gmail.com> Co-authored-by: Thomas Mühlbacher <tmuehlbacher@posteo.net>
53 lines
1.4 KiB
Nix
53 lines
1.4 KiB
Nix
{ config, pkgs, ... }:
|
|
|
|
let
|
|
|
|
inherit (pkgs.stdenv.hostPlatform) isDarwin;
|
|
|
|
linuxExpected = ''
|
|
# Only source this once.
|
|
if [ -n "$__HM_SESS_VARS_SOURCED" ]; then return; fi
|
|
export __HM_SESS_VARS_SOURCED=1
|
|
|
|
export LOCALE_ARCHIVE_2_27="${config.i18n.glibcLocales}/lib/locale/locale-archive"
|
|
export V1="v1"
|
|
export V2="v2-v1"
|
|
export XDG_CACHE_HOME="/home/hm-user/.cache"
|
|
export XDG_CONFIG_HOME="/home/hm-user/.config"
|
|
export XDG_DATA_HOME="/home/hm-user/.local/share"
|
|
export XDG_STATE_HOME="/home/hm-user/.local/state"
|
|
|
|
export GIO_EXTRA_MODULES="${pkgs.dconf}/lib/gio/modules''${GIO_EXTRA_MODULES:+:}$GIO_EXTRA_MODULES"
|
|
'';
|
|
|
|
darwinExpected = ''
|
|
# Only source this once.
|
|
if [ -n "$__HM_SESS_VARS_SOURCED" ]; then return; fi
|
|
export __HM_SESS_VARS_SOURCED=1
|
|
|
|
export V1="v1"
|
|
export V2="v2-v1"
|
|
export XDG_CACHE_HOME="/home/hm-user/.cache"
|
|
export XDG_CONFIG_HOME="/home/hm-user/.config"
|
|
export XDG_DATA_HOME="/home/hm-user/.local/share"
|
|
export XDG_STATE_HOME="/home/hm-user/.local/state"
|
|
|
|
'';
|
|
|
|
expected = pkgs.writeText "expected" (if isDarwin then darwinExpected else linuxExpected);
|
|
|
|
in
|
|
{
|
|
config = {
|
|
home.sessionVariables = {
|
|
V1 = "v1";
|
|
V2 = "v2-${config.home.sessionVariables.V1}";
|
|
};
|
|
|
|
nmt.script = ''
|
|
assertFileExists home-path/etc/profile.d/hm-session-vars.sh
|
|
assertFileContent home-path/etc/profile.d/hm-session-vars.sh \
|
|
${expected}
|
|
'';
|
|
};
|
|
}
|