mirror of
https://github.com/nix-community/home-manager
synced 2024-11-30 06:59:45 +01:00
xsession: prepare for session in ~/.xprofile
This works around the way NixOS starts up the systemd graphical session target.
This commit is contained in:
parent
b78b2b6b35
commit
3346c7f455
1 changed files with 22 additions and 3 deletions
|
@ -58,6 +58,12 @@ in
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
profileExtra = mkOption {
|
||||||
|
type = types.lines;
|
||||||
|
default = "";
|
||||||
|
description = "Extra shell commands to run before session start.";
|
||||||
|
};
|
||||||
|
|
||||||
initExtra = mkOption {
|
initExtra = mkOption {
|
||||||
type = types.lines;
|
type = types.lines;
|
||||||
default = "";
|
default = "";
|
||||||
|
@ -139,14 +145,14 @@ in
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
home.file.".xsession" = {
|
home.file.".xprofile".text = ''
|
||||||
mode = "555";
|
|
||||||
text = ''
|
|
||||||
if [[ -e "$HOME/.profile" ]]; then
|
if [[ -e "$HOME/.profile" ]]; then
|
||||||
. "$HOME/.profile"
|
. "$HOME/.profile"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# If there are any running services from a previous session.
|
# If there are any running services from a previous session.
|
||||||
|
# Need to run this in xprofile because the NixOS xsession
|
||||||
|
# script starts up graphical-session.target.
|
||||||
systemctl --user stop graphical-session.target graphical-session-pre.target
|
systemctl --user stop graphical-session.target graphical-session-pre.target
|
||||||
|
|
||||||
systemctl --user import-environment DBUS_SESSION_BUS_ADDRESS
|
systemctl --user import-environment DBUS_SESSION_BUS_ADDRESS
|
||||||
|
@ -157,6 +163,19 @@ in
|
||||||
systemctl --user import-environment XDG_RUNTIME_DIR
|
systemctl --user import-environment XDG_RUNTIME_DIR
|
||||||
systemctl --user import-environment XDG_SESSION_ID
|
systemctl --user import-environment XDG_SESSION_ID
|
||||||
|
|
||||||
|
${cfg.profileExtra}
|
||||||
|
|
||||||
|
export HM_XPROFILE_SOURCED=1
|
||||||
|
'';
|
||||||
|
|
||||||
|
home.file.".xsession" = {
|
||||||
|
mode = "555";
|
||||||
|
text = ''
|
||||||
|
if [[ ! -v HM_XPROFILE_SOURCED ]]; then
|
||||||
|
. ~/.xprofile
|
||||||
|
fi
|
||||||
|
unset HM_XPROFILE_SOURCED
|
||||||
|
|
||||||
systemctl --user start hm-graphical-session.target
|
systemctl --user start hm-graphical-session.target
|
||||||
|
|
||||||
${cfg.initExtra}
|
${cfg.initExtra}
|
||||||
|
|
Loading…
Reference in a new issue