The nix-instantiate invocations only work correctly if this script is run from the root directory of nixpkgs, or in a directory without a default.nix file and NIX_PATH set appropriately.