diff --git a/modules/xsession.nix b/modules/xsession.nix
index 93b3dbf9e..6dc2968a6 100644
--- a/modules/xsession.nix
+++ b/modules/xsession.nix
@@ -18,11 +18,21 @@ in {
default = ".xsession";
example = ".xsession-hm";
description = ''
- Path, relative HOME, where Home Manager
+ Path, relative to HOME, where Home Manager
should write the X session script.
'';
};
+ profilePath = mkOption {
+ type = types.str;
+ default = ".xprofile";
+ example = ".xprofile-hm";
+ description = ''
+ Path, relative to HOME, where Home Manager
+ should write the X profile script.
+ '';
+ };
+
windowManager.command = mkOption {
type = types.str;
example = literalExample ''
@@ -129,7 +139,7 @@ in {
};
};
- home.file.".xprofile".text = ''
+ home.file.${cfg.profilePath}.text = ''
. "${config.home.profileDirectory}/etc/profile.d/hm-session-vars.sh"
if [ -e "$HOME/.profile" ]; then
@@ -154,7 +164,7 @@ in {
executable = true;
text = ''
if [ -z "$HM_XPROFILE_SOURCED" ]; then
- . ~/.xprofile
+ . "${config.home.homeDirectory}/${cfg.profilePath}"
fi
unset HM_XPROFILE_SOURCED
diff --git a/tests/modules/misc/xsession/basic-xsession-expected.txt b/tests/modules/misc/xsession/basic-xsession-expected.txt
index c11b7c330..423e7779c 100644
--- a/tests/modules/misc/xsession/basic-xsession-expected.txt
+++ b/tests/modules/misc/xsession/basic-xsession-expected.txt
@@ -1,5 +1,5 @@
if [ -z "$HM_XPROFILE_SOURCED" ]; then
- . ~/.xprofile
+ . "/home/hm-user/.xprofile"
fi
unset HM_XPROFILE_SOURCED