Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
1 task done
7c6f434c opened this issue Jan 20, 2025 · 4 comments · Fixed by #12335
Closed
1 task done

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

7c6f434c opened this issue Jan 20, 2025 · 4 comments · Fixed by #12335
Assignees
Labels
bug fetching Networking with the outside (non-Nix) world, input locking

Comments

@7c6f434c
Copy link
Member

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.

@7c6f434c 7c6f434c added the bug label Jan 20, 2025
@nixos-discourse
Copy link

This issue has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/how-to-use-rfc0133-git-hashing-for-fods-correctly/59068/6

@roberth roberth added the fetching Networking with the outside (non-Nix) world, input locking label Jan 22, 2025
@nixos-discourse
Copy link

This issue has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/2024-01-22-nix-team-meeting-minutes-210/59239/1

Ericson2314 added a commit to obsidiansystems/nix that referenced this issue Jan 22, 2025
Ericson2314 added a commit to obsidiansystems/nix that referenced this issue Jan 22, 2025
We were simply passing in the wrong path. This went uncaught because the
TODO about deduplication hasn't happened yet.
@Ericson2314
Copy link
Member

#12335 OK so the bug was really trivial and a stupid typo on my part! And easy to fix :)

Ericson2314 added a commit to obsidiansystems/nix that referenced this issue Jan 22, 2025
We were simply passing in the wrong path. This went uncaught because the
TODO about deduplication hasn't happened yet.
@Atemu
Copy link
Member

Atemu commented Jan 22, 2025

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug fetching Networking with the outside (non-Nix) world, input locking
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants