[Nix-dev] unequal build hash

Harmen harmen at lijzij.de
Thu Jul 6 19:35:10 CEST 2017


On Thu, Jul 06, 2017 at 06:35:15PM +0200, Harmen via nix-dev wrote:
> Hello all,
> another day, another problem :/
> 
> I'm trying to figure out why a build generates different build IDs in different
> contexts.
> I have a nix expression and some code. If I copy that from machine A
> to machine B they both give the same build hash. All's fine there.
> If on machine B I run nix-build in a docker container it won't give the same
> build hash.
> `nix-hash .` gives the same hash for B and B-docker. Same nix version, same
> nixpkgs version.

I'm getting a bit further, and it worked on different machines because I
happened to name the directory the same on both machines. Seems like the name
of the directory is used in the build process. As long as I checkout the repo
in a subdir with the same name everything is fine. If I rename the checkout dir
nix will rebuild. This my current default.nix:

    <some nixpkgs stuff>
    with pkgs; buildGoPackage rec {
      name = "mypackage";
      src = builtins.filterSource
       (name: type:
         (lib.hasPrefix (toString ./vendor) name) ||
         (lib.hasPrefix (toString ./rzutil) name) ||
         (lib.hasPrefix (toString ./util) name) ||
         (lib.hasPrefix (toString ./datatype) name) ||
         (lib.hasPrefix (toString ./one) name)
       ) ./.;

      goPackagePath = "example.com/mypackage";

      meta = with stdenv.lib; {
        description = "My First Package";
        homepage = https://github.com/example-com/mypackage;
        platforms = platforms.unix;
      };
    }

If I do the checkout in /tmp/fooo part of the .drv gives:

    ...
    ["/nix/store/9krlzvny65gdc8s7kpb6lkx8cd02c25b-default-builder.sh","/nix/store/zw7ax2gxc8qr5cx5a7byjpxdshx73297-fooo"]
    ...

Does that makes sense? Did I forget a 'name' somewhere?

Thanks!

> 
> Any hints what to look for?
> Thanks!
> _______________________________________________
> nix-dev mailing list
> nix-dev at lists.science.uu.nl
> https://mailman.science.uu.nl/mailman/listinfo/nix-dev


More information about the nix-dev mailing list