New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PAM fails to set the session variables [properly]. #50
Comments
Yes, you are quite right and I believe the NixOS For a fancy solution I guess that this could be fixed using a topological sort if we add support for detecting environment variables in the value. So in your example The straight forward and boring solution would be to add support for specifying the variables in a list, instead… |
For what it is worth, I tried implementing a solution specific to the PAM module over the weekend, but I hit a lot of edge cases, as well as it depends bash 4 specific things (associative array), is that OK? If it is, when the sort fails due to a user's variable self-referencing should I throw an assert or silently ignore? |
Cool! I think it is worth making a PR for it. About the assertion it depends on if it can be done during a generation build or it happens during activation. If it during generation build then assert is definitely preferable. In the activation script it is a bit trickier, probably best to drop it silently (ideally would be to print an message, though). |
One way to solve this issue is to use nix recursive set feature:
This configuration will produce the correct output:
Not sure if it covers all cases though. |
Yeah, I'm liking this use of
will result in two executions of |
My apologies to getting to this late.
|
Cool. Glad it worked out for you :-) About the using |
I'm not really planning to do anything else on this issue so I'll close it. @S-NA If you think I'm missing something then feel free to reopen and comment. |
Session variables written to .pam_environment are sorted alphabetically is the culprit here.
Given:
Which causes PAM to fail, due to
XDG_CONFIG_HOME
, not being defined beforeHOMERC
.I believe this is due to
home.sessionVariables
being a set ({}), instead of a list ([]) which means order is not preserved. (I have not dived deep enough into the Nix language to know if that is the case, just a conjecture on my part.)The text was updated successfully, but these errors were encountered: