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

fetchurl: output not reproducible #93518

Closed
davidak opened this issue Jul 20, 2020 · 2 comments
Closed

fetchurl: output not reproducible #93518

davidak opened this issue Jul 20, 2020 · 2 comments
Labels
0.kind: bug Something is broken

Comments

@davidak
Copy link
Member

davidak commented Jul 20, 2020

I have this data installed

[davidak@gaming:~]$ tree /nix/store/3xhqg2pw8xfvv1k1sbgagr97aasbab7g-Agave-Regular.ttf
/nix/store/3xhqg2pw8xfvv1k1sbgagr97aasbab7g-Agave-Regular.ttf
└── share
    └── fonts
        └── truetype
            └── Agave-Regular.ttf

now i change the fetchurl postFetch:

{ pkgs, lib, stdenv, fetchurl }:

stdenv.mkDerivation rec {
  pname = "agave";
  version = "16";

  src = fetchurl {
    url = "https://github.com/agarick/agave/releases/download/v${version}/Agave-Regular.ttf";
    downloadToTemp = true;
    recursiveHash = true;
    sha256 = "108jvcijnx06v1jzhnb28ql9nvmwqd83309834wcd4aii6bgf9ka";
    postFetch = ''
      install -D $downloadedFile $out/Agave-Regular.ttf
    '';
  };

  dontUnpack = true;
  dontConfigure = true;
  dontBuild = true;
  doCheck = false;
  dontFixup = true;
  #dontInstall = true;

  installPhase = ''
    runHook preInstall

    echo $src
    echo $out

    echo ------

    ls -la $src/share

    #install -D -t $out/ $src/*

    mkdir -p $out/share/fonts/truetype/
    cp $src/Agave-Regular.ttf $out/share/fonts/truetype/

    runHook postInstall
  '';



  meta = with lib; {
    description = "truetype monospaced typeface designed for X environments";
    homepage = "https://b.agaric.net/page/agave";
    license = licenses.mit;
    maintainers = with maintainers; [ dtzWill ];
    platforms = platforms.all;
  };
}

but the output of fetchurl has still the same hash and data is not changed... leading to 10 hours of debugging

...
building '/nix/store/y15ssw50vdb6wjcsags48zhmdy466yyd-agave-16.drv'...
patching sources
installing
/nix/store/3xhqg2pw8xfvv1k1sbgagr97aasbab7g-Agave-Regular.ttf
/nix/store/64c2gxl6fc3b1f46i60isvrdrx0pjp6s-agave-16
------
total 12
dr-xr-xr-x 3 nobody nogroup 4096 Jan  1  1970 .
dr-xr-xr-x 3 nobody nogroup 4096 Jan  1  1970 ..
dr-xr-xr-x 3 nobody nogroup 4096 Jan  1  1970 fonts
cp: cannot stat '/nix/store/3xhqg2pw8xfvv1k1sbgagr97aasbab7g-Agave-Regular.ttf/Agave-Regular.ttf': No such file or directory
builder for '/nix/store/y15ssw50vdb6wjcsags48zhmdy466yyd-agave-16.drv' failed with exit code 1
error: build of '/nix/store/y15ssw50vdb6wjcsags48zhmdy466yyd-agave-16.drv' failed
@davidak davidak added the 0.kind: bug Something is broken label Jul 20, 2020
@Ma27
Copy link
Member

Ma27 commented Jul 20, 2020

When trying to build your code, I get the following error:

hash mismatch in fixed-output derivation '/nix/store/hakk1h2s2031njwn0zi6kxly7m4lbcw3-Agave-Regular.ttf':
  wanted: sha256-aib3lolRkcY4GSiBMVDDvG6bKEZiWfhl2AZ0KyPbEoE=
  got:    sha256-MTq4mBLSSKDNWV1XH6hBg+bvuYL+91jCx9T/CGcoJrU=
error: --- Error ------------------------------------------------------------------------ nix-build

I assume you didn't change the sha256 to a random value after modifying postFetch? If not (and a fixed-output path with the given sha256 exists in your store), nothing will be re-downloaded. See also NixOS/nix#969

@davidak
Copy link
Member Author

davidak commented Jul 20, 2020

@Ma27 yes, that's the reason. very annoying

@davidak davidak closed this as completed Jul 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0.kind: bug Something is broken
Projects
None yet
Development

No branches or pull requests

2 participants