From unknown Sun Aug 10 07:34:23 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#34948] [PATCH 0/3] Turn 'essential-services' into an field Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 22 Mar 2019 17:22:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 34948 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 34948@debbugs.gnu.org Cc: Arun Isaac , Ludovic =?UTF-8?Q?Court=C3=A8s?= X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.15532753005379 (code B ref -1); Fri, 22 Mar 2019 17:22:02 +0000 Received: (at submit) by debbugs.gnu.org; 22 Mar 2019 17:21:40 +0000 Received: from localhost ([127.0.0.1]:54629 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1h7NrQ-0001Oh-9A for submit@debbugs.gnu.org; Fri, 22 Mar 2019 13:21:40 -0400 Received: from eggs.gnu.org ([209.51.188.92]:41319) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1h7NrL-0001OR-K7 for submit@debbugs.gnu.org; Fri, 22 Mar 2019 13:21:36 -0400 Received: from lists.gnu.org ([209.51.188.17]:44750) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1h7NrG-0000m1-Ex for submit@debbugs.gnu.org; Fri, 22 Mar 2019 13:21:30 -0400 Received: from eggs.gnu.org ([209.51.188.92]:55695) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h7NrF-0007cC-AT for guix-patches@gnu.org; Fri, 22 Mar 2019 13:21:30 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,BAYES_20, URIBL_BLOCKED autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([2001:470:142:3::e]:46834) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h7NrD-0000dl-Mj; Fri, 22 Mar 2019 13:21:27 -0400 Received: from [2001:660:6102:320:e120:2c8f:8909:cdfe] (port=49236 helo=gnu.org) by fencepost.gnu.org with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1h7NrD-0001C7-Ac; Fri, 22 Mar 2019 13:21:27 -0400 From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Date: Fri, 22 Mar 2019 18:21:20 +0100 Message-Id: <20190322172120.10974-1-ludo@gnu.org> X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Hello Guix! This is the solution that Arun and I were discussing: https://issues.guix.info/issue/28128#17 This series adds support for “self-referential records”: from the definition of a thunked field, you can use ‘this-record’ to access the record that the field belongs to. It then uses that to turn ‘essential-services’ into a thunked field of rather than an inaccessible internal procedure. This allows us to remove all the #:container? flags from (gnu system) and instead of (gnu system linux-container) simply override ‘essential-services’ as needed. Thoughts? Thanks, Ludo’. Ludovic Courtès (3): records: Allow thunked fields to refer to 'this-record'. accounts: Add default value for the 'home-directory' field of . system: Add 'essential-services' field to . doc/guix.texi | 8 ++- gnu/system.scm | 71 +++++++++----------- gnu/system/accounts.scm | 7 +- gnu/system/examples/bare-bones.tmpl | 3 +- gnu/system/examples/beaglebone-black.tmpl | 3 +- gnu/system/examples/desktop.tmpl | 3 +- gnu/system/examples/docker-image.tmpl | 3 +- gnu/system/examples/lightweight-desktop.tmpl | 3 +- gnu/system/install.scm | 3 +- gnu/system/linux-container.scm | 69 ++++++++++++------- gnu/system/vm.scm | 13 ++-- gnu/tests.scm | 5 +- gnu/tests/install.scm | 14 ++-- guix/records.scm | 24 ++++++- tests/accounts.scm | 4 -- tests/records.scm | 40 +++++++++++ 16 files changed, 169 insertions(+), 104 deletions(-) -- 2.21.0 From unknown Sun Aug 10 07:34:23 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#34948] [PATCH 1/3] records: Allow thunked fields to refer to 'this-record'. References: <20190322172120.10974-1-ludo@gnu.org> In-Reply-To: <20190322172120.10974-1-ludo@gnu.org> Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 22 Mar 2019 17:28:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 34948 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 34948@debbugs.gnu.org Cc: Arun Isaac , Ludovic =?UTF-8?Q?Court=C3=A8s?= Received: via spool by 34948-submit@debbugs.gnu.org id=B34948.15532756596001 (code B ref 34948); Fri, 22 Mar 2019 17:28:02 +0000 Received: (at 34948) by debbugs.gnu.org; 22 Mar 2019 17:27:39 +0000 Received: from localhost ([127.0.0.1]:54647 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1h7NxC-0001Yh-AD for submit@debbugs.gnu.org; Fri, 22 Mar 2019 13:27:38 -0400 Received: from eggs.gnu.org ([209.51.188.92]:42616) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1h7NxA-0001YO-Hr for 34948@debbugs.gnu.org; Fri, 22 Mar 2019 13:27:36 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:46963) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h7Nx4-0004is-F1; Fri, 22 Mar 2019 13:27:30 -0400 Received: from [2001:660:6102:320:e120:2c8f:8909:cdfe] (port=49252 helo=gnu.org) by fencepost.gnu.org with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1h7Nx3-0001o0-Qc; Fri, 22 Mar 2019 13:27:30 -0400 From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Date: Fri, 22 Mar 2019 18:27:17 +0100 Message-Id: <20190322172719.11199-1-ludo@gnu.org> X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Spam-Score: -0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) * guix/records.scm (this-record): New syntax parameter. (make-syntactic-constructor)[wrap-field-value]: When F is thunked, return a one-argument lambda instead of a thunk, and parameterize THIS-RECORD. (define-record-type*)[thunked-field-accessor-definition]: Pass X to (real-get X). * tests/records.scm ("define-record-type* & thunked & this-record") ("define-record-type* & thunked & default & this-record") ("define-record-type* & thunked & inherit & this-record"): New tests. --- guix/records.scm | 24 ++++++++++++++++++++++-- tests/records.scm | 40 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 62 insertions(+), 2 deletions(-) diff --git a/guix/records.scm b/guix/records.scm index 0649c90ea3..244b124098 100644 --- a/guix/records.scm +++ b/guix/records.scm @@ -25,6 +25,8 @@ #:use-module (ice-9 regex) #:use-module (ice-9 rdelim) #:export (define-record-type* + this-record + alist->record object->fields recutils->alist @@ -93,6 +95,17 @@ interface\" (ABI) for TYPE is equal to COOKIE." (() #t))))))) +(define-syntax-parameter this-record + (lambda (s) + "Return the record being defined. This macro may only be used in the +context of the definition of a thunked field." + (syntax-case s () + (id + (identifier? #'id) + (syntax-violation 'this-record + "cannot be used outside of a record instantiation" + #'id))))) + (define-syntax make-syntactic-constructor (syntax-rules () "Make the syntactic constructor NAME for TYPE, that calls CTOR, and @@ -148,7 +161,14 @@ of TYPE matches the expansion-time ABI." (define (wrap-field-value f value) (cond ((thunked-field? f) - #`(lambda () #,value)) + #`(lambda (x) + (syntax-parameterize ((this-record + (lambda (s) + (syntax-case s () + (id + (identifier? #'id) + #'x))))) + #,value))) ((delayed-field? f) #`(delay #,value)) (else value))) @@ -308,7 +328,7 @@ inherited." (with-syntax ((real-get (wrapped-field-accessor-name field))) #'(define-inlinable (get x) ;; The real value of that field is a thunk, so call it. - ((real-get x))))))) + ((real-get x) x)))))) (define (delayed-field-accessor-definition field) ;; Return the real accessor for FIELD, which is assumed to be a diff --git a/tests/records.scm b/tests/records.scm index d9469a78bd..45614093a0 100644 --- a/tests/records.scm +++ b/tests/records.scm @@ -170,6 +170,46 @@ (parameterize ((mark (cons 'a 'b))) (eq? (foo-bar y) (mark))))))) +(test-assert "define-record-type* & thunked & this-record" + (begin + (define-record-type* foo make-foo + foo? + (bar foo-bar) + (baz foo-baz (thunked))) + + (let ((x (foo (bar 40) + (baz (+ (foo-bar this-record) 2))))) + (and (= 40 (foo-bar x)) + (= 42 (foo-baz x)))))) + +(test-assert "define-record-type* & thunked & default & this-record" + (begin + (define-record-type* foo make-foo + foo? + (bar foo-bar) + (baz foo-baz (thunked) + (default (+ (foo-bar this-record) 2)))) + + (let ((x (foo (bar 40)))) + (and (= 40 (foo-bar x)) + (= 42 (foo-baz x)))))) + +(test-assert "define-record-type* & thunked & inherit & this-record" + (begin + (define-record-type* foo make-foo + foo? + (bar foo-bar) + (baz foo-baz (thunked) + (default (+ (foo-bar this-record) 2)))) + + (let* ((x (foo (bar 40))) + (y (foo (inherit x) (bar -2))) + (z (foo (inherit x) (baz -2)))) + (and (= -2 (foo-bar y)) + (= 0 (foo-baz y)) + (= 40 (foo-bar z)) + (= -2 (foo-baz z)))))) + (test-assert "define-record-type* & delayed" (begin (define-record-type* foo make-foo -- 2.21.0 From unknown Sun Aug 10 07:34:23 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#34948] [PATCH 2/3] accounts: Add default value for the 'home-directory' field of . Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 22 Mar 2019 17:28:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 34948 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 34948@debbugs.gnu.org Cc: Arun Isaac , Ludovic =?UTF-8?Q?Court=C3=A8s?= Received: via spool by 34948-submit@debbugs.gnu.org id=B34948.15532756606014 (code B ref 34948); Fri, 22 Mar 2019 17:28:02 +0000 Received: (at 34948) by debbugs.gnu.org; 22 Mar 2019 17:27:40 +0000 Received: from localhost ([127.0.0.1]:54649 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1h7NxE-0001Yw-1b for submit@debbugs.gnu.org; Fri, 22 Mar 2019 13:27:40 -0400 Received: from eggs.gnu.org ([209.51.188.92]:42619) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1h7NxA-0001YP-JH for 34948@debbugs.gnu.org; Fri, 22 Mar 2019 13:27:37 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:46964) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h7Nx5-0004kh-Bt; Fri, 22 Mar 2019 13:27:31 -0400 Received: from [2001:660:6102:320:e120:2c8f:8909:cdfe] (port=49252 helo=gnu.org) by fencepost.gnu.org with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1h7Nx4-0001o0-Qg; Fri, 22 Mar 2019 13:27:31 -0400 From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Date: Fri, 22 Mar 2019 18:27:18 +0100 Message-Id: <20190322172719.11199-2-ludo@gnu.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190322172719.11199-1-ludo@gnu.org> References: <20190322172719.11199-1-ludo@gnu.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) * gnu/system/accounts.scm ()[home-directory]: Mark as thunked and add a default value. (default-home-directory): New procedure. * doc/guix.texi (User Accounts): Remove 'home-directory' from example. * gnu/system/examples/bare-bones.tmpl: Likewise. * gnu/system/examples/beaglebone-black.tmpl: Likewise. * gnu/system/examples/desktop.tmpl: Likewise. * gnu/system/examples/docker-image.tmpl: Likewise. * gnu/system/examples/lightweight-desktop.tmpl: Likewise. * gnu/system/install.scm (installation-os): Likewise. * gnu/tests.scm (%simple-os): Likewise. * gnu/tests/install.scm (%minimal-os, %minimal-os-on-vda): (%separate-home-os, %encrypted-root-os, %btrfs-root-os): Likewise. * tests/accounts.scm ("allocate-passwd") ("allocate-passwd with previous state"): Likewise. --- doc/guix.texi | 1 - gnu/system/accounts.scm | 7 ++++++- gnu/system/examples/bare-bones.tmpl | 3 +-- gnu/system/examples/beaglebone-black.tmpl | 3 +-- gnu/system/examples/desktop.tmpl | 3 +-- gnu/system/examples/docker-image.tmpl | 3 +-- gnu/system/examples/lightweight-desktop.tmpl | 3 +-- gnu/system/install.scm | 3 +-- gnu/tests.scm | 5 ++--- gnu/tests/install.scm | 14 ++++---------- tests/accounts.scm | 4 ---- 11 files changed, 18 insertions(+), 31 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index 94d7a29bdf..642232ee9c 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -10868,7 +10868,6 @@ this field must contain the encrypted password, as a string. You can use the @example (user-account (name "charlie") - (home-directory "/home/charlie") (group "users") ;; Specify a SHA-512-hashed initial password. diff --git a/gnu/system/accounts.scm b/gnu/system/accounts.scm index eb18fb5e43..586cff1842 100644 --- a/gnu/system/accounts.scm +++ b/gnu/system/accounts.scm @@ -67,7 +67,8 @@ (supplementary-groups user-account-supplementary-groups (default '())) ; list of strings (comment user-account-comment (default "")) - (home-directory user-account-home-directory) + (home-directory user-account-home-directory (thunked) + (default (default-home-directory this-record))) (create-home-directory? user-account-create-home-directory? ;Boolean (default #t)) (shell user-account-shell ; gexp @@ -84,6 +85,10 @@ (system? user-group-system? ; Boolean (default #f))) +(define (default-home-directory account) + "Return the default home directory for ACCOUNT." + (string-append "/home/" (user-account-name account))) + (define (sexp->user-group sexp) "Take SEXP, a tuple as returned by 'user-group->gexp', and turn it into a user-group record." diff --git a/gnu/system/examples/bare-bones.tmpl b/gnu/system/examples/bare-bones.tmpl index a88bab034f..4f30a5b756 100644 --- a/gnu/system/examples/bare-bones.tmpl +++ b/gnu/system/examples/bare-bones.tmpl @@ -35,8 +35,7 @@ ;; and "video" allows the user to play sound ;; and access the webcam. (supplementary-groups '("wheel" - "audio" "video")) - (home-directory "/home/alice")) + "audio" "video"))) %base-user-accounts)) ;; Globally-installed packages. diff --git a/gnu/system/examples/beaglebone-black.tmpl b/gnu/system/examples/beaglebone-black.tmpl index 11678063b2..def05e807d 100644 --- a/gnu/system/examples/beaglebone-black.tmpl +++ b/gnu/system/examples/beaglebone-black.tmpl @@ -38,8 +38,7 @@ ;; and "video" allows the user to play sound ;; and access the webcam. (supplementary-groups '("wheel" - "audio" "video")) - (home-directory "/home/alice")) + "audio" "video"))) %base-user-accounts)) ;; Globally-installed packages. diff --git a/gnu/system/examples/desktop.tmpl b/gnu/system/examples/desktop.tmpl index c59bf92681..bc5cbd6e6b 100644 --- a/gnu/system/examples/desktop.tmpl +++ b/gnu/system/examples/desktop.tmpl @@ -42,8 +42,7 @@ (comment "Alice's brother") (group "users") (supplementary-groups '("wheel" "netdev" - "audio" "video")) - (home-directory "/home/bob")) + "audio" "video"))) %base-user-accounts)) ;; This is where we specify system-wide packages. diff --git a/gnu/system/examples/docker-image.tmpl b/gnu/system/examples/docker-image.tmpl index 9690d651c1..ca633cc838 100644 --- a/gnu/system/examples/docker-image.tmpl +++ b/gnu/system/examples/docker-image.tmpl @@ -15,8 +15,7 @@ (comment "Bob's sister") (group "users") (supplementary-groups '("wheel" - "audio" "video")) - (home-directory "/home/alice")) + "audio" "video"))) %base-user-accounts)) ;; Globally-installed packages. diff --git a/gnu/system/examples/lightweight-desktop.tmpl b/gnu/system/examples/lightweight-desktop.tmpl index a234badd2b..45d9bf447f 100644 --- a/gnu/system/examples/lightweight-desktop.tmpl +++ b/gnu/system/examples/lightweight-desktop.tmpl @@ -35,8 +35,7 @@ (comment "Bob's sister") (group "users") (supplementary-groups '("wheel" "netdev" - "audio" "video")) - (home-directory "/home/alice")) + "audio" "video"))) %base-user-accounts)) ;; Add a bunch of window managers; we can choose one at diff --git a/gnu/system/install.scm b/gnu/system/install.scm index bad318d06b..aad1deb913 100644 --- a/gnu/system/install.scm +++ b/gnu/system/install.scm @@ -379,8 +379,7 @@ You have been warned. Thanks for being so brave.\x1b[0m (group "users") (supplementary-groups '("wheel")) ; allow use of sudo (password "") - (comment "Guest of GNU") - (home-directory "/home/guest")))) + (comment "Guest of GNU")))) (issue %issue) (services %installation-services) diff --git a/gnu/tests.scm b/gnu/tests.scm index 9e8eed7d95..0871b4c6f7 100644 --- a/gnu/tests.scm +++ b/gnu/tests.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2016, 2017, 2018 Ludovic Courtès +;;; Copyright © 2016, 2017, 2018, 2019 Ludovic Courtès ;;; Copyright © 2017 Mathieu Othacehe ;;; Copyright © 2017 Tobias Geerinckx-Rice ;;; @@ -219,8 +219,7 @@ the system under test." (name "alice") (comment "Bob's sister") (group "users") - (supplementary-groups '("wheel" "audio" "video")) - (home-directory "/home/alice")) + (supplementary-groups '("wheel" "audio" "video"))) %base-user-accounts)))) (define-syntax-rule (simple-operating-system user-services ...) diff --git a/gnu/tests/install.scm b/gnu/tests/install.scm index 277908cc49..c0debbd840 100644 --- a/gnu/tests/install.scm +++ b/gnu/tests/install.scm @@ -74,8 +74,7 @@ (name "alice") (comment "Bob's sister") (group "users") - (supplementary-groups '("wheel" "audio" "video")) - (home-directory "/home/alice")) + (supplementary-groups '("wheel" "audio" "video"))) %base-user-accounts)) (services (cons (service marionette-service-type (marionette-configuration @@ -357,8 +356,7 @@ per %test-installed-os, this test is expensive in terms of CPU and storage.") (name "alice") (comment "Bob's sister") (group "users") - (supplementary-groups '("wheel" "audio" "video")) - (home-directory "/home/alice")) + (supplementary-groups '("wheel" "audio" "video"))) %base-user-accounts)) (services (cons (service marionette-service-type (marionette-configuration @@ -435,12 +433,10 @@ reboot\n") %base-file-systems)) (users (cons* (user-account (name "alice") - (group "users") - (home-directory "/home/alice")) + (group "users")) (user-account (name "charlie") - (group "users") - (home-directory "/home/charlie")) + (group "users")) %base-user-accounts)) (services (cons (service marionette-service-type (marionette-configuration @@ -655,7 +651,6 @@ by 'mdadm'.") (users (cons (user-account (name "charlie") (group "users") - (home-directory "/home/charlie") (supplementary-groups '("wheel" "audio" "video"))) %base-user-accounts)) (services (cons (service marionette-service-type @@ -776,7 +771,6 @@ build (current-guix) and then store a couple of full system images.") (users (cons (user-account (name "charlie") (group "users") - (home-directory "/home/charlie") (supplementary-groups '("wheel" "audio" "video"))) %base-user-accounts)) (services (cons (service marionette-service-type diff --git a/tests/accounts.scm b/tests/accounts.scm index 127861042d..923ba7dc83 100644 --- a/tests/accounts.scm +++ b/tests/accounts.scm @@ -199,12 +199,10 @@ nobody:!:0::::::\n")) (directory "/var/empty"))) (allocate-passwd (list (user-account (name "alice") (comment "Alice") - (home-directory "/home/alice") (shell "/bin/sh") (group "users")) (user-account (name "bob") (comment "Bob") - (home-directory "/home/bob") (shell "/bin/gash") (group "wheel")) (user-account (name "sshd") (system? #t) @@ -234,12 +232,10 @@ nobody:!:0::::::\n")) (directory "/home/charlie"))) (allocate-passwd (list (user-account (name "alice") (comment "Alice") - (home-directory "/home/alice") (shell "/bin/sh") ;ignored (group "users")) (user-account (name "charlie") (comment "Charlie") - (home-directory "/home/charlie") (shell "/bin/sh") (group "users"))) (list (group-entry (name "users") (gid 1000))) -- 2.21.0 From unknown Sun Aug 10 07:34:23 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#34948] [PATCH 3/3] system: Add 'essential-services' field to . Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 22 Mar 2019 17:28:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 34948 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 34948@debbugs.gnu.org Cc: Arun Isaac , Ludovic =?UTF-8?Q?Court=C3=A8s?= Received: via spool by 34948-submit@debbugs.gnu.org id=B34948.15532756666028 (code B ref 34948); Fri, 22 Mar 2019 17:28:03 +0000 Received: (at 34948) by debbugs.gnu.org; 22 Mar 2019 17:27:46 +0000 Received: from localhost ([127.0.0.1]:54651 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1h7NxH-0001Z6-Ms for submit@debbugs.gnu.org; Fri, 22 Mar 2019 13:27:44 -0400 Received: from eggs.gnu.org ([209.51.188.92]:42623) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1h7NxC-0001YS-6x for 34948@debbugs.gnu.org; Fri, 22 Mar 2019 13:27:39 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:46965) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h7Nx6-0004nO-OX; Fri, 22 Mar 2019 13:27:33 -0400 Received: from [2001:660:6102:320:e120:2c8f:8909:cdfe] (port=49252 helo=gnu.org) by fencepost.gnu.org with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1h7Nx5-0001o0-Q1; Fri, 22 Mar 2019 13:27:32 -0400 From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Date: Fri, 22 Mar 2019 18:27:19 +0100 Message-Id: <20190322172719.11199-3-ludo@gnu.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190322172719.11199-1-ludo@gnu.org> References: <20190322172719.11199-1-ludo@gnu.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) * gnu/system.scm ()[essential-services]: New field. (operating-system-directory-base-entries): Remove #:container? keyword and keep only the not-container branch. (essential-services): Likewise. (operating-system-services): Likewise, and call 'operating-system-essential-services' instead of 'essential-services'. (operating-system-activation-script): Remove #:container?. (operating-system-boot-script): Likewise. (operating-system-derivation): Likewise. * gnu/system/linux-container.scm (container-essential-services): New procedure. (containerized-operating-system): Use it and set the 'essential-services' field. (container-script): Remove call to 'operating-system-derivation'. * gnu/system/vm.scm (system-docker-image): Likewise. * doc/guix.texi (operating-system Reference): Document 'essential-services'. --- doc/guix.texi | 7 ++++ gnu/system.scm | 71 +++++++++++++++------------------- gnu/system/linux-container.scm | 69 ++++++++++++++++++++------------- gnu/system/vm.scm | 13 ++++--- 4 files changed, 89 insertions(+), 71 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index 642232ee9c..0b88503f3b 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -10472,6 +10472,13 @@ details. @item @code{services} (default: @var{%base-services}) A list of service objects denoting system services. @xref{Services}. +@cindex essential services +@item @code{essential-services} (default: ...) +The list of ``essential services''---i.e., things like instances of +@code{system-service-type} and @code{host-name-service-type} (@pxref{Service +Reference}), which are derived from the operating system definition itself. +As a user you should @emph{never} need to touch this field. + @item @code{pam-services} (default: @code{(base-pam-services)}) @cindex PAM @cindex pluggable authentication modules diff --git a/gnu/system.scm b/gnu/system.scm index 6bccdaa8c2..f059c1b07d 100644 --- a/gnu/system.scm +++ b/gnu/system.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2013, 2014, 2015, 2016, 2017, 2018 Ludovic Courtès +;;; Copyright © 2013, 2014, 2015, 2016, 2017, 2018, 2019 Ludovic Courtès ;;; Copyright © 2015 Mark H Weaver ;;; Copyright © 2015, 2016 Alex Kost ;;; Copyright © 2016 Chris Marusich @@ -69,6 +69,7 @@ operating-system-bootloader operating-system-services + operating-system-essential-services operating-system-user-services operating-system-packages operating-system-host-name @@ -199,6 +200,9 @@ (name-service-switch operating-system-name-service-switch ; (default %default-nss)) + (essential-services operating-system-essential-services ; list of services + (thunked) + (default (essential-services this-record))) (services operating-system-user-services ; list of services (default %base-services)) @@ -436,27 +440,22 @@ OS." (file-append (operating-system-kernel os) "/" (system-linux-image-file-name os))) -(define* (operating-system-directory-base-entries os #:key container?) +(define* (operating-system-directory-base-entries os) "Return the basic entries of the 'system' directory of OS for use as the value of the SYSTEM-SERVICE-TYPE service." (let ((locale (operating-system-locale-directory os))) - (with-monad %store-monad - (if container? - (return `(("locale" ,locale))) - (mlet %store-monad - ((kernel -> (operating-system-kernel os)) - (initrd -> (operating-system-initrd-file os)) - (params (operating-system-boot-parameters-file os))) - (return `(("kernel" ,kernel) - ("parameters" ,params) - ("initrd" ,initrd) - ("locale" ,locale)))))))) ;used by libc + (mlet %store-monad ((kernel -> (operating-system-kernel os)) + (initrd -> (operating-system-initrd-file os)) + (params (operating-system-boot-parameters-file os))) + (return `(("kernel" ,kernel) + ("parameters" ,params) + ("initrd" ,initrd) + ("locale" ,locale)))))) ;used by libc -(define* (essential-services os #:key container?) +(define* (essential-services os) "Return the list of essential services for OS. These are special services that implement part of what's declared in OS are responsible for low-level -bookkeeping. CONTAINER? determines whether to return the list of services for -a container or that of a \"bare metal\" system." +bookkeeping." (define known-fs (map file-system-mount-point (operating-system-file-systems os))) @@ -466,8 +465,7 @@ a container or that of a \"bare metal\" system." (swaps (swap-services os)) (procs (service user-processes-service-type)) (host-name (host-name-service (operating-system-host-name os))) - (entries (operating-system-directory-base-entries - os #:container? container?))) + (entries (operating-system-directory-base-entries os))) (cons* (service system-service-type entries) %boot-service @@ -495,20 +493,16 @@ a container or that of a \"bare metal\" system." other-fs (append mappings swaps - ;; Add the firmware service, unless we are building for a - ;; container. - (if container? - (list %containerized-shepherd-service) - (list %linux-bare-metal-service - (service firmware-service-type - (operating-system-firmware os)))))))) + ;; Add the firmware service. + (list %linux-bare-metal-service + (service firmware-service-type + (operating-system-firmware os))))))) -(define* (operating-system-services os #:key container?) - "Return all the services of OS, including \"internal\" services that do not -explicitly appear in OS." +(define* (operating-system-services os) + "Return all the services of OS, including \"essential\" services." (instantiate-missing-services (append (operating-system-user-services os) - (essential-services os #:container? container?)))) + (operating-system-essential-services os)))) ;;; @@ -806,20 +800,19 @@ use 'plain-file' instead~%") root ALL=(ALL) ALL %wheel ALL=(ALL) ALL\n")) -(define* (operating-system-activation-script os #:key container?) +(define* (operating-system-activation-script os) "Return the activation script for OS---i.e., the code that \"activates\" the stateful part of OS, including user accounts and groups, special directories, etc." - (let* ((services (operating-system-services os #:container? container?)) + (let* ((services (operating-system-services os)) (activation (fold-services services #:target-type activation-service-type))) (activation-service->script activation))) -(define* (operating-system-boot-script os #:key container?) +(define* (operating-system-boot-script os) "Return the boot script for OS---i.e., the code started by the initrd once -we're running in the final root. When CONTAINER? is true, skip all -hardware-related operations as necessary when booting a Linux container." - (let* ((services (operating-system-services os #:container? container?)) +we're running in the final root." + (let* ((services (operating-system-services os)) (boot (fold-services services #:target-type boot-service-type))) (service-value boot))) @@ -839,17 +832,17 @@ hardware-related operations as necessary when booting a Linux container." #:target-type shepherd-root-service-type)))) -(define* (operating-system-derivation os #:key container?) +(define* (operating-system-derivation os) "Return a derivation that builds OS." - (let* ((services (operating-system-services os #:container? container?)) + (let* ((services (operating-system-services os)) (system (fold-services services))) ;; SYSTEM contains the derivation as a monadic value. (service-value system))) -(define* (operating-system-profile os #:key container?) +(define* (operating-system-profile os) "Return a derivation that builds the system profile of OS." (mlet* %store-monad - ((services -> (operating-system-services os #:container? container?)) + ((services -> (operating-system-services os)) (profile (fold-services services #:target-type profile-service-type))) (match profile diff --git a/gnu/system/linux-container.scm b/gnu/system/linux-container.scm index 3fe3482d7f..37a053cdc3 100644 --- a/gnu/system/linux-container.scm +++ b/gnu/system/linux-container.scm @@ -29,12 +29,31 @@ #:use-module (gnu build linux-container) #:use-module (gnu services) #:use-module (gnu services base) + #:use-module (gnu services shepherd) #:use-module (gnu system) #:use-module (gnu system file-systems) #:export (system-container containerized-operating-system container-script)) +(define (container-essential-services os) + "Return a list of essential services corresponding to OS, a +non-containerized OS. This procedure essentially strips essential services +from OS that are needed on the bare metal and not in a container." + (define base + (remove (lambda (service) + (memq (service-kind service) + (list (service-kind %linux-bare-metal-service) + firmware-service-type + system-service-type))) + (operating-system-essential-services os))) + + (cons (service system-service-type + (let ((locale (operating-system-locale-directory os))) + (with-monad %store-monad + (return `(("locale" ,locale)))))) + (append base (list %containerized-shepherd-service)))) + (define (containerized-operating-system os mappings) "Return an operating system based on OS for use in a Linux container environment. MAPPINGS is a list of to realize in the @@ -62,8 +81,10 @@ containerized OS." mingetty-service-type agetty-service-type)) - (operating-system (inherit os) + (operating-system + (inherit os) (swap-devices '()) ; disable swap + (essential-services (container-essential-services os)) (services (remove (lambda (service) (memq (service-kind service) useless-services)) @@ -81,30 +102,26 @@ that will be shared with the host system." (operating-system-file-systems os))) (specs (map file-system->spec file-systems))) - (mlet* %store-monad ((os-drv (operating-system-derivation - os - #:container? #t))) + (define script + (with-imported-modules (source-module-closure + '((guix build utils) + (gnu build linux-container))) + #~(begin + (use-modules (gnu build linux-container) + (gnu system file-systems) ;spec->file-system + (guix build utils)) - (define script - (with-imported-modules (source-module-closure - '((guix build utils) - (gnu build linux-container))) - #~(begin - (use-modules (gnu build linux-container) - (gnu system file-systems) ;spec->file-system - (guix build utils)) + (call-with-container (map spec->file-system '#$specs) + (lambda () + (setenv "HOME" "/root") + (setenv "TMPDIR" "/tmp") + (setenv "GUIX_NEW_SYSTEM" #$os) + (for-each mkdir-p '("/run" "/bin" "/etc" "/home" "/var")) + (primitive-load (string-append #$os "/boot"))) + ;; A range of 65536 uid/gids is used to cover 16 bits worth of + ;; users and groups, which is sufficient for most cases. + ;; + ;; See: http://www.freedesktop.org/software/systemd/man/systemd-nspawn.html#--private-users= + #:host-uids 65536)))) - (call-with-container (map spec->file-system '#$specs) - (lambda () - (setenv "HOME" "/root") - (setenv "TMPDIR" "/tmp") - (setenv "GUIX_NEW_SYSTEM" #$os-drv) - (for-each mkdir-p '("/run" "/bin" "/etc" "/home" "/var")) - (primitive-load (string-append #$os-drv "/boot"))) - ;; A range of 65536 uid/gids is used to cover 16 bits worth of - ;; users and groups, which is sufficient for most cases. - ;; - ;; See: http://www.freedesktop.org/software/systemd/man/systemd-nspawn.html#--private-users= - #:host-uids 65536)))) - - (gexp->script "run-container" script)))) + (gexp->script "run-container" script))) diff --git a/gnu/system/vm.scm b/gnu/system/vm.scm index b671c74ab8..95fd97a8b8 100644 --- a/gnu/system/vm.scm +++ b/gnu/system/vm.scm @@ -58,6 +58,7 @@ #:use-module (gnu bootloader grub) #:use-module (gnu system shadow) #:use-module (gnu system pam) + #:use-module (gnu system linux-container) #:use-module (gnu system linux-initrd) #:use-module (gnu bootloader) #:use-module (gnu system file-systems) @@ -473,9 +474,9 @@ should set REGISTER-CLOSURES? to #f." (local-file (search-path %load-path "guix/store/schema.sql")))) - (mlet %store-monad ((os-drv (operating-system-derivation os #:container? #t)) - (name -> (string-append name ".tar.gz")) - (graph -> "system-graph")) + (let ((os (containerized-operating-system os '())) + (name (string-append name ".tar.gz")) + (graph "system-graph")) (define build (with-extensions (cons guile-json ;for (guix docker) gcrypt-sqlite3&co) ;for (guix store database) @@ -505,7 +506,7 @@ should set REGISTER-CLOSURES? to #f." (initialize (root-partition-initializer #:closures '(#$graph) #:register-closures? #$register-closures? - #:system-directory #$os-drv + #:system-directory #$os ;; De-duplication would fail due to ;; cross-device link errors, so don't do it. #:deduplicate? #f)) @@ -523,7 +524,7 @@ should set REGISTER-CLOSURES? to #f." (call-with-input-file (string-append "/xchg/" #$graph) read-reference-graph))) - #$os-drv + #$os #:compressor '(#+(file-append gzip "/bin/gzip") "-9n") #:creation-time (make-time time-utc 0 1) #:transformations `((,root-directory -> "")))))))) @@ -531,7 +532,7 @@ should set REGISTER-CLOSURES? to #f." name build #:make-disk-image? #f #:single-file-output? #t - #:references-graphs `((,graph ,os-drv))))) + #:references-graphs `((,graph ,os))))) ;;; -- 2.21.0 From unknown Sun Aug 10 07:34:23 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#34948] [PATCH 1/3] records: Allow thunked fields to refer to 'this-record'. Resent-From: Ricardo Wurmus Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 22 Mar 2019 21:54:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 34948 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Ludovic =?UTF-8?Q?Court=C3=A8s?= Cc: 34948@debbugs.gnu.org Received: via spool by 34948-submit@debbugs.gnu.org id=B34948.15532916405996 (code B ref 34948); Fri, 22 Mar 2019 21:54:01 +0000 Received: (at 34948) by debbugs.gnu.org; 22 Mar 2019 21:54:00 +0000 Received: from localhost ([127.0.0.1]:54802 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1h7S6y-0001Yd-3T for submit@debbugs.gnu.org; Fri, 22 Mar 2019 17:54:00 -0400 Received: from sender-of-o51.zoho.com ([135.84.80.216]:21066) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1h7S6x-0001YW-0J for 34948@debbugs.gnu.org; Fri, 22 Mar 2019 17:53:59 -0400 ARC-Seal: i=1; a=rsa-sha256; t=1553291591; cv=none; d=zoho.com; s=zohoarc; b=NeQPJWtQLiHPOnaMRwIasEwf/dMMRpIPnfbqC68CgWn713/YCNUPaKImW1/h7tgobyUJL9OpISZXnyU9Y/lUXp9/PHyf2M3fT/xgAB8V7vhjBUlaHWkrrCjL4oMAEbSTNVgugR45BjIMVIbyKlfsdv1VdITmMinYMmH+5HCTB4A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1553291591; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To:ARC-Authentication-Results; bh=xVjH4w9KAqoocsGfSJxuBAckNWYdEKlKrMCxHaYse0k=; b=GzlhqHZ/THA5Sf2aP29NY2netCbcIIsU8K6wsSA0axtKbhLV+iXHiPhl6apJgOmZY1oxaP8L9E9eETm6l5PIPR+CgTqd/04RGlZn6t2KP7h/ahp4LrD6P7AsLbzw/A0wxYG/QrNssHGDn5pDfnvwtY+QNxO9PKPqOjHBA7oKkxg= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass header.i=elephly.net; spf=pass smtp.mailfrom=rekado@elephly.net; dmarc=pass header.from= header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1553291591; s=zoho; d=elephly.net; i=rekado@elephly.net; h=References:From:To:Cc:Subject:In-reply-to:Date:Message-ID:MIME-Version:Content-Type:Content-Transfer-Encoding; l=1167; bh=xVjH4w9KAqoocsGfSJxuBAckNWYdEKlKrMCxHaYse0k=; b=Bq2bL2sUmXVWhDESz/3iBFtwv2EU+a9pWFlN1EIF3VZgLfADCVImtr2hWVrVf20F 1zkE6GnCMJdSDiIsF2t/lfAhwZ0HIJKvSRf97huViFKkwx98UGn0IG+bBzVLqzTAGcO PRiyxxTdADQzKKrD3uMUwb9Droy/WIq8uPEtwYRs= Received: from localhost (p54AD4E35.dip0.t-ipconnect.de [84.173.78.53]) by mx.zohomail.com with SMTPS id 1553291590770580.2386386016267; Fri, 22 Mar 2019 14:53:10 -0700 (PDT) References: <20190322172120.10974-1-ludo@gnu.org> <20190322172719.11199-1-ludo@gnu.org> User-agent: mu4e 1.0; emacs 26.1 From: Ricardo Wurmus In-reply-to: <20190322172719.11199-1-ludo@gnu.org> X-URL: https://elephly.net X-PGP-Key: https://elephly.net/rekado.pubkey X-PGP-Fingerprint: BCA6 89B6 3655 3801 C3C6 2150 197A 5888 235F ACAC Date: Fri, 22 Mar 2019 22:53:07 +0100 Message-ID: <87y35660fw.fsf@elephly.net> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-ZohoMailClient: External X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Ludovic Court=C3=A8s writes: > * guix/records.scm (this-record): New syntax parameter. > (make-syntactic-constructor)[wrap-field-value]: When F is thunked, > return a one-argument lambda instead of a thunk, and parameterize > THIS-RECORD. So the value of the thunked field is no longer strictly a thunk? I=E2=80=99m having difficulties understanding how this works. Why does the =E2=80=9Cthunked field=E2=80=9D now require an argument (=E2=80=9Cx=E2=80= =9D)? We use the syntax parameter =E2=80=9Cthis-record=E2=80=9D to introduce a ne= w binding with this name in the context of the =E2=80=9Cvalue=E2=80=9D of the field. = The parameter value is =E2=80=A6 hard to make out. How does the syntax-case ma= cro in the following syntax-parameterize expression evaluate to the record itself? Would #,x not be sufficient to refer to the argument of the field accessor? > (define (wrap-field-value f value) > (cond ((thunked-field? f) > - #`(lambda () #,value)) > + #`(lambda (x) > + (syntax-parameterize ((this-record > + (lambda (s) > + (syntax-case s () > + (id > + (identifier? #'id) > + #'x))))) -- Ricardo From unknown Sun Aug 10 07:34:23 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#34948] [PATCH 1/3] records: Allow thunked fields to refer to 'this-record'. Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 23 Mar 2019 15:19:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 34948 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Ricardo Wurmus Cc: 34948@debbugs.gnu.org Received: via spool by 34948-submit@debbugs.gnu.org id=B34948.155335430924112 (code B ref 34948); Sat, 23 Mar 2019 15:19:02 +0000 Received: (at 34948) by debbugs.gnu.org; 23 Mar 2019 15:18:29 +0000 Received: from localhost ([127.0.0.1]:55671 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1h7iPj-0006Gp-VM for submit@debbugs.gnu.org; Sat, 23 Mar 2019 11:18:28 -0400 Received: from eggs.gnu.org ([209.51.188.92]:57756) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1h7iPh-0006GZ-8V for 34948@debbugs.gnu.org; Sat, 23 Mar 2019 11:18:26 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:35224) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h7iPZ-000644-Sa; Sat, 23 Mar 2019 11:18:18 -0400 Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=55950 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1h7iPV-00030Q-TG; Sat, 23 Mar 2019 11:18:15 -0400 From: Ludovic =?UTF-8?Q?Court=C3=A8s?= References: <20190322172120.10974-1-ludo@gnu.org> <20190322172719.11199-1-ludo@gnu.org> <87y35660fw.fsf@elephly.net> X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: 3 Germinal an 227 de la =?UTF-8?Q?R=C3=A9volution?= X-PGP-Key-ID: 0x090B11993D9AEBB5 X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 3CE4 6455 8A84 FDC6 9DB4 0CFB 090B 1199 3D9A EBB5 X-OS: x86_64-pc-linux-gnu Date: Sat, 23 Mar 2019 16:18:11 +0100 In-Reply-To: <87y35660fw.fsf@elephly.net> (Ricardo Wurmus's message of "Fri, 22 Mar 2019 22:53:07 +0100") Message-ID: <87imw9zkjw.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Hi! Ricardo Wurmus skribis: > Ludovic Court=C3=A8s writes: > >> * guix/records.scm (this-record): New syntax parameter. >> (make-syntactic-constructor)[wrap-field-value]: When F is thunked, >> return a one-argument lambda instead of a thunk, and parameterize >> THIS-RECORD. > > So the value of the thunked field is no longer strictly a thunk? Indeed, it=E2=80=99s now a one-argument procedure. It doesn=E2=80=99t matt= er much though because users never see this procedure. > I=E2=80=99m having difficulties understanding how this works. Why does t= he > =E2=80=9Cthunked field=E2=80=9D now require an argument (=E2=80=9Cx=E2=80= =9D)? This argument is the record itself, then bound to =E2=80=98this-record=E2= =80=99 in the lexical scope of the field. > We use the syntax parameter =E2=80=9Cthis-record=E2=80=9D to introduce a = new binding > with this name in the context of the =E2=80=9Cvalue=E2=80=9D of the field= . The > parameter value is =E2=80=A6 hard to make out. How does the syntax-case = macro > in the following syntax-parameterize expression evaluate to the record > itself? Would #,x not be sufficient to refer to the argument of the > field accessor? > >> (define (wrap-field-value f value) >> (cond ((thunked-field? f) >> - #`(lambda () #,value)) >> + #`(lambda (x) >> + (syntax-parameterize ((this-record >> + (lambda (s) >> + (syntax-case s () >> + (id >> + (identifier? #'id) >> + #'x))))) Here =E2=80=98x=E2=80=99 is the identifier of a variable that exists at run= time. So we cannot write #,x because we=E2=80=99d be referring to a variable =E2=80=98x= =E2=80=99 that exists at macro-expansion time, and there=E2=80=99s no such variable here. The =E2=80=98syntax-case=E2=80=99 here is just so that =E2=80=98this-record= =E2=80=99 matches only when used as an identifier, like this: (foo this-record) =E2=80=A6 and does not match when used like this: (this-record) or like that: (this-record x y z) We could just as well make it (identifier-syntax #'x) though that=E2=80=99s slightly less precise. A macro expansion is worth a thousand words :-), so: --8<---------------cut here---------------start------------->8--- scheme@(guix records)> (define-record-type* foo make-foo foo? (bar foo-bar (default 42)) (baz foo-baz (thunked))) scheme@(guix records)> ,optimize (foo-baz x) $11 =3D (let ((x x)) ((if (eq? (struct-vtable x) ) (struct-ref x 1) (throw 'wrong-type-arg '%foo-baz-real "Wrong type argument: ~S" (list x) (list x))) x)) scheme@(guix records)> ,optimize (foo (baz (+ 77 (foo-bar this-record)))) $12 =3D (begin (if (eq? #{% abi-cookie}# 2292347072401235576) (if #f #f) (throw 'record-abi-mismatch-error 'abi-check "~a: record ABI mismatch; recompilation needed" (list ) '())) (let ((s (allocate-struct 2))) (struct-set! s 0 42) (struct-set! s 1 (lambda (x) (+ 77 (if (eq? (struct-vtable x) ) (struct-ref x 0) (throw 'wrong-type-arg 'foo-bar "Wrong type argument: ~S" (list x) (list x)))))) s)) --8<---------------cut here---------------end--------------->8--- I hope this clarifies things! Ludo=E2=80=99. From unknown Sun Aug 10 07:34:23 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#34948] [PATCH 1/3] records: Allow thunked fields to refer to 'this-record'. Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 23 Mar 2019 16:06:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 34948 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Ricardo Wurmus Cc: 34948@debbugs.gnu.org Received: via spool by 34948-submit@debbugs.gnu.org id=B34948.155335712128468 (code B ref 34948); Sat, 23 Mar 2019 16:06:01 +0000 Received: (at 34948) by debbugs.gnu.org; 23 Mar 2019 16:05:21 +0000 Received: from localhost ([127.0.0.1]:55716 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1h7j97-0007P5-4f for submit@debbugs.gnu.org; Sat, 23 Mar 2019 12:05:21 -0400 Received: from eggs.gnu.org ([209.51.188.92]:36478) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1h7j95-0007Or-Li for 34948@debbugs.gnu.org; Sat, 23 Mar 2019 12:05:19 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:35571) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h7j90-0006fi-AI; Sat, 23 Mar 2019 12:05:14 -0400 Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=56272 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1h7j8z-0003xL-K0; Sat, 23 Mar 2019 12:05:14 -0400 From: Ludovic =?UTF-8?Q?Court=C3=A8s?= References: <20190322172120.10974-1-ludo@gnu.org> <20190322172719.11199-1-ludo@gnu.org> <87y35660fw.fsf@elephly.net> Date: Sat, 23 Mar 2019 17:05:10 +0100 In-Reply-To: <87y35660fw.fsf@elephly.net> (Ricardo Wurmus's message of "Fri, 22 Mar 2019 22:53:07 +0100") Message-ID: <87a7hlzidl.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Spam-Score: -0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) I should mention that there are other craaaazzy applications of this! For example, the =E2=80=98self-native-input?=E2=80=99 field of be= comes useless, because now you can write: (package ;; =E2=80=A6 (native-inputs ;; Add self as a native input when cross-compiling. `(,@(if (%current-target-system) `(("this" ,this-record)) '()) ;; =E2=80=A6 ))) I think there are other cases in package definitions where this can be useful, possibly things like the =E2=80=98make-lua-*=E2=80=99 procedures th= at we have. Ludo=E2=80=99. From unknown Sun Aug 10 07:34:23 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#34948] [PATCH 3/3] system: Add 'essential-services' field to . Resent-From: Arun Isaac Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 25 Mar 2019 20:43:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 34948 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Ludovic =?UTF-8?Q?Court=C3=A8s?= Cc: 34948@debbugs.gnu.org Received: via spool by 34948-submit@debbugs.gnu.org id=B34948.15535465595895 (code B ref 34948); Mon, 25 Mar 2019 20:43:02 +0000 Received: (at 34948) by debbugs.gnu.org; 25 Mar 2019 20:42:39 +0000 Received: from localhost ([127.0.0.1]:58723 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1h8WQZ-0001X1-8C for submit@debbugs.gnu.org; Mon, 25 Mar 2019 16:42:39 -0400 Received: from mugam.systemreboot.net ([139.59.75.54]:60392) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1h8WQW-0001Ws-Ef for 34948@debbugs.gnu.org; Mon, 25 Mar 2019 16:42:37 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=systemreboot.net; s=default; h=Content-Type:MIME-Version:Message-ID:Date: References:In-Reply-To:Subject:Cc:To:From:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=f/qEzBW2YuNnvs3t6oJX+3/5CfheOwDmZn279+LH8fQ=; b=hTaTUapkqg71FDo6RIdKEuwoI CuBBk+i3iYGaIu6DQXpGljWBtU15CEycnNqHvi1L8li9KZWbL2LyTKY4fCcY7D6cxB1Q5X4Qpfqar eCv+pMT/d7z1KIUQoOGVmmWyFb+VY6qRnUOyD9h2sY6EZX3TREJ7YD0muYUKDRxK3Jd9Q=; Received: from [49.206.10.180] (helo=steel) by systemreboot.net with esmtpsa (TLSv1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1h8WQU-0002ZQ-Ow; Tue, 26 Mar 2019 02:12:34 +0530 From: Arun Isaac In-Reply-To: <20190322172719.11199-3-ludo@gnu.org> References: <20190322172719.11199-1-ludo@gnu.org> <20190322172719.11199-3-ludo@gnu.org> Date: Tue, 26 Mar 2019 02:12:26 +0530 Message-ID: MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --=-=-= Content-Type: text/plain This neatly gets rid of all the #:container? arguments. That's very nice! :-) I haven't actually built and tested these patches, but these LGTM. Just one minor observation below. > + (cons (service system-service-type > + (let ((locale (operating-system-locale-directory os))) > + (with-monad %store-monad > + (return `(("locale" ,locale)))))) > + (append base (list %containerized-shepherd-service)))) Why not rewrite this using just a call to append, that is remove the call to cons? Like so: (append base (list (service system-service-type (let ((locale (operating-system-locale-directory os))) (with-monad %store-monad (return `(("locale" ,locale)))))) %containerized-shepherd-service)) Or perhaps, this can be done with cons* also. --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAEBCAAdFiEEf3MDQ/Lwnzx3v3nTLiXui2GAK7MFAlyZPTMACgkQLiXui2GA K7NvDAf+N6f/lfZ3ioBRXchVbm1YkrOphVaSrSWchEbtNXFofdkwPsh/7dkx0u1C v8NFkx66iqSKb9ISUlpw7X4zr/O6VUPI7DBC+qSwsN67u8AmLdBa7n5JzMYRLjTD qnp6Cbc7hdAsdW6qHDET6VIpuOuHTZ88vzPrDg5ifi5jC2dwsLz0+z8/hc+opaPe Eq5rcy6nQy1WktWOWelTaMF37KDVdtYRtqiptOvErLRQdi2grQ5vjKUU3A7r6Nh1 UwF8NFU6xDuzge1UYsvUE9Fm0ti1DWb4XiekFQmIJRKzVERjVk6P4BkQp/Z3mGKp znlvMazMrsNDYY96Sd/ToXHnfblkKQ== =92YS -----END PGP SIGNATURE----- --=-=-=-- From unknown Sun Aug 10 07:34:23 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Ludovic =?UTF-8?Q?Court=C3=A8s?= Subject: bug#34948: closed (Re: [PATCH 3/3] system: Add 'essential-services' field to .) Message-ID: References: <874l7qv9q0.fsf@gnu.org> <20190322172120.10974-1-ludo@gnu.org> X-Gnu-PR-Message: they-closed 34948 X-Gnu-PR-Package: guix-patches X-Gnu-PR-Keywords: patch Reply-To: 34948@debbugs.gnu.org Date: Mon, 25 Mar 2019 23:03:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1553554982-18920-1" This is a multi-part message in MIME format... ------------=_1553554982-18920-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #34948: [PATCH 0/3] Turn 'essential-services' into an fi= eld which was filed against the guix-patches package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 34948@debbugs.gnu.org. --=20 34948: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D34948 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1553554982-18920-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 34948-done) by debbugs.gnu.org; 25 Mar 2019 23:02:42 +0000 Received: from localhost ([127.0.0.1]:58788 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1h8Yc6-0004uZ-9J for submit@debbugs.gnu.org; Mon, 25 Mar 2019 19:02:42 -0400 Received: from eggs.gnu.org ([209.51.188.92]:41729) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1h8Yc4-0004uL-TZ for 34948-done@debbugs.gnu.org; Mon, 25 Mar 2019 19:02:41 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:44286) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h8Yby-0007Y2-Q9; Mon, 25 Mar 2019 19:02:34 -0400 Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=55050 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1h8Yby-0003ZB-4l; Mon, 25 Mar 2019 19:02:34 -0400 From: =?utf-8?Q?Ludovic_Court=C3=A8s?= To: Arun Isaac Subject: Re: [PATCH 3/3] system: Add 'essential-services' field to . References: <20190322172719.11199-1-ludo@gnu.org> <20190322172719.11199-3-ludo@gnu.org> X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: 5 Germinal an 227 de la =?utf-8?Q?R=C3=A9volution?= X-PGP-Key-ID: 0x090B11993D9AEBB5 X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 3CE4 6455 8A84 FDC6 9DB4 0CFB 090B 1199 3D9A EBB5 X-OS: x86_64-pc-linux-gnu Date: Tue, 26 Mar 2019 00:02:31 +0100 In-Reply-To: (Arun Isaac's message of "Tue, 26 Mar 2019 02:12:26 +0530") Message-ID: <874l7qv9q0.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 34948-done Cc: 34948-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Hi Arun! Arun Isaac skribis: > This neatly gets rid of all the #:container? arguments. That's very > nice! :-) I haven't actually built and tested these patches, but these > LGTM. Just one minor observation below. > >> + (cons (service system-service-type >> + (let ((locale (operating-system-locale-directory os))) >> + (with-monad %store-monad >> + (return `(("locale" ,locale)))))) >> + (append base (list %containerized-shepherd-service)))) > > Why not rewrite this using just a call to append, that is remove the > call to cons? Like so: No, IIRC =E2=80=98system-service-type=E2=80=99 should be the first in the l= ist (?), but also I find it more pleasant to the eye than an unbalanced =E2=80=98append= =E2=80=99 call. :-) Thanks for your feedback, I=E2=80=99ve pushed it now: 69cae3d335 system: Add 'essential-services' field to . cf848cc0a1 accounts: Add default value for the 'home-directory' field of = . abd4d6b33d records: Allow thunked fields to refer to 'this-record'. I hope that=E2=80=99ll help address your container use case! Ludo=E2=80=99. ------------=_1553554982-18920-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 22 Mar 2019 17:21:40 +0000 Received: from localhost ([127.0.0.1]:54629 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1h7NrQ-0001Oh-9A for submit@debbugs.gnu.org; Fri, 22 Mar 2019 13:21:40 -0400 Received: from eggs.gnu.org ([209.51.188.92]:41319) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1h7NrL-0001OR-K7 for submit@debbugs.gnu.org; Fri, 22 Mar 2019 13:21:36 -0400 Received: from lists.gnu.org ([209.51.188.17]:44750) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1h7NrG-0000m1-Ex for submit@debbugs.gnu.org; Fri, 22 Mar 2019 13:21:30 -0400 Received: from eggs.gnu.org ([209.51.188.92]:55695) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h7NrF-0007cC-AT for guix-patches@gnu.org; Fri, 22 Mar 2019 13:21:30 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,BAYES_20, URIBL_BLOCKED autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([2001:470:142:3::e]:46834) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h7NrD-0000dl-Mj; Fri, 22 Mar 2019 13:21:27 -0400 Received: from [2001:660:6102:320:e120:2c8f:8909:cdfe] (port=49236 helo=gnu.org) by fencepost.gnu.org with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1h7NrD-0001C7-Ac; Fri, 22 Mar 2019 13:21:27 -0400 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= To: guix-patches@gnu.org Subject: [PATCH 0/3] Turn 'essential-services' into an field Date: Fri, 22 Mar 2019 18:21:20 +0100 Message-Id: <20190322172120.10974-1-ludo@gnu.org> X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: submit Cc: Arun Isaac , =?UTF-8?q?Ludovic=20Court=C3=A8s?= X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Hello Guix! This is the solution that Arun and I were discussing: https://issues.guix.info/issue/28128#17 This series adds support for “self-referential records”: from the definition of a thunked field, you can use ‘this-record’ to access the record that the field belongs to. It then uses that to turn ‘essential-services’ into a thunked field of rather than an inaccessible internal procedure. This allows us to remove all the #:container? flags from (gnu system) and instead of (gnu system linux-container) simply override ‘essential-services’ as needed. Thoughts? Thanks, Ludo’. Ludovic Courtès (3): records: Allow thunked fields to refer to 'this-record'. accounts: Add default value for the 'home-directory' field of . system: Add 'essential-services' field to . doc/guix.texi | 8 ++- gnu/system.scm | 71 +++++++++----------- gnu/system/accounts.scm | 7 +- gnu/system/examples/bare-bones.tmpl | 3 +- gnu/system/examples/beaglebone-black.tmpl | 3 +- gnu/system/examples/desktop.tmpl | 3 +- gnu/system/examples/docker-image.tmpl | 3 +- gnu/system/examples/lightweight-desktop.tmpl | 3 +- gnu/system/install.scm | 3 +- gnu/system/linux-container.scm | 69 ++++++++++++------- gnu/system/vm.scm | 13 ++-- gnu/tests.scm | 5 +- gnu/tests/install.scm | 14 ++-- guix/records.scm | 24 ++++++- tests/accounts.scm | 4 -- tests/records.scm | 40 +++++++++++ 16 files changed, 169 insertions(+), 104 deletions(-) -- 2.21.0 ------------=_1553554982-18920-1-- From unknown Sun Aug 10 07:34:23 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#34948] [PATCH 3/3] system: Add 'essential-services' field to . Resent-From: Arun Isaac Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Tue, 26 Mar 2019 06:59:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 34948 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Ludovic =?UTF-8?Q?Court=C3=A8s?= Cc: 34948-done@debbugs.gnu.org Received: via spool by 34948-done@debbugs.gnu.org id=D34948.15535834987488 (code D ref 34948); Tue, 26 Mar 2019 06:59:01 +0000 Received: (at 34948-done) by debbugs.gnu.org; 26 Mar 2019 06:58:18 +0000 Received: from localhost ([127.0.0.1]:58974 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1h8g2M-0001wh-BU for submit@debbugs.gnu.org; Tue, 26 Mar 2019 02:58:18 -0400 Received: from mugam.systemreboot.net ([139.59.75.54]:35496) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1h8g2I-0001wX-Tg for 34948-done@debbugs.gnu.org; Tue, 26 Mar 2019 02:58:17 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=systemreboot.net; s=default; h=Content-Type:MIME-Version:Message-ID:Date: References:In-Reply-To:Subject:Cc:To:From:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=OtRjTqQ4CdhKy3sYSI2CB8eW2/ho2YktGOalm74+yHE=; b=Pi2pXRaaVaSwdVmTNlugLp87Q hnsfZA1mNn1iiNve8H3JwXIuNi7EsXjm3XvMciLAJgudMufnXiEgAVsja8jRcycUkAF786PUmS/GM 3MVyc1ugfmwFp9ThIvfVgf4KtNHhKy6vuNcobnRvgizPF05tUKwrWQtRJFMnFq/Ie+r8Q=; Received: from [14.139.128.10] (helo=steel) by systemreboot.net with esmtpsa (TLSv1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1h8g2E-00034j-D1; Tue, 26 Mar 2019 12:28:10 +0530 From: Arun Isaac In-Reply-To: <874l7qv9q0.fsf@gnu.org> References: <20190322172719.11199-1-ludo@gnu.org> <20190322172719.11199-3-ludo@gnu.org> <874l7qv9q0.fsf@gnu.org> Date: Tue, 26 Mar 2019 12:28:01 +0530 Message-ID: MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable > Thanks for your feedback, I=E2=80=99ve pushed it now: > > 69cae3d335 system: Add 'essential-services' field to . > cf848cc0a1 accounts: Add default value for the 'home-directory' field o= f . > abd4d6b33d records: Allow thunked fields to refer to 'this-record'. Thank you! :-) > I hope that=E2=80=99ll help address your container use case! Yes, it should. I will work on it and send patches once I'm done. --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAEBCAAdFiEEf3MDQ/Lwnzx3v3nTLiXui2GAK7MFAlyZzXkACgkQLiXui2GA K7N9hgf/ZAV5y/hGbQS/aIAYaC58HJPWI+xD9TvGkhwG3hFxXP6tA36PTp593ry7 1/8DLzoOb4bpfar9vb6ktd2wgoo9FhT4RyMMgKQrYj3iXKSwJDub+48/X/TyBJAq 19J6k76ZtMMyIU7oBbRa4s5zfntQ+7DqU/S+Kg4mysR5evyZPNvsmWsPk/nCK4r7 vmMHgEgQw1s2jSJbhVT3OKlDMKRchCN7E9pQLNaQ6RmRQ/T/dKVREsXfRLLbFQ3M ChpjU8diVPt96Jve407sMOFlNm06hnIAqeMoZo0HC2ebS6sWuaxBeraKqsLPPQQj vX9PR53lNCQ05JVXy+x34M0LaS3xqQ== =4rpO -----END PGP SIGNATURE----- --=-=-=-- From unknown Sun Aug 10 07:34:23 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#34948] [PATCH 1/3] records: Allow thunked fields to refer to 'this-record'. Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 30 Mar 2019 10:39:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 34948 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Ricardo Wurmus Cc: 34948@debbugs.gnu.org Received: via spool by 34948-submit@debbugs.gnu.org id=B34948.155394228213636 (code B ref 34948); Sat, 30 Mar 2019 10:39:02 +0000 Received: (at 34948) by debbugs.gnu.org; 30 Mar 2019 10:38:02 +0000 Received: from localhost ([127.0.0.1]:36265 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hABNC-0003Xs-Hm for submit@debbugs.gnu.org; Sat, 30 Mar 2019 06:38:02 -0400 Received: from eggs.gnu.org ([209.51.188.92]:35998) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hABN9-0003XG-U6 for 34948@debbugs.gnu.org; Sat, 30 Mar 2019 06:38:00 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:37158) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hABN4-0003IU-5R; Sat, 30 Mar 2019 06:37:54 -0400 Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=57924 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1hABN0-0004RN-DU; Sat, 30 Mar 2019 06:37:53 -0400 From: Ludovic =?UTF-8?Q?Court=C3=A8s?= References: <20190322172120.10974-1-ludo@gnu.org> <20190322172719.11199-1-ludo@gnu.org> <87y35660fw.fsf@elephly.net> <87a7hlzidl.fsf@gnu.org> Date: Sat, 30 Mar 2019 11:37:48 +0100 In-Reply-To: <87a7hlzidl.fsf@gnu.org> ("Ludovic \=\?utf-8\?Q\?Court\=C3\=A8s\=22'\?\= \=\?utf-8\?Q\?s\?\= message of "Sat, 23 Mar 2019 17:05:10 +0100") Message-ID: <877ecg641v.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Hello! I=E2=80=99ve extended this a bit with these commits: d8bead6c5d system: Define 'this-operating-system'. adb6462c4c packages: Define 'this-package' and 'this-origin'. d2be7e3c4b records: Support custom 'this' identifiers. Now you can refer to =E2=80=98this-package=E2=80=99 and it will refer to th= e closest package in scope. The good thing is that you can refer to =E2=80=98this-package=E2=80=99 from within, say, an field, and it = will DTRT. That also means you could have things such as: (define-record-type* ;; =E2=80=A6 (file-name origin-file-name (thunked) (default (string-append (package-name this-package) "-source")))) =E2=80=A6 which is pretty fun when you think about it, since it allows you = to implicitly refer to the lexically surrounding package. That reminds me of Scala=E2=80=99s =E2=80=9Cimplicit parameters=E2=80=9D: https://docs.scala-lang.org/tour/implicit-parameters.html Ludo=E2=80=99. From unknown Sun Aug 10 07:34:23 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#34948] [PATCH 1/3] records: Allow thunked fields to refer to 'this-record'. Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 30 Mar 2019 14:22:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 34948 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Ricardo Wurmus Cc: 34948@debbugs.gnu.org Received: via spool by 34948-submit@debbugs.gnu.org id=B34948.155395567410576 (code B ref 34948); Sat, 30 Mar 2019 14:22:01 +0000 Received: (at 34948) by debbugs.gnu.org; 30 Mar 2019 14:21:14 +0000 Received: from localhost ([127.0.0.1]:37495 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hAErC-0002kW-AG for submit@debbugs.gnu.org; Sat, 30 Mar 2019 10:21:14 -0400 Received: from eggs.gnu.org ([209.51.188.92]:60313) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hAErA-0002kE-Bk for 34948@debbugs.gnu.org; Sat, 30 Mar 2019 10:21:12 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:40231) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hAEqq-0005b9-0B; Sat, 30 Mar 2019 10:20:55 -0400 Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=37084 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1hAEqc-0001ay-Qb; Sat, 30 Mar 2019 10:20:41 -0400 From: Ludovic =?UTF-8?Q?Court=C3=A8s?= References: <20190322172120.10974-1-ludo@gnu.org> <20190322172719.11199-1-ludo@gnu.org> <87y35660fw.fsf@elephly.net> <87a7hlzidl.fsf@gnu.org> Date: Sat, 30 Mar 2019 15:20:37 +0100 In-Reply-To: <87a7hlzidl.fsf@gnu.org> ("Ludovic \=\?utf-8\?Q\?Court\=C3\=A8s\=22'\?\= \=\?utf-8\?Q\?s\?\= message of "Sat, 23 Mar 2019 17:05:10 +0100") Message-ID: <878sww4f62.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Ludovic Court=C3=A8s skribis: > I should mention that there are other craaaazzy applications of this! > > For example, the =E2=80=98self-native-input?=E2=80=99 field of = becomes > useless, because now you can write: > > (package > ;; =E2=80=A6 > (native-inputs > ;; Add self as a native input when cross-compiling. > `(,@(if (%current-target-system) > `(("this" ,this-record)) > '()) > ;; =E2=80=A6 > ))) Done in a7646bc5e17a829d23519d0b199a576fb1edbd04! Ludo'.