Caching nixpkgs package definitions for nix run, shell and profile install

I think I have figured out the options to set in order to achieve what I have been asking. As mentioned by @TLATER I have set:

nixpkgs.flake.setFlakeRegistry = true;

which makes the nixpkgs flake in the registry be pinned.
Then I also looked at the of this option and set this in order to pin my extra nixpkgs-unfree:

nix.registry.nixpkgs-unfree.to = {
  type = "path";
  path = inputs.nixpkgs-unfree;
};

(of course nixpkgs-unfree is added as an input in my flake.nix)

This is a different setup now compared to the result of my old question, so I will update that accordingly.