From mboxrd@z Thu Jan 1 00:00:00 1970 From: Mathieu Othacehe Subject: Re: How can I set architecture/system-specific origin sources? Date: Tue, 31 Dec 2019 13:06:36 +0100 Message-ID: <87eewksnqr.fsf@gmail.com> References: <87imlwd96p.fsf@ambrevar.xyz> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:470:142:3::10]:42629) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imGIL-0004bP-Bh for guix-devel@gnu.org; Tue, 31 Dec 2019 07:06:42 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1imGIK-0000da-1K for guix-devel@gnu.org; Tue, 31 Dec 2019 07:06:41 -0500 Received: from mail-wr1-x42b.google.com ([2a00:1450:4864:20::42b]:46690) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1imGIJ-0000XE-Pl for guix-devel@gnu.org; Tue, 31 Dec 2019 07:06:39 -0500 Received: by mail-wr1-x42b.google.com with SMTP id z7so34961100wrl.13 for ; Tue, 31 Dec 2019 04:06:39 -0800 (PST) In-reply-to: <87imlwd96p.fsf@ambrevar.xyz> List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: "Guix-devel" To: Pierre Neidhardt Cc: guix-devel@gnu.org 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 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