Skip to content

RFC 0133 git hashing: hashes $NIX_BUILD_TOP/tmp #12295

Description

@7c6f434c

Describe the bug

When trying to create a git-hashed derivation, the content is hashed correctly but in $NIX_BUILD_TOP/tmp not in $out.

Steps To Reproduce

/nix/store/azpy5a4w7whrcywg6rfks2a0mwyzwr0a-nix-2.25.0pre20241101_2e5759e3/bin/nix-build --no-out-link -E 'with import <nixpkgs> {}; runCommandCC "test2" {outputHash="00000000000000000000000000000000";outputHashAlgo="sha1";outputHashMode="git";} "mkdir tmp; mkdir -p $out; cp  ${"" + /tmp/a}/* tmp/"' --extra-experimental-features git-hashing --impure
/nix/store/azpy5a4w7whrcywg6rfks2a0mwyzwr0a-nix-2.25.0pre20241101_2e5759e3/bin/nix-build --no-out-link -E 'with import <nixpkgs> {}; runCommandCC "test2" {outputHash="00000000000000000000000000000000";outputHashAlgo="sha1";outputHashMode="git";} "mkdir tmp; mkdir -p $out; cp  ${"" + /tmp/a}/* $out/"' --extra-experimental-features git-hashing --impure

Where /tmp/a is a git repository with some random stuff.

Result: the first command complains about a hash mismatch for the correct tree hash, the second command complains about a hash mismatch for a empty-root-directory git hash. (Based on ./tmp/ content)

Expected behavior

The hash mismatch complaints match $out content.

Metadata

$ /nix/store/azpy5a4w7whrcywg6rfks2a0mwyzwr0a-nix-2.25.0pre20241101_2e5759e3/bin/nix-env --version
nix-env (Nix) 2.25.0pre20241101_2e5759e3

Additional context

Just making sure it is not missed in the stabilisation of #8919

Discussed https://discourse.nixos.org/t/how-to-use-rfc0133-git-hashing-for-fods-correctly/59068 with @Atemu

Checklist


Add 👍 to issues you find important.

Metadata

Metadata

Assignees

Labels

bugfetchingNetworking with the outside (non-Nix) world, input locking

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions