aboutsummaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorRobert Helgesson <robert@rycee.net>2017-10-21 14:37:30 +0200
committerRobert Helgesson <robert@rycee.net>2017-10-21 14:37:30 +0200
commit3346c7f455d34a3b7c704ceff8000a74960aa86d (patch)
tree82becd06785d9ed3cf9f97f385cc9af3f12df5b7 /modules
parentb78b2b6b35bc87a032334cb8ef0cbf30fed64ad6 (diff)
xsession: prepare for session in `~/.xprofile`
This works around the way NixOS starts up the systemd graphical session target.
Diffstat (limited to 'modules')
-rw-r--r--modules/xsession.nix25
1 files changed, 22 insertions, 3 deletions
diff --git a/modules/xsession.nix b/modules/xsession.nix
index 5c9ee777881..dde0a7fe6b4 100644
--- a/modules/xsession.nix
+++ b/modules/xsession.nix
@@ -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}