GNU bug report logs

#27155 [PATCH 0/2] Support service extensions on the "final" service values

PackageSource(s)Maintainer(s)
guix-patches PTS Buildd Popcon
Full log

Message #5 received at submit@debbugs.gnu.org (full text, mbox, reply):

Received: (at submit) by debbugs.gnu.org; 30 May 2017 21:59:40 +0000
From debbugs-submit-bounces@debbugs.gnu.org Tue May 30 17:59:40 2017
Received: from localhost ([127.0.0.1]:45867 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces@debbugs.gnu.org>)
	id 1dFpAy-00021I-2I
	for submit@debbugs.gnu.org; Tue, 30 May 2017 17:59:40 -0400
Received: from eggs.gnu.org ([208.118.235.92]:47558)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <ludo@gnu.org>) id 1dFpAw-00020w-Pj
 for submit@debbugs.gnu.org; Tue, 30 May 2017 17:59:39 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <ludo@gnu.org>) id 1dFpAq-0008Jp-Jz
 for submit@debbugs.gnu.org; Tue, 30 May 2017 17:59:33 -0400
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,RP_MATCHES_RCVD
 autolearn=disabled version=3.3.2
Received: from lists.gnu.org ([2001:4830:134:3::11]:40615)
 by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32)
 (Exim 4.71) (envelope-from <ludo@gnu.org>) id 1dFpAq-0008Jh-Hx
 for submit@debbugs.gnu.org; Tue, 30 May 2017 17:59:32 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:38518)
 by lists.gnu.org with esmtp (Exim 4.71)
 (envelope-from <ludo@gnu.org>) id 1dFpAp-0001QN-1n
 for guix-patches@gnu.org; Tue, 30 May 2017 17:59:32 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <ludo@gnu.org>) id 1dFpAo-0008JD-5H
 for guix-patches@gnu.org; Tue, 30 May 2017 17:59:31 -0400
Received: from fencepost.gnu.org ([2001:4830:134:3::e]:56223)
 by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from <ludo@gnu.org>)
 id 1dFpAh-0008Hp-P6; Tue, 30 May 2017 17:59:23 -0400
Received: from reverse-83.fdn.fr ([80.67.176.83]:60352 helo=gnu.org)
 by fencepost.gnu.org with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA1:256)
 (Exim 4.82) (envelope-from <ludo@gnu.org>)
 id 1dFpAh-0006Nk-0e; Tue, 30 May 2017 17:59:23 -0400
From: Ludovic Courtès <ludo@gnu.org>
To: guix-patches@gnu.org
Subject: [PATCH 0/2] Support service extensions on the "final" service values
Date: Tue, 30 May 2017 23:58:50 +0200
Message-Id: <20170530215850.7522-1-ludo@gnu.org>
X-Mailer: git-send-email 2.13.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-Received-From: 2001:4830:134:3::11
X-Spam-Score: -5.0 (-----)
X-Debbugs-Envelope-To: submit
Cc: Alex Kost <alezost@gmail.com>,
 Ludovic Courtès <ludo@gnu.org>
X-BeenThere: debbugs-submit@debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request@debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit@debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request@debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request@debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces@debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces@debbugs.gnu.org>
X-Spam-Score: -5.0 (-----)
Hello!

This patch adds support for service extensions that modify the
"final" values of a service.  This is meant to implement cross-cutting
concerns as well as system-wide customization as discussed with Alex
long ago:

  https://lists.gnu.org/archive/html/guix-devel/2015-11/msg00623.html
  https://lists.gnu.org/archive/html/guix-devel/2016-09/msg01505.html

To summarize, a "finalization extension" (for lack of a better name)
gets the final value of a service and returns a new value for that
service.  This is in contrast with a "normal" extension which can only
contribute to the value of a target service, and not inspect the value
of that target service.

For example, for the /etc service, a "normal" extension can only add
entries for /etc.  A "finalization" extension can instead inspect and
change all the /etc entries.  IOW, it is a sort of a "sudo" for service
extensions; it's also quite inelegant compared to the "normal" extension
mechanism, but it's certainly useful.

A use case is given in the second patch: we change all the PAM services
to use pam_elogind.so or pam_limits.so.  Likewise, the 'rename-etc-files'
service below shows how to rename all the files in /etc (for illustration
purposes only :-)):

  (define rename-etc-files
    (let ((rename (lambda (prefix entries)
		    (map (match-lambda
			   ((name . rest)
			    (cons (string-append prefix name)
				  rest)))
			 entries))))
      (service-type
       (name 'rename-etc-files)
       (extensions (list (service-extension etc-service-type
					    (const '())
					    rename))))))


  (operating-system
    ;; ...
    (services (cons* (service rename-etc-files "foo-")
                     ...)))

I think this should fulfill the need that Alex had expressed, which is
to not only be able to add files to /etc, but also to have the ability
to inspect and modify what goes to /etc.

The first patch currently lacks doc.  I'll work on it if there's consensus
on the approach.

Feedback welcome!

Ludo'.

Ludovic Courtès (2):
  DRAFT services: Extensions can specify a "finalization" procedure.
  system: pam: Remove custom API to transform PAM services.

 gnu/services.scm         | 52 ++++++++++++++++++++++++++++++++++++++----------
 gnu/services/base.scm    | 33 ++++++++++++++++--------------
 gnu/services/desktop.scm | 23 +++++++++++----------
 gnu/system/pam.scm       | 44 ++++++++--------------------------------
 tests/services.scm       | 34 +++++++++++++++++++++++++++++++
 5 files changed, 114 insertions(+), 72 deletions(-)

-- 
2.13.0





Send a report that this bug log contains spam.


debbugs.gnu.org maintainers <help-debbugs@gnu.org>. Last modified: Tue Sep 9 07:53:03 2025; Machine Name: wallace-server

GNU bug tracking system

Debbugs is free software and licensed under the terms of the GNU Public License version 2. The current version can be obtained from https://bugs.debian.org/debbugs-source/.

Copyright © 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson, 2005-2017 Don Armstrong, and many other contributors.