I was wondering if I am using a large package like TexLiveFull, how to make sure nix don’t delete large packages after I close the shell? I also don’t want this package to be available in my global environment, as I don’t need to use it outside vscode.
There's a bunch of tools that solve this problem.
https://github.com/direnv/direnv/wiki/Nix
In the link above check out the table in the "Some factors to consider" section. However, note that it hasn't be updated since May 30, 2022.
Many of those tools don't depend on direnv if you don't need its functionality.
Personally, I use direnv and enable nix-direnv using these options:
Here's an example of how I use direnv with nix-direnv.
Edit: damn over wrote what I wrote to the first question with a response to the second question. Thank goodness for automatic file backups I have setup in Emacs.