home-manager
home-manager copied to clipboard
home-environment: Stop exporting __HM_SESS_VARS_SOURCED
Description
If the __HM_SESS_VARS_SOURCED is set in environment of parent process, then the spawned child shell will inherit it, and won't set the session variables one expects to be set in their home environment
And, I don't see any need for exporting environment variable, just setting it is enough for it to be a guard.
P.S. This is essentially a re-open of #2328 which I messed up.
Checklist
-
[x] Change is backwards compatible.
-
[x] Code formatted with
./format
. -
[x] Code tested through
nix-shell --pure tests -A run.all
. -
[x] Test cases updated/added. See example.
-
[x] Commit messages are formatted like
{component}: {description} {long description}
See CONTRIBUTING for more information and recent commit messages for examples.
-
If this PR adds a new module
-
[ ] Added myself as module maintainer. See example.
-
[ ] Added myself and the module files to
.github/CODEOWNERS
.
-
If I understand correctly, if the environment (home.sessionVariables
, etc.) is changed after it has been loaded (for instance before starting your window manager) then new shells won't see the new environment variables?
If I understand correctly, if the environment (
home.sessionVariables
, etc.) is changed after it has been loaded (for instance before starting your window manager) then new shells won't see the new environment variables?
Exactly
Hey, any progress on this PR? I've encountered this issue myself and this would be the solution. What's stopping this from being merged?
Thank you for your contribution! I marked this pull request as stale due to inactivity. Please read the relevant sections below before commenting.
If you are the original author of the PR
- GitHub sometimes doesn't notify people who commented / reviewed a PR previously when you (force) push commits. If you have addressed the reviews you can officially ask for a review from those who commented to you or anyone else.
- If it is unfinished but you plan to finish it, please mark it as a draft.
- If you don't expect to work on it any time soon, please consider closing it with a short comment encouraging someone else to pick up your work.
- To get things rolling again, rebase the PR against the target branch and address valid comments.
If you are not the original author of the PR
- If you want to pick up the work on this PR, please create a new PR and indicate that it supercedes and closes this PR.
Won't this introduce duplicated entries in PATH
-like variables? I think this might be a problem?
Won't this introduce duplicated entries in
PATH
-like variables? I think this might be a problem?
I've been using it for an year on multiple systems, and haven't experienced what you're pointing. Could you please elaborate why/how that may happen ?
Thanks
Things like export PATH=foo:$PATH
will result in duplicated foo
entries in nested shells. I don't know if this is a problem.
Things like
export PATH=foo:$PATH
will result in duplicatedfoo
entries in nested shells. I don't know if this is a problem.
Well, I've not noticed it in practice, it did make switching home-manager profiles more deterministic for me when I was experimenting with session variables. And yes, I'd noticed NixOS uses similar concept (environment variable).
Thank you for your contribution! I marked this pull request as stale due to inactivity. Please read the relevant sections below before commenting.
If you are the original author of the PR
- GitHub sometimes doesn't notify people who commented / reviewed a PR previously when you (force) push commits. If you have addressed the reviews you can officially ask for a review from those who commented to you or anyone else.
- If it is unfinished but you plan to finish it, please mark it as a draft.
- If you don't expect to work on it any time soon, please consider closing it with a short comment encouraging someone else to pick up your work.
- To get things rolling again, rebase the PR against the target branch and address valid comments.
If you are not the original author of the PR
- If you want to pick up the work on this PR, please create a new PR and indicate that it supercedes and closes this PR.
Thank you for your contribution! I marked this pull request as stale due to inactivity. Please read the relevant sections below before commenting.
If you are the original author of the PR
- GitHub sometimes doesn't notify people who commented / reviewed a PR previously when you (force) push commits. If you have addressed the reviews you can officially ask for a review from those who commented to you or anyone else.
- If it is unfinished but you plan to finish it, please mark it as a draft.
- If you don't expect to work on it any time soon, please consider closing it with a short comment encouraging someone else to pick up your work.
- To get things rolling again, rebase the PR against the target branch and address valid comments.
If you are not the original author of the PR
- If you want to pick up the work on this PR, please create a new PR and indicate that it supercedes and closes this PR.