37M is around the right size for a nixpkgs tarball, so it is probably nixpkgs. What is stored per-user is the freshness of a tarball (see tarball-ttl in man nix.conf). So if it’s been over tarball-ttl seconds (default one hour) since root has updated the nixpkgs tarball, it will download it again no matter how recently another user has downloaded it. It’s just that if it’s the same tarball, it’ll be able to recognize that the hashes are the same and it won’t have to add anything to the store before using it.
Note that this only happens because the nix “registry” isn’t pinned by default, so nix shell nixpkgs/release-23.05#... is checking the internet for the latest release-23.05 commit. If you pin your registry, it won’t have to download anything.
Also, please don’t use release-23.05. Use nixos-23.05. The former has not undergone hydra caching and testing, while the latter has.
That makes a lot of sense. Thank you. I just wonder if there is a way to ask Github (assuming it’s downloaded from Github) for hash of the tarball - so it doesn’t need to be downloaded just to check that hashes are already in the nix store.
I’m assuming that means that commands likes nix shell and nix run don’t use a flake.lock and therefore they use the most current software (the latest commit). Which is cool since I consider those commands as ad-hoc / testing and if I’m more serious I’d use NixOS repo with flake.lock or nix develop ....
If I’m wrong, please point me to documentation about pining the registry.
I had no idea! I probably have “release” everywhere including all my flakes. Thank you for letting me know.