From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2.migadu.com ([2001:41d0:700:3204::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms8.migadu.com with LMTPS id sGFsE4gPeGXQoAAAkFu2QA (envelope-from ) for ; Tue, 12 Dec 2023 08:45:12 +0100 Received: from aspmx1.migadu.com ([2001:41d0:403:4876::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2.migadu.com with LMTPS id 8D28C4gPeGXZlgAAe85BDQ (envelope-from ) for ; Tue, 12 Dec 2023 08:45:12 +0100 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=laesvuori.fi header.s=mail header.b=mat3jpWe; 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"; dmarc=pass (policy=reject) header.from=laesvuori.fi ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1702367112; 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=SNdRNLI7T9dBdXUUDsVLpZ06WtIHIB+vmojiItV2PVY=; b=geuu0HAXHlL5kByuFJfZ3GM3RnTxwuecmP9J4hej8XjjPZkdg2EGi3nCW9gpX+YEZ6XSQN kp4jtzkeSex6v5JJhmuvTQgiVRAaxF4DFo2AujD7zsrayocp+CIa9TnO86AFDH9QGaltu0 5JZ3WpK2/9XHdBSTQY5elSBzOPwaXImp0izy34GeYnxnsNaqixV/dpdbpdmmdqsQXk2zIi bAEKcyLjW3B93fUsiYf3l37hipka4uhwRLEyagjE/hB9y7/+jfqPguiqPdPQbNV1r9hEsg pa7cRSxLDupJxR7CARazT4OGx+IIjMwJ7nrCWy/5MiroPHzTChrkNPpyDlyIFw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=laesvuori.fi header.s=mail header.b=mat3jpWe; 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"; dmarc=pass (policy=reject) header.from=laesvuori.fi ARC-Seal: i=1; s=key1; d=yhetil.org; t=1702367112; a=rsa-sha256; cv=none; b=UWRrqY0smpVefJEqnwznwz0tzk0AcVXskelhpAKJ1xhqffRETmMCzFy/qrV3jdhb6iU1Ko OmrIH7jLLatV2ehHo7aU8sG4+ludhtL99wPhCcvqkLnQjndNj/AVeCZWD7RMqMYYIj3wyO 7F7IM3kfGz8hIVOUQs6uspWed+REI2pd2cPw8evyL5s9LP8B+nZOUYMHvL7eAoK6G3LUX5 B1g76MuR8IZwZlLWyCUD1V0MO3Xi44uoXcIfuQkKW2YG4qaZ32BSO7A8z1b4vx0rjCWGXX JpHHwWh/ELFtcNF/YgHms3JgMrDJvcNSY/ylqpmjamKjYZdUjxbEgC2Od3WJGA== 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 180AB27690 for ; Tue, 12 Dec 2023 08:45:12 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rCxRP-00063C-84; Tue, 12 Dec 2023 02:44:31 -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 1rCxRM-00062w-Ed for guix-devel@gnu.org; Tue, 12 Dec 2023 02:44:28 -0500 Received: from vmi571514.contaboserver.net ([75.119.130.101] helo=mail.laesvuori.fi) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rCxRK-0000bS-6c for guix-devel@gnu.org; Tue, 12 Dec 2023 02:44:27 -0500 Received: from X-kone (unknown [130.233.144.30]) by mail.laesvuori.fi (Postfix) with ESMTPSA id 95BCF3400DF; Tue, 12 Dec 2023 08:44:26 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=laesvuori.fi; s=mail; t=1702367067; bh=SKz2SbxOOS86FFbkj+25wHRpkDA7KuEoGL3uRoRcEuU=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=mat3jpWe9jJJP5c2gX7AP6rLY00hjDG3V933FlWLsz12XVUQReMsYMxrM8j322ABF /ZL8iVDZr9VIFcXrkMRnkm55j8NT+BMG7z9l3h+nsIsxQHnMvHiCXs/vFCtn5Fw/6c W4OWwp5S2Yur6N+/pgz94RBmBfi+tA5IXbHQxiUA= Date: Tue, 12 Dec 2023 09:44:20 +0200 From: Saku Laesvuori To: Felix Lechner Cc: guix-devel@gnu.org Subject: Re: Type of 'os' in gnu/system.scm Message-ID: References: <87h6kob7bk.fsf@lease-up.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="omxio67ibajfwsrk" Content-Disposition: inline In-Reply-To: <87h6kob7bk.fsf@lease-up.com> Received-SPF: pass client-ip=75.119.130.101; envelope-from=saku@laesvuori.fi; helo=mail.laesvuori.fi 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, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action 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-Country: US X-Migadu-Flow: FLOW_IN X-Migadu-Spam-Score: -11.25 X-Spam-Score: -11.25 X-Migadu-Queue-Id: 180AB27690 X-Migadu-Scanner: mx10.migadu.com X-TUID: TSs5lhP5HSld --omxio67ibajfwsrk Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable > Hi, >=20 > Looking at this definition in gnu/system.scm [1] I am trying to figure > out what 'os' is: >=20 > (define* (operating-system-kernel-arguments > os root-device #:key (version %boot-parameters-version)) > "Return all the kernel arguments, including the ones not specified di= rectly > by the user. VERSION should match that of the target = record > object that will contain the kernel parameters." > (append (bootable-kernel-arguments os root-device version) > (operating-system-user-kernel-arguments os))) >=20 > The same file also contains a record definition for > so it seemed reasonable to assume that 'os' referred to such a > record. In fact, the second procedure inside the 'append' above, > operating-system-user-kernel-arguments, is one of the accessors [2] > (even though the name does not match the field). Yes, it is supposed to be an record (of course, scheme does not enforce that in any way and it may end up being any other type during runtime if there is a bug in some other code). > In the first procedure bootable-kernel-arguments [3] however, 'os' > (which is called 'system' there) is used like a string, although inside > a gexp: >=20 > (define* (bootable-kernel-arguments system root-device version) > "Return a list of kernel arguments (gexps) to boot SYSTEM from ROOT-D= EVICE. > VERSION is the target version of the boot-parameters record." > ;; If the version is newer than 0, we use the new style initrd parame= ter > ;; names, otherwise we use the legacy ones. This is to maintain back= ward > ;; compatibility when producing bootloader configurations for older > ;; generations. > (define version>0? (> version 0)) > (list (string-append (if version>0? "root=3D" "--root=3D") > ;; Note: Always use the DCE format because that'= s what > ;; (gnu build linux-boot) expects for the 'root' > ;; kernel command-line option. > (file-system-device->string root-device > #:uuid-type 'dce)) > #~(string-append (if #$version>0? "gnu.system=3D" "--system=3D"= ) #$system) > #~(string-append (if #$version>0? "gnu.load=3D" "--load=3D") > #$system "/boot"))) >=20 > I know objects in the store become paths when unquoted via '#$'. Does > that also work for Guix records declared via define-record-type* [4] > (please note the asterisk)? Thanks! The record is expanded to a store path because there is a (define-gexp-compiler ...) form for it in gnu/system.scm[1]. The gexp expansion mechanism is explained quite well in a "Dissecting Guix" blog post[2]. [1]: https://git.savannah.gnu.org/cgit/guix.git/tree/gnu/system.scm#n1623 [2]: https://guix.gnu.org/en/blog/2023/dissecting-guix-part-3-g-expressions/ --omxio67ibajfwsrk Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEoMkZR3NPB29fCOn/JX0oSiodOjIFAmV4D1QACgkQJX0oSiod OjLidw//fOUuTBwb9YK51BfaFtZYH8+GBQzB3/ZBH3rJh5o6hJnGd1fpJWvQV/GD 3STLBjuCHUOetwVYFSkg4GLPlrvcKNoHTr7sFVa+4l49mKhQNudkZxGUsogYjIEj tax4LHKUDW4oQ1CuRauCqjZPwwvxUxjEha5/8LdON83j5XXu4zcXGqH4GvCQn7Do Ox61wro2gQdy70MOcdEytQsG9art6QXy4BlVO8wWAxejcqK5CAQ6dxT4qppRjkgD /OrvIQUPULVQas91GvGAilKB0k6exWZL0KCwOYMk9wb3NFtPfixfhWl04s5iLnD2 hFjAnU7woTbzk4wb7Jghxbou7ItdAbYK1UMLk1TOPlqupAJoWdCDwrl9/iBh8/vf mTWFAIebmIL43yhF249FqoFt/CLa3TCAICb92CF/9alQKlKoy2xV/6vDEzrtgmhV heo6HBE6A+fAF6WstGRwN6AaJB7vrASw8QEgAvGhC1ariWX02BXseWcxPz2+pRbg FPhuTqjGYeypVoo+WGMC3WESKGz73+joP/+lAMfwLgD4LYaUxl8BPDhzcodL5EDP zCyWKls/5wLbKmzw0XWpYY+CFlJ2m1S5Cp/j5ewHt0czrwp5hJdeVdqjM6H0Qe+w wrj3leQn/1BHYPNRwMuZxGGHNYDLk0RsYHOFsgrR3jWHp22lVwY= =XufW -----END PGP SIGNATURE----- --omxio67ibajfwsrk--