1
0
Fork 0
mirror of https://github.com/nix-community/home-manager synced 2024-11-10 13:19:44 +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:
Robert Helgesson 2017-10-21 14:37:30 +02:00
parent b78b2b6b35
commit 3346c7f455
No known key found for this signature in database
GPG key ID: C3DB11069E65DC86

View file

@ -58,6 +58,12 @@ in
'';
};
profileExtra = mkOption {
type = types.lines;
default = "";
description = "Extra shell commands to run before session start.";
};
initExtra = mkOption {
type = types.lines;
default = "";
@ -139,14 +145,14 @@ in
};
};
home.file.".xsession" = {
mode = "555";
text = ''
home.file.".xprofile".text = ''
if [[ -e "$HOME/.profile" ]]; then
. "$HOME/.profile"
fi
# 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 import-environment DBUS_SESSION_BUS_ADDRESS
@ -157,6 +163,19 @@ in
systemctl --user import-environment XDG_RUNTIME_DIR
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
${cfg.initExtra}