Fix a segfault in ‘nix-env -qa’

This was triggered by 47e185847e729d49e6aa376e8299fd66ef834a0a, which
turned globals.state into a pointer.