If you already have you config and it includes managing home-manager itself, then you probably can use something like:
nix build --no-write-lock-file home-manager ./result/bin/home-manager --flake ".#$USER" switch
home-manager is in global Flakes registry)
Most likely can use
home-manager/release-21.11 if needed (see choosing channel in manual).
If you are not on NixOS and manage
nix via home-manager too, you probably want to remove
nix installed into
nix-env. Just use
build instead of
switch previously and separately activate it with removal:
nix shell 'nixpkgs#nix' --command sh -c 'nix-env -e nix && ./result/activate'