This script builds OpenCV from source on Jetson Nano.
Related thread on Nvidia developer forum here.
./build_opencv.sh
./build_opencv.sh 4.2.0
Where 4.2.0
is any version of openCV from 2.2 to 4.2.0
(any valid OpenCV git branch or tag will also attempt to work, however the very old versions have not been tested to build and may require spript modifications.).