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

Hash mismatches from generated Nix expressions #139

Closed
Ma27 opened this issue Apr 10, 2019 · 4 comments
Closed

Hash mismatches from generated Nix expressions #139

Ma27 opened this issue Apr 10, 2019 · 4 comments

Comments

@Ma27
Copy link

Ma27 commented Apr 10, 2019

I've seen that there were similar issues in the past (#27, #7), however those were marked as resolved.

I managed to trigger the problem with a fork of js-sequence-diagrams:

[
  { "js-sequence-diagrams": "git+https://github.com/codimd/js-sequence-diagrams.git" }
]

When generating expressions with node2nix -i deps.json and build it with nix-build -E "let i = import ./. {}; in i.\"js-sequence-diagrams-git+https://github.com/codimd/js-sequence-diagrams.git\"", I get the following error:

these derivations will be built:
  /nix/store/mqyqh3lsxb9y8yvdv20bhzhmk98vy0a1-js-sequence-diagrams-b9afa03.drv
  /nix/store/jx3l7j1ac60l9w3lpzcf6nzyawxgr4ky-node-js-sequence-diagrams-2.0.1.drv
building '/nix/store/mqyqh3lsxb9y8yvdv20bhzhmk98vy0a1-js-sequence-diagrams-b9afa03.drv'...
exporting https://github.com/codimd/js-sequence-diagrams.git (rev b9afa038521e5dadf9b97624a3c7db21890be669) into /nix/store/hwpy3klhhyci75cdww0knzanlj8gqx2h-js-sequence-diagrams-b9afa03
Initialized empty Git repository in /nix/store/hwpy3klhhyci75cdww0knzanlj8gqx2h-js-sequence-diagrams-b9afa03/.git/
remote: Enumerating objects: 71, done.
remote: Counting objects: 100% (71/71), done.
remote: Compressing objects: 100% (63/63), done.
remote: Total 71 (delta 16), reused 40 (delta 5), pack-reused 0
From https://github.com/codimd/js-sequence-diagrams
 * branch            HEAD       -> FETCH_HEAD
Switched to a new branch 'fetchgit'
Submodule '_site' (https://github.com/bramp/js-sequence-diagrams.git) registered for path '_site'
Initialized empty Git repository in /nix/store/hwpy3klhhyci75cdww0knzanlj8gqx2h-js-sequence-diagrams-b9afa03/_site/.git/
remote: Enumerating objects: 8, done.
remote: Counting objects: 100% (8/8), done.
remote: Compressing objects: 100% (7/7), done.
remote: Total 1400 (delta 1), reused 8 (delta 1), pack-reused 1392
Receiving objects: 100% (1400/1400), 2.21 MiB | 1.00 MiB/s, done.
Resolving deltas: 100% (821/821), done.
From https://github.com/bramp/js-sequence-diagrams
 * [new branch]      gh-pages   -> origin/gh-pages
 * [new branch]      master     -> origin/master
 * [new branch]      newfont    -> origin/newfont
 * [new branch]      real-tests -> origin/real-tests
 * [new branch]      svg        -> origin/svg
 * [new tag]         v1.0       -> v1.0
 * [new tag]         v1.0.1     -> v1.0.1
 * [new tag]         v1.0.2     -> v1.0.2
 * [new tag]         v1.0.3     -> v1.0.3
 * [new tag]         v1.0.4     -> v1.0.4
 * [new tag]         v1.0.5     -> v1.0.5
 * [new tag]         v1.0.6     -> v1.0.6
 * [new tag]         v2.0.0     -> v2.0.0
 * [new tag]         v2.0.1     -> v2.0.1
Switched to a new branch 'fetchgit'
removing `.git'...
hash mismatch in fixed-output derivation '/nix/store/0h754dqachgmhs9pasv4i4fs0i0iwi3s-js-sequence-diagrams-b9afa03':
  wanted: sha256:1fg3xsyndh7lnd9hqxazv2p01l2p6q5pv72scrcrrf2arbizgk35
  got:    sha256:12v57bdld5a2550xvqh1rcinpld48awgd1s0gbny7z0b0z827ggw
cannot build derivation '/nix/store/jx3l7j1ac60l9w3lpzcf6nzyawxgr4ky-node-js-sequence-diagrams-2.0.1.drv': 1 dependencies couldn't be built
error: build of '/nix/store/jx3l7j1ac60l9w3lpzcf6nzyawxgr4ky-node-js-sequence-diagrams-2.0.1.drv' failed
@svanderburg
Copy link
Owner

By inspecting the output this seems to be caused by the fact that there is a git sub module, that gets automatically installed by the fetchgit function Nixpkgs. Unfortunately, the function that node2nix uses to compute the hash of a git repository completely ignores sub modules. I think this module needs to be extended with Git sub module support.

@svanderburg
Copy link
Owner

I just added preliminary git sub module support in revision efa2c2a

I tested the package you provided and it seems to get successfully deployed.

@Ma27
Copy link
Author

Ma27 commented Jun 2, 2019

Great! I'll try to fix the affected package tomorrow and report back :)

@Ma27
Copy link
Author

Ma27 commented Jun 2, 2019

The issue appears to be fixed now, thanks a lot!

(on a side note: I won't change the code in nixpkgs for now as I'd like to get NixOS/nixpkgs#60429 ready as soon as possible).

@Ma27 Ma27 closed this as completed Jun 2, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants