Why is the narHash different if the rev is the same?

I used nixpkgs.url = “github:nixos/nixpkgs/nixos-unstable”;

Now I changed it to

nixpkgs.url = “https://nixos.org/channels/nixos-unstable/nixexprs.tar.xz”;

flake.lock :

        "narHash": "sha256-b/GV2ysM8mKHhinse2wz+uP37epUrSE+sAKXy/xvBY4=",
        "owner": "nixos",
        "repo": "nixpkgs",
        "rev": "fe416aaedd397cacb33a610b33d60ff2b431b127",
        "type": "github"
=======
        "narHash": "sha256-oFe06TmOy8UUT1f7xMHqDpSYq2Fy1mkIsXZUvdnyfeY=",
        "rev": "fe416aaedd397cacb33a610b33d60ff2b431b127",
        "type": "tarball",
        "url": "https://releases.nixos.org/nixos/unstable/nixos-26.05pre962285.fe416aaedd39/nixexprs.tar.xz"

Why is the narHash": "sha256 different?

Because the content of release tarballs includes generated files that aren’t in the github repo. (Though it’s generated using the code that is in the repo.)

2 Likes