Open amozeo opened 1 month ago
Note that this only concerns sessions variables; env vars that are part of some long-running "session" that keeps its initial set of environment variables such as the user session.
Using nix store paths in env vars of i.e. systemd system services however is fine as they are restarted automatically upon activation when anything has changed.
Note again that the same is not true for user services however; they are not restarted upon activation.
Describe the bug
When updating system using
nixos-rebuild switch
ornixos-rebuild test
, environment variables usually are not being updated in running processess and user sessions, and in order for them to be updated, a session relog or system restart would need to happen.Thus, environement variables could contain outdated store path, and it's the reason why nix store paths should not be used in environment variables and be actively discouraged.
for configuration files,
/etc
directory could be used as an alternative.I have found that these NixOS modules use nix store paths in environment variables
fcitx5Package
pkgs.freetds
lessopen
has store pathpkgs.lesspipe
pkgs.plotinus
pkgs.plotinus
askPassword
has store pathpkgs.x11_ssh_askpass
subcommandPackagesTree
fakeKuboRepo
This issue was originally reported in https://github.com/NixOS/nixpkgs/issues/311207 however I believe a separating it from that issue is better.
Add a :+1: reaction to issues you find important.