Two issues from my point of view:
- NIX_PATH gets cached since applications do not re-source /etc/set-environment due to this if statement located in /etc/profile
if [ -z "$__NIXOS_SET_ENVIRONMENT_DONE" ]; then . /nix/store/sm7s4dlgji6p2gzigh5xalxwly372ijg-set-environment fi
- PAM environment depends on NIX_PATH (I am not sure why :/) which means that it gets rebuilt each time NIX_PATH changes, and in my case it happens on each rebuild:
❯ echo $NIX_PATH | sed 's/:/\n/g' /home/gytis/.nix-defexpr/channels repl=/nix/store/6qrsfdyd64jgkycbnm032cd8x7szch8a-source/repl.nix home-manager=/nix/store/bmf3jwgp67ixy8imw41rl68kmnhc1r4p-source neovim=/nix/store/mln4f4jkczv5jzx7pmxp6pv8vl297abg-source nixpkgs=/nix/store/mz372xs1z8r6b3337zs0qxkg0ffrbnn3-source nixpkgs-wayland=/nix/store/pgkpb8015dwxi7xzfjazjdh74y79i14x-source nur=/nix/store/yipghf9hym51wy5a6fcnxap4bbb0id0b-source self=/nix/store/6qrsfdyd64jgkycbnm032cd8x7szch8a-source utils=/nix/store/n8hd2prmkxb8f584faqycd01czvb83ck-source
Admittedly, I am planning on changing the implementation of the use cases I am handling here, so I guess it’s not much of an issue.
An alternative implementation of NIX_PATH:
If possible - should get directly passed to applications that require it via
config.nix.nixPath - otherwise file is read when required from /etc/nix which contains its definition (similar to the registry)
Could it be that I am missing some use cases?