From mboxrd@z Thu Jan 1 00:00:00 1970 From: Pierre Neidhardt Subject: How can I set architecture/system-specific origin sources? Date: Tue, 31 Dec 2019 12:30:06 +0100 Message-ID: <87imlwd96p.fsf@ambrevar.xyz> Mime-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" Return-path: Received: from eggs.gnu.org ([2001:470:142:3::10]:33998) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imFj7-0005dS-EZ for guix-devel@gnu.org; Tue, 31 Dec 2019 06:30:18 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1imFj2-0001Wg-Ce for guix-devel@gnu.org; Tue, 31 Dec 2019 06:30:16 -0500 Received: from relay8-d.mail.gandi.net ([217.70.183.201]:33831) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1imFj2-0001Qh-3E for guix-devel@gnu.org; Tue, 31 Dec 2019 06:30:12 -0500 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: guix-devel@gnu.org --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Hi! I'd like to write a package definition whose source is different depending on the system / arch it is built for. I thought of writing something like this: =2D-8<---------------cut here---------------start------------->8--- (source (origin (method url-fetch) (uri (string-append "http://foo.bar/" version "-"=20 (match (or (%current-target-system) (%current-system)) ("i686-linux" "x86") ("x86_64-linux" "x86_64")) ".tgz")) (sha256 (base32 (match (or (%current-target-system) (%current-system)) ("x86_64-linux" "0y4qms4lm9xiix93g45337rx5nrp0y3gb0x0avyv7l9qrkk03zz8") ("i686-linux" "0yc8n6vpqyb6qhcv5kwvr3h21ya271fi930fvd98hlkg8cg5kwyf")))))) =2D-8<---------------cut here---------------end--------------->8--- My laptop is a x86_64-linux and the above definition always uses the x86_64 source, even with guix build --system=3Di686-linux foo In Nix, the following works: =2D-8<---------------cut here---------------start------------->8--- src =3D if stdenv.hostPlatform.system =3D=3D "x86_64-linux" then fetchurl { url =3D "http://foo.bar/..."; sha256 =3D "e8ff01e6cc38d1b3fd56a083f5860737dbd2f319a39037528fb1a74= a89ae9878"; } else if stdenv.hostPlatform.system =3D=3D "i686-linux" then fetchurl { url =3D "http://foo.bar/..."; sha256 =3D "cef3591e436f528852db0e8c145d3842f920e0c89bcfb219c466797= cb7b18879"; } else throw "foo does not support platform ${stdenv.hostPlatform.system}= "; =2D-8<---------------cut here---------------end--------------->8--- Is this a Guix bug? =2D-=20 Pierre Neidhardt https://ambrevar.xyz/ --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAEBCAAdFiEEUPM+LlsMPZAEJKvom9z0l6S7zH8FAl4LMT4ACgkQm9z0l6S7 zH//Lgf+M1xcTfXQjqL4a1xy3b0/y5cIdHLrCL+6fx8JEq8q/74DJSs4RmRUZFwT oEByk923GB9XlE1IvawetQOyety6a76mNEuD4Eu1btR3bRJJJfA5p+YLWoOLh2dh kWPKOXQq+fYQZF5Jc/jozhKmCnhsYxL4opcJ37afUi4+V4I+busTbhQc9ln508Xy XuUl4EIulp5p2P9bFmqOw/jK4QBKLsjCnUVDjeryHdPMUC4n6LiaS7QTCMAiVmdd gBupK7vlihcya4LURR5oNt35SZIx4Bhk4CUdp8vTujBOOJQ94XLEsTX+lcoxlYJh ya/kgHZeBZWoquGp4wN7ePPWWaue1Q== =vN0i -----END PGP SIGNATURE----- --=-=-=--