mirror of
https://github.com/nix-community/home-manager
synced 2024-12-24 18:59:47 +01:00
xsession: cleanup systemd variables (#3636)
This commit is contained in:
parent
e34fbe1801
commit
78ceec68f2
3 changed files with 9 additions and 2 deletions
|
@ -78,6 +78,7 @@ in {
|
|||
|
||||
importedVariables = mkOption {
|
||||
type = types.listOf (types.strMatching "[a-zA-Z_][a-zA-Z0-9_]*");
|
||||
apply = unique;
|
||||
example = [ "GDK_PIXBUF_ICON_LOADER" ];
|
||||
visible = false;
|
||||
description = ''
|
||||
|
@ -184,7 +185,7 @@ in {
|
|||
|
||||
${optionalString (cfg.importedVariables != [ ])
|
||||
("systemctl --user import-environment "
|
||||
+ toString (unique cfg.importedVariables))}
|
||||
+ escapeShellArgs cfg.importedVariables)}
|
||||
|
||||
${cfg.profileExtra}
|
||||
|
||||
|
@ -212,6 +213,10 @@ in {
|
|||
while [ -n "$(systemctl --user --no-legend --state=deactivating list-units)" ]; do
|
||||
sleep 0.5
|
||||
done
|
||||
|
||||
${optionalString (cfg.importedVariables != [ ])
|
||||
("systemctl --user unset-environment "
|
||||
+ escapeShellArgs cfg.importedVariables)}
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
|
|
@ -9,7 +9,7 @@ fi
|
|||
# script starts up graphical-session.target.
|
||||
systemctl --user stop graphical-session.target graphical-session-pre.target
|
||||
|
||||
systemctl --user import-environment DBUS_SESSION_BUS_ADDRESS DISPLAY SSH_AUTH_SOCK XAUTHORITY XDG_DATA_DIRS XDG_RUNTIME_DIR XDG_SESSION_ID EXTRA_IMPORTED_VARIABLE
|
||||
systemctl --user import-environment 'DBUS_SESSION_BUS_ADDRESS' 'DISPLAY' 'SSH_AUTH_SOCK' 'XAUTHORITY' 'XDG_DATA_DIRS' 'XDG_RUNTIME_DIR' 'XDG_SESSION_ID' 'EXTRA_IMPORTED_VARIABLE'
|
||||
|
||||
profile extra commands
|
||||
|
||||
|
|
|
@ -16,3 +16,5 @@ systemctl --user stop graphical-session-pre.target
|
|||
while [ -n "$(systemctl --user --no-legend --state=deactivating list-units)" ]; do
|
||||
sleep 0.5
|
||||
done
|
||||
|
||||
systemctl --user unset-environment 'DBUS_SESSION_BUS_ADDRESS' 'DISPLAY' 'SSH_AUTH_SOCK' 'XAUTHORITY' 'XDG_DATA_DIRS' 'XDG_RUNTIME_DIR' 'XDG_SESSION_ID' 'EXTRA_IMPORTED_VARIABLE'
|
||||
|
|
Loading…
Reference in a new issue