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

nix-prefetch: fix compatibility with nixUnstable again #98387

Merged
merged 1 commit into from Sep 21, 2020

Conversation

oxalica
Copy link
Contributor

@oxalica oxalica commented Sep 21, 2020

Motivation for this change

The parsing regex for output hash is broken for the current nix in unstable channel.
This PR ports patches to fix it.

Behavior on current master:

$ nix run nixpkgs.nix-prefetch -c nix-prefetch hello.src
The fetcher will be called as follows:
> fetchurl {
>   sha256 = "0ssi1wpaf7plaswqqjwigppsg5fyh99vdlb9kzl7c9lng89ndq1i";
>   url = "mirror://gnu/hello/hello-2.10.tar.gz";
> }

trying https://ftpmirror.gnu.org/hello/hello-2.10.tar.gz
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:--  0:00:01 --:--:--     0
100  708k  100  708k    0     0   111k      0  0:00:06  0:00:06 --:--:--  189k
hash mismatch in fixed-output derivation '/nix/store/3x7dwzq014bblazs7kq20p9hyzz0qh8g-hello-2.10.tar.gz':
  wanted: sha256:0000000000000000000000000000000000000000000000000000
  got:    sha256:0ssi1wpaf7plaswqqjwigppsg5fyh99vdlb9kzl7c9lng89ndq1i
error: build of '/nix/store/mhsd2ar52m4d0f2hmlkhbpj4rnc4kws0-hello-2.10.tar.gz.drv' failed

msteen/nix-prefetch#8 tried to fix the issue but closed in flavor of msteen/nix-prefetch#9, which is also closed and redo-ed in master (msteen/nix-prefetch@2722cda). However, it still has bug, which is finally fixed by msteen/nix-prefetch#12

I opened an issue to upstream about making a new release in msteen/nix-prefetch#13 but there's no response until now.
So I patch here to make it work at least.

@Mic92

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.

@Mic92
Copy link
Member

Mic92 commented Sep 21, 2020

backported in dc925f5

@oxalica oxalica deleted the fix/nix-prefetch branch October 20, 2020 14:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants