From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id eHUrN8+fe2NtbAAAbAwnHQ (envelope-from ) for ; Mon, 21 Nov 2022 16:57:04 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id ANw4Ns+fe2NLoAAAG6o9tA (envelope-from ) for ; Mon, 21 Nov 2022 16:57:03 +0100 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 7E4A9309BD for ; Mon, 21 Nov 2022 16:57:03 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ox99z-0000Qk-B7; Mon, 21 Nov 2022 10:56:39 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oww41-0006Vj-A5 for guix-devel@gnu.org; Sun, 20 Nov 2022 20:57:37 -0500 Received: from mail-qv1-xf31.google.com ([2607:f8b0:4864:20::f31]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oww3z-0000zM-ML for guix-devel@gnu.org; Sun, 20 Nov 2022 20:57:37 -0500 Received: by mail-qv1-xf31.google.com with SMTP id df6so4982325qvb.0 for ; Sun, 20 Nov 2022 17:57:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:message-id:date:references:in-reply-to:subject:cc:to :from:from:to:cc:subject:date:message-id:reply-to; bh=5Sip9FQRUTXsrLjH+agYD7QXaPBpFQfp18xEvnPAosQ=; b=jrsf6IeJMXUeDcCCS7xDLqvqhexVKQcxpWmVx0CW7DKnZ13802EJE0Sfkovn6zh9NL pjNX6zjkWTq8YN3Dp+0WBHf3uQrZtzqfGBr8LLffyfT9KRGruhUlCNWUK6fRBaKRPzoU Eusgio6f3arQ9M6jE7AYzjhR8IEVt70t/qnhCVlNATW40DBoJB1lQmz40CswJNpO9u7N Qiw842LLhnIxZ5El31nV7p8T+0ReYv+fmAy3Kos8ysCt7ZAkGfIPOlMJLRnRl19Ey96i JzpB+O4MWe2embJkraQmvqFNojaRZANyLJ8dNfwf2tclpRNmflb8tIb/P1Al2G5BxxP9 uFJA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=mime-version:message-id:date:references:in-reply-to:subject:cc:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=5Sip9FQRUTXsrLjH+agYD7QXaPBpFQfp18xEvnPAosQ=; b=elpsQvSHpp5uqCgRF2pKptYscPs8Al0mF/skBn0cRqYhLRzA+SlepmFYoH2TbLoNVJ wZst4FLbFEXnO6y6z6RIE+6uA9CZCkzj9uRHuVCQ5V+ZqR5wqOklOEBqq0YupLZ1JbGa FKeHjnED6tRraIeig74j4WZeqylMmxlwHehQ+MayAw6WjR+oHIbU0q6xLKqL6bnFRP/2 twyQBtd9m8KR1Xx4k3giGvdlhS5ZTXI/XA1AzfacMaHKpfCFr+rwmDPd1v9/oak0e6eX zducrsr70OSJh77uCGkgCeVs7Qkln2jqlr0XKddCkFW4pERk4i6XQ5Q4Eoao9RgwmMjO MK4g== X-Gm-Message-State: ANoB5pkDhkciEtJvX41g74LUJwpRozOABrMeoKDN42Q6xPtePPBEkV5y faC0CZfT4LAAi1WOD0Q6d3GprBuFNJg= X-Google-Smtp-Source: AA0mqf7n4KTNjQECrmj4A8/lPsHtSBbXcaPZp1yqqMCnWg5e4Aigns/J85Oz+CAK+iU/Nl6UMde2wg== X-Received: by 2002:a05:6214:5984:b0:4c6:9390:983 with SMTP id ll4-20020a056214598400b004c693900983mr1217933qvb.65.1668995852603; Sun, 20 Nov 2022 17:57:32 -0800 (PST) Received: from localhost (104.sub-75-194-219.myvzw.com. [75.194.219.104]) by smtp.gmail.com with ESMTPSA id az42-20020a05620a172a00b006cfaee39ccesm7337490qkb.114.2022.11.20.17.57.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 20 Nov 2022 17:57:31 -0800 (PST) From: Jake Shilling To: Julien Lepiller , jgart Cc: Guix Devel Subject: Re: foreign-distro? In-Reply-To: <20221120230833.1220f1d8@sybil.lepiller.eu> References: <20221120145440.GB23557@dismail.de> <20221120230833.1220f1d8@sybil.lepiller.eu> Date: Sun, 20 Nov 2022 20:57:30 -0500 Message-ID: <87o7t19iid.fsf@gmail.com> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" Received-SPF: pass client-ip=2607:f8b0:4864:20::f31; envelope-from=shilling.jake@gmail.com; helo=mail-qv1-xf31.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Mon, 21 Nov 2022 10:56:37 -0500 X-BeenThere: guix-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list 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+larch=yhetil.org@gnu.org Sender: guix-devel-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1669046223; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=5Sip9FQRUTXsrLjH+agYD7QXaPBpFQfp18xEvnPAosQ=; b=E26BRtliO730p5OwmjjfwwjbRhFq6wy/lGJYu/OihS4cPmyhtshNnVVrh2RORc96sVzEEQ Fv7By0d5ErFnmZ+AUAEeuZ8x6voxZG1KL7fWJJDsgXaysMlPiLNkvgwF4sjglYu6p5BOU+ jW3WHis9lCej8ys/gG4vv7KE164LqauvoSxqofq/mMJkExGWj+8Kc+/cNzCSf1ILf25/PU 1Nsd+k5N4ELEwhuzEPm14H3OF056xOSkFSAf5UjwfihOgNHrV0vkkRNslQXTel//kc9c5G yp3CMCaN4fmrxK4mwyWuWTtZITJq8Poh5UhBVczhzSN9e8oLH0L/9m79E8ic4Q== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1669046223; a=rsa-sha256; cv=none; b=pLHXFk+AlMGhs+cZHQlgEObN6zNBYQVZID4P4ZuJ0U6zMEA4fiwpHndlH9J13aFAasRBZA uAwRHT/LZwE5QRmUYfnAmYJqwL14bPhZQoAPtxgBDlL3Wivu0lR1FxQUgEerikOyV3VaTR pC/F/RiNbbtFXUWlit+VIfRXriHB1WXXk3pOZyAtTJTB8m6cp4kIDRmj/nRoiS8SWjt0rI j5wsc/n9ipnRONEzYBo+pvbLeXATU1kDzx+9lCnPm9G1dKRbxZUr5qTC4xLaU4KOVkf4qH 27ZRau3fienuhQF8m/olSot3gEhykDdvHJEeFANw+nzW/NLo91qQ3N1MLCTmHQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=jrsf6IeJ; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (aspmx1.migadu.com: domain of "guix-devel-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-devel-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: -5.11 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=jrsf6IeJ; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (aspmx1.migadu.com: domain of "guix-devel-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-devel-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: 7E4A9309BD X-Spam-Score: -5.11 X-Migadu-Scanner: scn1.migadu.com X-TUID: a5VvijGTI10L --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable I've experimented with the distinction in my config, because I wanted to be able to add home-services conditionally (e.g. I wanted my GuixSD to install a destop envrionment, but my work laptop to only setup emacs and its dependencies). My approache was to just parse the `/etc/os-release` file if it exists: ``` (define (os-release) (guard (_ (else #f)) (call-with-input-file "/etc/os-release" (lambda (port) (let loop ((line (read-line port)) (result '())) (if (eof-object? line) (reverse result) (begin (let* ((split (string-split line #\=3D)) (key (string->symbol (car split))) (val (if (string-match "\".*\"" (cadr split)) (substring (cadr split) 1 (- (string-length= (cadr split)) 1)) (string->symbol (cadr split)))) (d (cons key val))) (loop (read-line port) (cons d result)))))))))) ``` Then I define a couple wrappers: ``` (define (linux-distro-id) (if (linux?) (assq-ref (os-release) 'ID) #f)) (define (guix-system?) (eq? (linux-distro-id) 'guix)) ``` The config was never really fleshed out because I ended up just using my GuixSD computer for work instead. On 2022-11-20 23:08, Julien Lepiller wrote: > Le Sun, 20 Nov 2022 14:54:40 -0600, > jgart a =C3=A9crit : > >> Does Guix have a declarative Guix API way of knowing if it is >> installing a package into foreign distro versus Guix System? >>=20 >> I'm thinking of a function like `foreign-distro?`: >>=20 >> ``` >> (define-public peek >> (package >> (name "peek") >> ... >> (inputs=20 >> `(,@(if (foreign-distro?) `(("ffmpeg" ,ffmpeg)) '()))) >> ``` >>=20 >> The above includes ffmpeg in the inputs only if installing peek on a >> foreign distro. It could additionally patch the ffmpeg executable in >> a peek package phases if foreign-distro? returns #t. >>=20 >> WDYT >>=20 > > > Guix doesn't have a notion of foreign distro, it's all in your head, > and there's no difference between Guix System and other distros in the > Guix package manager's point of view :) > > To be more specific, Guix only knows what you current system is (that's > captured by %current-system). It's probably x86_64-linux right know. As > you can see, there's no place in there to tell it whether you're on a > foreign distro or not. > > Lastly, I don't think I would want to differentiate the two cases, > especially since it would mean that somehow Guix packages depend on > something external. There's this idea that Guix packages should somehow > be self-sufficient. > =2D-=20 Best regards, Jake Shilling --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEEETgkkkGxzdwUBX+jR7vAMAFB0hsFAmN62woACgkQR7vAMAFB 0hubng/+LU9dxLHNZpEZ2j+KJ1QdfVXKYGaunkHrivR90a5WvJCtoXs/MzzrT5Dk S9TRCDVhvVl4fk08qH+pYKI5/4GfIWJJkZ4v67/F9uc9GY1H5BTSjG7sem5B+8tA TncmTsg4QrRRyvnng7wM6fsFeuJFIr6VeR+K9IdUy3pmZxfAgr7y0e5uZVauX+F7 aeI4x9TZIBeb/V0ZbZeL6jB4Mw3btzWCrfDxEi6aOii84RFSQPGJHLhfZ6MVkNgx ydlIdU1I6/yYG52ZsqAW1Jyawl3Dxw/ulx6zMTMURchjmlDeaq/gbPAQtj6JX9Iu nPTixMh80qlJ9wL3XImY2egdKaWvFuSP1t9yiHvQ3FF1FbZZbpk1043YQ8fI8tc/ nkOzHQp31DMUFaDxzHAnOQnpiURpBcYw3RAztJELs1MujRqi4NQpZEUzhp9ElGVO kSart73A7zeHpFVDSC9f1JjgVmXJF9+nJmjjnGO41guVZB42b2vdadkBfFJh5w8O rL2kczGJlWpKocGzQCbufXc5YDmCi5U1EsvmPkHkDZhJoaZLyQqTCzEdwF4yZcnG MkusP53k3xLxQksaNdmcdv6c4JO1KZ7UHMuQSANSlAUqBMAGerBrjFzQE97/grs8 lBeE5eNQ07TKRu89uvwR3VjV5c05sbcEA/Zw0j5zKJVjm2urbWQ= =4Gxo -----END PGP SIGNATURE----- --=-=-=--