Re: [Nix-dev] unequal build hash

2017-07-07 Thread Guillaume Maudoux (Layus) via nix-dev



On 07/07/17 10:28, Harmen via nix-dev wrote:

On Fri, Jul 07, 2017 at 07:59:46AM +0200, Vladimír Čunát wrote:

On 07/06/2017 07:35 PM, Harmen via nix-dev wrote:

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

When you use things like
   src = ./.;
the directory gets copied into nix store and the resulting path's name
is based on the name of the directory.

I see. That was rather unobvious and unexpected to me.

Anyone knows a (creative) way around that? I would like to have it build code
from ./., but where the name of the directory you happened to have checked the
project out in doesn't matter (because then the binary cache works).
Well, you could try to play with symlinks. A self-symlinks seems to be 
enough.


git checkout ... somewhere
cd somewhere
ln -s . knownName

then

src = builtins.filterSource (path: type: path != "./knownName") ./knownName; # 
syntax my not be correct here, check by yourself :-).


-- Layus.
___
nix-dev mailing list
nix-dev@lists.science.uu.nl
https://mailman.science.uu.nl/mailman/listinfo/nix-dev


Re: [Nix-dev] unequal build hash

2017-07-07 Thread Harmen via nix-dev
On Fri, Jul 07, 2017 at 07:59:46AM +0200, Vladimír Čunát wrote:
> On 07/06/2017 07:35 PM, Harmen via nix-dev wrote:
> > Does that makes sense? Did I forget a 'name' somewhere?
> 
> When you use things like
>   src = ./.;
> the directory gets copied into nix store and the resulting path's name
> is based on the name of the directory.

I see. That was rather unobvious and unexpected to me.

Anyone knows a (creative) way around that? I would like to have it build code
from ./., but where the name of the directory you happened to have checked the
project out in doesn't matter (because then the binary cache works).

Thanks,
Harmen
 

> 
> --Vladimir
___
nix-dev mailing list
nix-dev@lists.science.uu.nl
https://mailman.science.uu.nl/mailman/listinfo/nix-dev


Re: [Nix-dev] unequal build hash

2017-07-07 Thread Vladimír Čunát via nix-dev
On 07/06/2017 07:35 PM, Harmen via nix-dev wrote:
> Does that makes sense? Did I forget a 'name' somewhere?

When you use things like
  src = ./.;
the directory gets copied into nix store and the resulting path's name
is based on the name of the directory.

--Vladimir
___
nix-dev mailing list
nix-dev@lists.science.uu.nl
https://mailman.science.uu.nl/mailman/listinfo/nix-dev


Re: [Nix-dev] unequal build hash

2017-07-06 Thread Harmen via nix-dev
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:


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@lists.science.uu.nl
> https://mailman.science.uu.nl/mailman/listinfo/nix-dev
___
nix-dev mailing list
nix-dev@lists.science.uu.nl
https://mailman.science.uu.nl/mailman/listinfo/nix-dev