From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id 2spmIVAo42AquAAAgWs5BA (envelope-from ) for ; Mon, 05 Jul 2021 17:42:08 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id IPgMHFAo42B/DgAAbx9fmQ (envelope-from ) for ; Mon, 05 Jul 2021 15:42:08 +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 375D812688 for ; Mon, 5 Jul 2021 17:42:08 +0200 (CEST) Received: from localhost ([::1]:43494 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m0QjX-00049o-91 for larch@yhetil.org; Mon, 05 Jul 2021 11:42:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58878) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m0QjS-00048A-Oo for guix-patches@gnu.org; Mon, 05 Jul 2021 11:42:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:34969) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1m0QjS-0000F5-HA for guix-patches@gnu.org; Mon, 05 Jul 2021 11:42:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1m0QjS-0006mM-Fi for guix-patches@gnu.org; Mon, 05 Jul 2021 11:42:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#49419] [PATCH 4/4] home-services: Add fold-home-service-types function References: <87y2akhiz1.fsf@trop.in> In-Reply-To: <87y2akhiz1.fsf@trop.in> Resent-From: Andrew Tropin Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 05 Jul 2021 15:42:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 49419 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 49419@debbugs.gnu.org Received: via spool by 49419-submit@debbugs.gnu.org id=B49419.162549971626039 (code B ref 49419); Mon, 05 Jul 2021 15:42:02 +0000 Received: (at 49419) by debbugs.gnu.org; 5 Jul 2021 15:41:56 +0000 Received: from localhost ([127.0.0.1]:46514 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1m0QjM-0006lt-8r for submit@debbugs.gnu.org; Mon, 05 Jul 2021 11:41:56 -0400 Received: from mail-lf1-f48.google.com ([209.85.167.48]:40555) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1m0QjK-0006lb-5y for 49419@debbugs.gnu.org; Mon, 05 Jul 2021 11:41:54 -0400 Received: by mail-lf1-f48.google.com with SMTP id q18so33137168lfc.7 for <49419@debbugs.gnu.org>; Mon, 05 Jul 2021 08:41:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=trop-in.20150623.gappssmtp.com; s=20150623; h=from:to:subject:date:message-id:mime-version; bh=OTM/NfLS28K1HZuhTzrT9b9se42Y6/V4cVqAWD8LQag=; b=O4R7fUQHRH48IOHQfxpGOLIqoYae1jf+xaAxDm+m2femv/zRGVOjZXAtzs4285Fw2g 1x9d15Lrvzhg5VFBNt9QawrjQFCudu+aXwqRtPduTbx/QbBrok4c94ZoSG81NtuuaL9o yfnlVf82dg5TZXrrvZ5FP+NI5UlF2iMfo89c/4LeOpt3beSt4qcLLQ/7o8h8DCgTdFAx AP/xcia4XfcwKBRDJjYvWY+B1+BfxfrkUwWblWMI7aE9Ht7DTRV6sA1t1o6NkaVB8DJO 3uC8sGZwW7jTrIZOgzkRSMJLjvzy/G29lxtaIIEIqObAqTN3YzZqViJYlrn5tn0UqOX8 E7vw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:mime-version; bh=OTM/NfLS28K1HZuhTzrT9b9se42Y6/V4cVqAWD8LQag=; b=XhE9/a/7SwDcQtEhwspZCJh+lvRo5tZVXP/NnHvOUFH/g/anY4E5Y6ZF1LKeNEasdf kPgI3JY5n9bwi3fgGxJ/Y/1Y7EfxABizegTtwbUsz2uJ3UUPnh5zq51tce+9ysjtrMAR Gu09+iwC2whGdJpO6xRfUTF+cr2CiEVPAi4Ijf1mKMvTDeMdmg8b3F5OBsF0ntkQ/VyF aE73+D4GqA1qP113J9+J0HXiQA1uuLr7Hi/85EgG6Q4rijEO2TnnqOsOGXjVfR2YIqUZ 53on0EY4KUzu2rDF7gYAT1ciYKcNwdEiaTPe2lRHPAGSMgU7tOwuotIeXxPIN8lYk6ew e44g== X-Gm-Message-State: AOAM530/XgxIJ56tFECe+bIi1J58G0wtV2eOHnyZ9DJnlRZeANQ4aN44 JEiV/s6vZp8Q/jyWJ8UGHReyn/DxpFVfBQ== X-Google-Smtp-Source: ABdhPJyIIaYNAprn7ubbkL4iqg8fbImP7kG5ix0KgDcFbESGTfxh63+ugv9OKBRPBlXvE3Q8xxECNA== X-Received: by 2002:a19:f807:: with SMTP id a7mr11243949lff.149.1625499708129; Mon, 05 Jul 2021 08:41:48 -0700 (PDT) Received: from ixy ([109.252.117.164]) by smtp.gmail.com with ESMTPSA id y1sm1293242ljc.29.2021.07.05.08.41.47 for <49419@debbugs.gnu.org> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Jul 2021 08:41:47 -0700 (PDT) From: Andrew Tropin Date: Mon, 05 Jul 2021 18:41:45 +0300 Message-ID: <87pmvwhio6.fsf@trop.in> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" 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" X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1625499728; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type:resent-cc:resent-from:resent-sender: resent-message-id:in-reply-to:in-reply-to:references:references: list-id:list-help:list-unsubscribe:list-subscribe:list-post: dkim-signature; bh=Ne51LJD3rQAeqKEkHANPv+u9CqkkNJMDWvFD+6PichE=; b=WxMsCNjbV8WRLES+O//ctqUhnINPVVf3Aoe9KVIYRJGEDCYdcnhQVT+1D36azY5JlqyyKW 84jSF8+PcGTf9A0Pm2FfElXpFb9g8eI331oNMwlz1Ihr54ZB++DLQ2gNhwISMvyaNEdTIJ FzJXeVJJqZ7mMWMg31dB1YYXhwqMmJhF8XHpT3qiPWVGRwtBzspexKbIkNQZWBUD/frvFQ PARbjVl24IBLRCcAmzy5sR+qcD7CPoezbSjWwR4toJ9ubjWF+YwVyoTrF8PP5UHt8RP1IT WVx4lFwwRa+fu6FAkkXtpOzUo5eb6G2vsXo+bugQYDktbOnNdq40HCqB7LkzBw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1625499728; a=rsa-sha256; cv=none; b=ndOYC0zWsz0LhG4WRr9JYnyfcBMfv9saq2cDrk6nh4xYPyRU5myO5lMkjAwIiKYliVRmUG 6nVLFSDYvp6DGJXYW+1VO5WA2Yw2O66Eu4XRtlv/09zzCKawlTVJHaFMfLoF4xtpyYLqIK she9dbY4suAqKr2jJpNNr2H75wEboSow0OMgPoHoUg197Xb2aLl65l3xpffEKNGRPKtYlR +29tWtUARJcrX5sGbKVS4B3Uaxh3W/okbtAyy8dwESoUPAbD+WCBtP7q+PDHj4TyvHbcrv JsPB5ZxV6qshnBuykdAEy/uLAgjOIeIsDESPz1uWaUixjLiIY7y4cKLDOmtxNg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("body hash did not verify") header.d=trop-in.20150623.gappssmtp.com header.s=20150623 header.b=O4R7fUQH; dmarc=none; 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-Spam-Score: -1.01 Authentication-Results: aspmx1.migadu.com; dkim=fail ("body hash did not verify") header.d=trop-in.20150623.gappssmtp.com header.s=20150623 header.b=O4R7fUQH; dmarc=none; 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: 375D812688 X-Spam-Score: -1.01 X-Migadu-Scanner: scn1.migadu.com X-TUID: uK67IgnhFJOm --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable * gnu/home-services.scm (parent-directory, %guix-home-root-directory, %service-type-path, all-home-service-modules, fold-home-service-types): New variables. =2D-- gnu/home-services.scm | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/gnu/home-services.scm b/gnu/home-services.scm index 20a9537650..a06cd72459 100644 =2D-- a/gnu/home-services.scm +++ b/gnu/home-services.scm @@ -444,3 +444,29 @@ environment, and its configuration file, when availabl= e."))) =20 (define sexp->home-provenance sexp->system-provenance) (define home-provenance system-provenance) + + +;;; +;;; Searching +;;; + +(define (parent-directory directory) + "Get the parent directory of DIRECTORY" + (string-join (drop-right (string-split directory #\/) 1) "/")) + +(define %guix-home-root-directory + ;; Absolute file name of the module hierarchy. + (parent-directory (dirname (search-path %load-path "gnu/home-services.sc= m")))) + +(define %service-type-path + ;; Search path for service types. + (make-parameter `((,%guix-home-root-directory . "gnu/home-services")))) + +(define (all-home-service-modules) + "Return the default set of home-service modules." + (cons (resolve-interface '(gnu home-services)) + (all-modules (%service-type-path) + #:warn warn-about-load-error))) + +(define* (fold-home-service-types proc seed) + (fold-service-types proc seed (all-home-service-modules))) =2D-=20 2.32.0 --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQJDBAEBCgAtFiEEKEGaxlA4dEDH6S/6IgjSCVjB3rAFAmDjKDkPHGFuZHJld0B0 cm9wLmluAAoJECII0glYwd6wnIgP/isEncoPbwrs77ZNLilDgzqLXZzFPMsZembM kHKhSufjTTuDdvutWFZJGXPDjoGchJCp2/jIlQmQ2qRrZ2CfhLvUVnAnHQbt1oSI wh8XecyKY2ML4QjV1J9jkXH4XcLKkrAlqkbVeXNXcrtJFTZdPlbcUdsaR0PKJ5xC O2cb2+qcMGf6wof3tJjxkKzqS3wVEwOKRWHad5dik/F3FdYM6UcsRxNr9Qhcb8yM oqS3ccjAznkH+NZehl4JqeIUqVewlhQYb8gn8zTEA1paFLBfZxYFALjDxKhdB5MR kekSlIPRkDJavuQKNogL9Rui9N2dOiwuxWXCiPLdql8/mYTEazTFMm4Cm/1Kw6zt 4BouLKAVfRJpO5/bK6Z/eaKxRgf/fTsXQu+UM7G242ahR8oflAve9Txuno/TtDDJ tU0ZzHoY2jPfV8MCV8D8xGKudbjHSzunHlMfvUoLTiF4WLzhuEuX7eKgo0yP3IuZ T64LgwHzaKkDStMgYyomxVEJhSL4WWYZxYyFaftVGMj8RFhzvKlUySXZFF5tkLgw pxB2xgT50qaP+PMXePOorSyIgS6+IQveV+auRjbfCpaCjEriWnJk+4hYRHLyRPQr zTY9BrY5JV86PCn6YbAKqZaiFImM5CGZJFAx/7AQaheo5laeiv+Lt/n4dwv/lV9f ogLILU0w =L4cH -----END PGP SIGNATURE----- --=-=-=--