Skip to content

cargoHash not being updated in overrideAttrs #474

@Richochet1

Description

@Richochet1

I want to create a derivation from nixpkgs that will have the latest commit instead of the latest release tag. Here is a minimal example flake.nix:

{
  inputs.nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
  outputs = {nixpkgs, ...}: {
    packages.x86_64-linux.jay = let
      pkgs = import nixpkgs {system = "x86_64-linux";}; in
      pkgs.jay.overrideAttrs (finalAttrs: prevAttrs: {
        version = "1.11.1";

        src = pkgs.fetchFromGitHub {
          owner = "mahkoh";
          repo = "jay";
          rev = "v1.11.1";
          sha256 = "sha256-mm2bXxl9TaKwmeCwFz3IKznqjsfY8RKEVU/RK4zd63U=";
        };

        cargoHash = "sha256-T7053eAH3IqkAxNZpYHdC6Z7JZtArrOqGMjoIccjemI=";
      });
  };
}

If I run nix-update jay -F, it will change the version, hash and rev, but not cargoHash, resulting in a failed build due to hash mismatch:

      pkgs.jay.overrideAttrs (finalAttrs: prevAttrs: {
        version = "1.11.1-unstable-2025-10-03";

        src = pkgs.fetchFromGitHub {
          owner = "mahkoh";
          repo = "jay";
          rev = "44ac0511c386fef9723dcbdce6119dd1f8f6c68c";
          sha256 = "sha256-acAwoO2i4TynRID+7ipbH/X+MhPRmq8jnwyB5c8jWh0=";
        };

        cargoHash = "sha256-T7053eAH3IqkAxNZpYHdC6Z7JZtArrOqGMjoIccjemI=";
      });

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions