mirror of
https://github.com/nix-community/home-manager
synced 2024-11-27 05:29:46 +01:00
xdg: add XDG_*_HOME
variables to systemd.user.sessionVariables
(#2790)
Make sure those variables are set in systemd user services. This mirrors the situation for `XDG_*_DIRS` variables.
This commit is contained in:
parent
e01facc340
commit
a4b0a3faa4
4 changed files with 19 additions and 10 deletions
|
@ -80,18 +80,22 @@ in {
|
|||
};
|
||||
|
||||
config = mkMerge [
|
||||
(mkIf cfg.enable {
|
||||
xdg.cacheHome = mkDefault defaultCacheHome;
|
||||
xdg.configHome = mkDefault defaultConfigHome;
|
||||
xdg.dataHome = mkDefault defaultDataHome;
|
||||
xdg.stateHome = mkDefault defaultStateHome;
|
||||
|
||||
home.sessionVariables = {
|
||||
(let
|
||||
variables = {
|
||||
XDG_CACHE_HOME = cfg.cacheHome;
|
||||
XDG_CONFIG_HOME = cfg.configHome;
|
||||
XDG_DATA_HOME = cfg.dataHome;
|
||||
XDG_STATE_HOME = cfg.stateHome;
|
||||
};
|
||||
in mkIf cfg.enable {
|
||||
xdg.cacheHome = mkDefault defaultCacheHome;
|
||||
xdg.configHome = mkDefault defaultConfigHome;
|
||||
xdg.dataHome = mkDefault defaultDataHome;
|
||||
xdg.stateHome = mkDefault defaultStateHome;
|
||||
|
||||
home.sessionVariables = variables;
|
||||
systemd.user.sessionVariables =
|
||||
mkIf pkgs.stdenv.hostPlatform.isLinux variables;
|
||||
})
|
||||
|
||||
# Legacy non-deterministic setup.
|
||||
|
|
|
@ -11,8 +11,12 @@
|
|||
assertFileContent $envFile ${
|
||||
pkgs.writeText "expected" ''
|
||||
LOCALE_ARCHIVE_2_27=${pkgs.glibcLocales}/lib/locale/locale-archive
|
||||
XDG_CACHE_HOME=/home/hm-user/.cache
|
||||
XDG_CONFIG_DIRS=/etc/xdg:/foo/bar''${XDG_CONFIG_DIRS:+:$XDG_CONFIG_DIRS}
|
||||
XDG_CONFIG_HOME=/home/hm-user/.config
|
||||
XDG_DATA_DIRS=/usr/local/share:/usr/share:/baz/quux''${XDG_DATA_DIRS:+:$XDG_DATA_DIRS}
|
||||
XDG_DATA_HOME=/home/hm-user/.local/share
|
||||
XDG_STATE_HOME=/home/hm-user/.local/state
|
||||
''
|
||||
}
|
||||
|
||||
|
|
|
@ -1,3 +0,0 @@
|
|||
LOCALE_ARCHIVE_2_27=@glibcLocales@/lib/locale/locale-archive
|
||||
V_int=1
|
||||
V_str=2
|
|
@ -15,6 +15,10 @@
|
|||
LOCALE_ARCHIVE_2_27=${pkgs.glibcLocales}/lib/locale/locale-archive
|
||||
V_int=1
|
||||
V_str=2
|
||||
XDG_CACHE_HOME=/home/hm-user/.cache
|
||||
XDG_CONFIG_HOME=/home/hm-user/.config
|
||||
XDG_DATA_HOME=/home/hm-user/.local/share
|
||||
XDG_STATE_HOME=/home/hm-user/.local/state
|
||||
''
|
||||
}
|
||||
'';
|
||||
|
|
Loading…
Reference in a new issue