Pulse walnuts, garlic, salt and pepper in a blender or food processor until coarsely chopped. Add basil leaves and pulse a few times to mix. Scrape down blender. Pulse mixture again while drizzling in olive oil. Add just enough olive oil to reach the consistency you prefer. (I prefer pesto to be a bit thick for freezing purposes as I can always add more oil when it thaws.) Continue pulsing and scraping down blender until everything is of a consistent texture.
To freeze: Pour or scoop pesto into ice cube trays. Cover and freeze until firm. Put frozen cubes into a labeled freezer bag, removing as much air as possible, seal and place back in the freezer.
To use: Thaw. Use as fresh as directed in recipe (such as tossing with gluten free pasta or roasted spaghetti squash, etc.)