If you are Python dev, you could specify Python dependencies for script using pep 723
https://iscinumpy.dev/post/pep723/
(nix might be an overkill).
For notebooks, workflows, personal playbooks, notes Org Babel could be used (emacs)
Here's example code blocks in Haskell (but many other languages can be used such as shell, jupyter, plantuml) https://youtu.be/1qOFYluebBg?si=muGfsaC1kI7Cgpyw
One of my favorite features are subtree specific settings that enable remote shell commands by configuring :dir to /ssh:host: