xsession: add option xsession.scriptPath

This option allows overriding the default script path `~/.xsession`.
On NixOS, this is needed to allow multiple possible graphical login
sessions.

Fixes #391.

(cherry picked from commit 9f0fdc68a9)
This commit is contained in:
Robert Helgesson 2018-09-15 22:49:53 +02:00
parent f3c02513a9
commit 451f376231
No known key found for this signature in database
GPG key ID: 36BDAA14C2797E89

View file

@ -15,6 +15,16 @@ in
xsession = {
enable = mkEnableOption "X Session";
scriptPath = mkOption {
type = types.str;
default = ".xsession";
example = ".xsession-hm";
description = ''
Path, relative <envar>HOME</envar>, where Home Manager
should write the X session script.
'';
};
windowManager.command = mkOption {
type = types.str;
example = literalExample ''
@ -117,7 +127,7 @@ in
export HM_XPROFILE_SOURCED=1
'';
home.file.".xsession" = {
home.file.${cfg.scriptPath} = {
executable = true;
text = ''
if [[ ! -v HM_XPROFILE_SOURCED ]]; then