Approach For Wrapping Bash? #295
-
|
I would like to set per-user environment variables without using Home Manager. I thought that wrapping Bash can work. The idea is:
In the second step, Nix complained that wrapped Bash "is not a shell package". After reading Nixpkgs code I realized it's looking for I would appreciate it if someone points me towards the issue here. I don't understand why Nix is completely ignoring |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 20 replies
-
|
So, if it is working when you use a fish derivation, that should rule out something setting lib.mkForce and winning, or some weird interaction with users.defaultUserShell (or whatever it is)? So, that is useful information. ^ The logic they use to select it is strange, I am unsure why they select it from Try doing Not really sure why it would not work still, but that may be part of it? I tested the wrapped bash on its own, just calling it in a shell, and the values from Did you used to use home manager and now you don't? If the above doesn't help, what are the chances of old files still being there? Also, you will want to use |
Beta Was this translation helpful? Give feedback.
-
|
Indeed when I tested the wrapped Bash on it's own the values from And I was testing this using But your suggestion of trying When I login, wrapped Bash starts, with all env vars set properly. But then if I run Bash by typing However, after adding wrapped Bash to I'm not sure if this setup will lead to undesired behavior, but I will experiment with it. It would be amazing if it works as it's very clean. |
Beta Was this translation helpful? Give feedback.
So, if it is working when you use a fish derivation, that should rule out something setting lib.mkForce and winning, or some weird interaction with users.defaultUserShell (or whatever it is)?
So, that is useful information.
https://github.com/NixOS/nixpkgs/blob/23d72dabcb3b12469f57b37170fcbc1789bd7457/nixos/lib/utils.nix#L148-L156
^ The logic they use to select it is strange, I am unsure why they select it from
/run/current-system/swlike that.Try doing
users.users.<name>.shell = "${pkgs.urbash}/bin/bash";?Not really sure why it would not work still, but that may be part of it?
I tested the wrapped bash on its own, just calling it in a shell, and the values from
envoption do seem to p…