Re: [Nix-dev] crosscompiling question

2015-07-15 Thread Tomas Hlavaty
Hi Lluís and Tomasz,

thank you for clarification.  I wonder what is the use-case for
crosscompiling then.  I'll try qemu as you suggest.

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


Re: [Nix-dev] crosscompiling question

2015-07-14 Thread Lluís Batlle i Rossell
On Tue, Jul 14, 2015 at 09:03:06AM +0200, Tomas Hlavaty wrote:
 Like this, I would like to crosscompile packages on my desktop and then
 copy-closure them to the board.  However, they are different paths in
 the store.  How can I actually achive this?  Is there some trick I am
 missing?

Different recipes give different store paths. The recipe of cross-building
is quite different from the recipe of native building.

If you expect the cross-built 'hello' to have the same hash as the
natively built, I don't know any trick. They are effectively built
differently, and thus, they have a different store path.

I don't know of any way in nix that can relate cross-built packages with
natively built.

-- 
(Escriu-me xifrat si saps PGP / Write ciphered if you know PGP)
PGP key D4831A8A - https://emailselfdefense.fsf.org/
___
nix-dev mailing list
nix-dev@lists.science.uu.nl
http://lists.science.uu.nl/mailman/listinfo/nix-dev


[Nix-dev] crosscompiling question

2015-07-14 Thread Tomas Hlavaty
Hi all,

I am trying to crosscompile nix packages for a bananapi ARM board
following https://nixos.org/wiki/CrossCompiling but I am missing the
last step: how do I actually use the crosscompiled packages?

A working example (bananapi is very similar to beaglebone):

--- /tmp/bananapi/default.nix:
let
  pkgs = import /tmp/nixpkgs/ {
crossSystem = {
  config = armv7l-unknown-linux-gnueabihf; # hf
  bigEndian = false;
  arch = arm;
  float = hard;
  fpu = vfp;
  withTLS = true;
  libc = glibc;
  platform = pkgs.platforms.beaglebone;
  openssl.system = linux-generic32;
  gcc = pkgs.platforms.beaglebone.gcc;
};
  };
in rec {
  hello = pkgs.hello;
  bpiEnv = with pkgs; buildEnv {
name = bpiEnv;
paths = [
  hello.crossDrv
];
  };
}
--- end

Running:

$ nix-build -A hello.crossDrv default.nix --option use-binary-caches false

produces
/nix/store/j3l7rg3x9lv167m4as4kfd1mrik9hg0a-hello-2.10-armv7l-unknown-linux-gnueabihf
which I can copy-closure to bananapi and if I call it with absolute path
to that nix-store, it works.

Similarly, I can crosscompile while environment:

$ nix-build -A bpiEnv default.nix --option use-binary-caches false

If I compile hello directly on the bananapi board, I get
/nix/store/rz4n57bas9h9ql5c9if7bpb1wbf1fl89-hello-2.10
which works too.

Like this, I would like to crosscompile packages on my desktop and then
copy-closure them to the board.  However, they are different paths in
the store.  How can I actually achive this?  Is there some trick I am
missing?

Thank you,

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


Re: [Nix-dev] crosscompiling question

2015-07-14 Thread Lluís Batlle i Rossell
On Tue, Jul 14, 2015 at 09:34:16AM +0200, Tomasz Kontusz wrote:
 I think the only way is to build in qemu on the host, or copy-closure whole 
 system profiles (and then link and activate them by name).
 

I consider the former as 'native build' too, and the latter is what I used
years ago in 'nanonixos'.

Regards,
Lluís.

-- 
(Escriu-me xifrat si saps PGP / Write ciphered if you know PGP)
PGP key D4831A8A - https://emailselfdefense.fsf.org/
___
nix-dev mailing list
nix-dev@lists.science.uu.nl
http://lists.science.uu.nl/mailman/listinfo/nix-dev


Re: [Nix-dev] crosscompiling question

2015-07-14 Thread Tomasz Kontusz
I think the only way is to build in qemu on the host, or copy-closure whole 
system profiles (and then link and activate them by name).

Lluís Batlle i Rossell vi...@viric.name napisał:
On Tue, Jul 14, 2015 at 09:03:06AM +0200, Tomas Hlavaty wrote:
 Like this, I would like to crosscompile packages on my desktop and
then
 copy-closure them to the board.  However, they are different paths in
 the store.  How can I actually achive this?  Is there some trick I am
 missing?

Different recipes give different store paths. The recipe of
cross-building
is quite different from the recipe of native building.

If you expect the cross-built 'hello' to have the same hash as the
natively built, I don't know any trick. They are effectively built
differently, and thus, they have a different store path.

I don't know of any way in nix that can relate cross-built packages
with
natively built.

-- 
(Escriu-me xifrat si saps PGP / Write ciphered if you know PGP)
PGP key D4831A8A - https://emailselfdefense.fsf.org/
___
nix-dev mailing list
nix-dev@lists.science.uu.nl
http://lists.science.uu.nl/mailman/listinfo/nix-dev

-- 
Wysłane za pomocą K-9 Mail.___
nix-dev mailing list
nix-dev@lists.science.uu.nl
http://lists.science.uu.nl/mailman/listinfo/nix-dev