1
0
mirror of https://github.com/nix-community/home-manager synced 2024-06-18 12:38:30 +02:00

xsession: Add profilePath configuration option (#2140)

This allows the user to move .xprofile somewhere else, which can help
with decluttering their home directory.
This commit is contained in:
Lava 2021-06-28 22:11:15 +07:00 committed by GitHub
parent dc4337d9fe
commit 85d67b0a6e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 4 deletions

View File

@ -18,11 +18,21 @@ in {
default = ".xsession";
example = ".xsession-hm";
description = ''
Path, relative <envar>HOME</envar>, where Home Manager
Path, relative to <envar>HOME</envar>, where Home Manager
should write the X session script.
'';
};
profilePath = mkOption {
type = types.str;
default = ".xprofile";
example = ".xprofile-hm";
description = ''
Path, relative to <envar>HOME</envar>, 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

View File

@ -1,5 +1,5 @@
if [ -z "$HM_XPROFILE_SOURCED" ]; then
. ~/.xprofile
. "/home/hm-user/.xprofile"
fi
unset HM_XPROFILE_SOURCED