`command-not-found` unable to open database

This works! Do I need to do this command sequences every time after nixos-rebuild switch?

[root@earth:~]# nix-channel --add https://nixos.org/channels/nixos-unstable nixos

[root@earth:~]# nix-channel --list
nixos https://nixos.org/channels/nixos-unstable

[root@earth:~]# nix-channel --update
unpacking channels...

[root@earth:~]# command-not-found hello
The program ‘hello’ is currently not installed. It is provided by
several packages. You can install it by typing one of the following:
  nix-env -iA nixos.hello
  nix-env -iA nixos.mbedtls
  nix-env -iA nixos.perkeep