guix-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How can I set architecture/system-specific origin sources?


From: Mathieu Othacehe
Subject: Re: How can I set architecture/system-specific origin sources?
Date: Tue, 31 Dec 2019 13:06:36 +0100
User-agent: mu4e 1.2.0; emacs 26.3

Hello Pierre,

>
> My laptop is a x86_64-linux and the above definition always uses the
> x86_64 source, even with
>
>   guix build --system=i686-linux foo
>
> In Nix, the following works:
>
> --8<---------------cut here---------------start------------->8---
>   src =
>     if stdenv.hostPlatform.system == "x86_64-linux" then
>       fetchurl {
>         url = "http://foo.bar/...";;
>         sha256 = 
> "e8ff01e6cc38d1b3fd56a083f5860737dbd2f319a39037528fb1a74a89ae9878";
>       }
>     else if stdenv.hostPlatform.system == "i686-linux" then
>       fetchurl {
>         url = "http://foo.bar/...";;
>         sha256 = 
> "cef3591e436f528852db0e8c145d3842f920e0c89bcfb219c466797cb7b18879";
>       }
>     else throw "foo does not support platform ${stdenv.hostPlatform.system}";
> --8<---------------cut here---------------end--------------->8---
>
> Is this a Guix bug?

Well, it's not really a bug, but quite suprising at first. If you look
at the definition of <package> in (guix packages), you'll see that some
fields are (thunked). %current-system and %current-target-system will
only return valid results in (thunked) fields.

As "source" is not thunked, you can make it thunked, but it can hurt
performances. You can also make multiple packages for each architecture,
and use them as inputs conditionned by %current-system and
%current-target-system.

Mathieu




reply via email to

[Prev in Thread] Current Thread [Next in Thread]