Having a single file contains both code and its dependencies is a useful feature provided by nix-shell. However long startup times make it unsuitable for some use-cases.
This example script took 0.5 seconds to run on my machine:
#! /usr/bin/env nix-shell #! nix-shell -i python -p python print "Hello world!"
Scripts with more dependencies can take a couple of seconds just to set up the environment.
I’ve found that direnv can cache things up, but it is not a one-file solution as I understand it.
So, is there a way to reduce the startup time of single-file scripts?