From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id GM16E5zd9V+RKwAA0tVLHw (envelope-from ) for ; Wed, 06 Jan 2021 15:56:12 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id uPxjD5zd9V8GIwAA1q6Kng (envelope-from ) for ; Wed, 06 Jan 2021 15:56:12 +0000 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 EF3E69402D4 for ; Wed, 6 Jan 2021 15:56:11 +0000 (UTC) Received: from localhost ([::1]:41286 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kxBAQ-0001eS-T7 for larch@yhetil.org; Wed, 06 Jan 2021 10:56:10 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:43858) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kxBAJ-0001eE-5u for guix-patches@gnu.org; Wed, 06 Jan 2021 10:56:03 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:33762) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kxBAI-0006PZ-VL for guix-patches@gnu.org; Wed, 06 Jan 2021 10:56:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kxBAI-00023r-Ux for guix-patches@gnu.org; Wed, 06 Jan 2021 10:56:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#45692] [PATCH 2/4] gnu: Make file-systems target extensible by services. References: In-Reply-To: Resent-From: raid5atemyhomework Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Wed, 06 Jan 2021 15:56:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 45692 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: "45692@debbugs.gnu.org" <45692@debbugs.gnu.org> Received: via spool by 45692-submit@debbugs.gnu.org id=B45692.16099485487882 (code B ref 45692); Wed, 06 Jan 2021 15:56:02 +0000 Received: (at 45692) by debbugs.gnu.org; 6 Jan 2021 15:55:48 +0000 Received: from localhost ([127.0.0.1]:45306 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kxBA4-000234-BS for submit@debbugs.gnu.org; Wed, 06 Jan 2021 10:55:48 -0500 Received: from mail-40137.protonmail.ch ([185.70.40.137]:29246) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kxBA2-00022q-FJ for 45692@debbugs.gnu.org; Wed, 06 Jan 2021 10:55:47 -0500 Date: Wed, 06 Jan 2021 15:55:36 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com; s=protonmail; t=1609948539; bh=GxSEl8pf4rtfbeKWy5CBrnQ7sXo8U9yJRByUJ+I7Dec=; h=Date:To:From:Reply-To:Subject:From; b=PIZTFn5cFfG4etRzfdqsEMGYg1hZ50+zw2uSaY9vK+EmRdZdhy1oZXYAYQTbPFkPY HDuyliz8kirBEiqps0zct0niWFD6s0xaOq27xiRVdtNBk7EX5+f8GjPrYSe9vn8ksw jdQ7I/ugFr2x/7sMHl7OWd4wkmTTXWY6VXes8eJw= Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: "Guix-patches" Reply-to: raid5atemyhomework , raid5atemyhomework via Guix-patches From: raid5atemyhomework via Guix-patches via X-Migadu-Flow: FLOW_IN X-Migadu-Spam-Score: -2.84 Authentication-Results: aspmx1.migadu.com; dkim=fail (headers rsa verify failed) header.d=protonmail.com header.s=protonmail header.b=PIZTFn5c; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of guix-patches-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org X-Migadu-Queue-Id: EF3E69402D4 X-Spam-Score: -2.84 X-Migadu-Scanner: scn0.migadu.com X-TUID: GOHe6GidWYh2 >From 792a8f8efc95e4fe9a94d42f839ddcfb034b8540 Mon Sep 17 00:00:00 2001 From: raid5atemyhomework Date: Wed, 6 Jan 2021 08:15:54 +0800 Subject: [PATCH 2/4] gnu: Make file-systems target extensible by services. * gnu/services/base.scm (file-system-shepherd-services): Move file-systems shepherd service to ... (file-systems-target-shepherd-services): ... new procedure here. (file-systems-target-service-type): New variable. (file-system-service-type): Extend file-systems-target service to add each file-system as a requirement. * gnu/system.scm (operating-system-default-essential-services): Instantiate file-systems-target-service-type. (hurd-default-essential-services): Instantiate file-systems-target-service-= type. --- gnu/services/base.scm | 37 +++++++++++++++++++++++++++---------- gnu/system.scm | 2 ++ 2 files changed, 29 insertions(+), 10 deletions(-) diff --git a/gnu/services/base.scm b/gnu/services/base.scm index 945b546607..13cfb6a8a2 100644 --- a/gnu/services/base.scm +++ b/gnu/services/base.scm @@ -13,6 +13,7 @@ ;;; Copyright =C2=A9 2019 Jan (janneke) Nieuwenhuizen ;;; Copyright =C2=A9 2020 Florian Pelz ;;; Copyright =C2=A9 2020 Brice Waegeneire +;;; Copyright =C2=A9 2021 raid5atemyhomework ;;; ;;; This file is part of GNU Guix. ;;; @@ -67,6 +68,7 @@ #:export (fstab-service-type root-file-system-service file-system-service-type + file-systems-target-service-type swap-service host-name-service console-keymap-service @@ -362,18 +364,29 @@ FILE-SYSTEM." (gnu system file-systems) ,@%default-modules))))))) +(define (file-systems-target-shepherd-services requirements) + (list + (shepherd-service + (provision '(file-systems)) + (requirement (cons* 'root-file-system 'user-file-systems requirement= s)) + (documentation "Target for all the initially-mounted file systems") + (start #~(const #t)) + (stop #~(const #t))))) +(define file-systems-target-service-type + (service-type + (name 'file-systems) + (extensions (list (service-extension shepherd-root-service-type + file-systems-target-shepherd-serv= ices))) + (compose concatenate) + (extend append) + ;; Extensions can add new values to this list. + (default-value '()) + (description "The @code{file-systems} service is the target that is st= arted +when all file systems have been mounted."))) + (define (file-system-shepherd-services file-systems) "Return the list of Shepherd services for FILE-SYSTEMS." (let* ((file-systems (filter file-system-mount? file-systems))) - (define sink - (shepherd-service - (provision '(file-systems)) - (requirement (cons* 'root-file-system 'user-file-systems - (map file-system->shepherd-service-name - file-systems))) - (documentation "Target for all the initially-mounted file systems") - (start #~(const #t)) - (stop #~(const #f)))) (define known-mount-points (map file-system-mount-point file-systems)) @@ -403,7 +416,7 @@ FILE-SYSTEM." (filter (negate known?) (mount-points))) #f)))) - (cons* sink user-unmount + (cons* user-unmount (map file-system-shepherd-service file-systems)))) (define (file-system-fstab-entries file-systems) @@ -431,6 +444,10 @@ FILE-SYSTEM." (service-extension fstab-service-type file-system-fstab-entries) + ;; Have 'file-systems' depend on each declared file= system. + (service-extension file-systems-target-service-type + (cut map file-system->shepherd-s= ervice-name <>)) + ;; Have 'user-processes' depend on 'file-systems'. (service-extension user-processes-service-type (const '(file-systems))))) diff --git a/gnu/system.scm b/gnu/system.scm index 5c530f176e..6987641ee8 100644 --- a/gnu/system.scm +++ b/gnu/system.scm @@ -667,6 +667,7 @@ bookkeeping." (operating-system-setuid-programs os)) (service profile-service-type (operating-system-packages os)) + (service file-systems-target-service-type) other-fs (append mappings swaps @@ -691,6 +692,7 @@ bookkeeping." (operating-system-groups os)) (operating-system-skeletons os)) (root-file-system-service) + (service file-systems-target-service-type) (service file-system-service-type '()) (service fstab-service-type (filter file-system-needed-for-boot? -- 2.29.2