From patchwork Mon Oct 4 23:13:29 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oleg Pykhalov X-Patchwork-Id: 33606 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id A6C1527BBE3; Tue, 5 Oct 2021 00:15:21 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_MSPIKE_H2, SPF_HELO_PASS,T_DKIM_INVALID,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.2 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id C5FDD27BBE1 for ; Tue, 5 Oct 2021 00:15:20 +0100 (BST) Received: from localhost ([::1]:35706 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mXXB0-0005EE-5r for patchwork@mira.cbaines.net; Mon, 04 Oct 2021 19:15:19 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48666) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mXXAk-0005CY-O0 for guix-patches@gnu.org; Mon, 04 Oct 2021 19:15:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:55290) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mXXAk-0008Ni-GU for guix-patches@gnu.org; Mon, 04 Oct 2021 19:15:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mXXAk-0006eY-Bn for guix-patches@gnu.org; Mon, 04 Oct 2021 19:15:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#50967] [PATCH 1/3] gnu: Move (gnu home-services) to (gnu home services). Resent-From: Oleg Pykhalov Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 04 Oct 2021 23:15:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 50967 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: To: 50967@debbugs.gnu.org Cc: Oleg Pykhalov , Ludovic =?utf-8?q?Court=C3=A8s?= , Xinglu Chen , Andrew Tropin Received: via spool by 50967-submit@debbugs.gnu.org id=B50967.163338924925458 (code B ref 50967); Mon, 04 Oct 2021 23:15:02 +0000 Received: (at 50967) by debbugs.gnu.org; 4 Oct 2021 23:14:09 +0000 Received: from localhost ([127.0.0.1]:38595 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mXX9s-0006cQ-MH for submit@debbugs.gnu.org; Mon, 04 Oct 2021 19:14:09 -0400 Received: from mail-lf1-f41.google.com ([209.85.167.41]:41981) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mXX9j-0006bP-Lt for 50967@debbugs.gnu.org; Mon, 04 Oct 2021 19:14:03 -0400 Received: by mail-lf1-f41.google.com with SMTP id j5so73223483lfg.8 for <50967@debbugs.gnu.org>; Mon, 04 Oct 2021 16:13:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=O/BmaZH8GKCmbqbeqjoewwHkpoMs5jYBTbcJLJhjhhY=; b=OEPy4QzhaQH4mIVW0gMEAXAbk2pMhjB1v4yX+ukiXyk8doF15KtATsmwgAEC03xVxC tB0c4RGdzo5ISS2YRdiyKNNCzrR5nvL6X/nRpOlA/aD2wKM9jxLK1ii7Fr5UCkwpFHB2 E6SyqJcMw+szN72T6+lZTSRynQwjL7E+rRwOipvAWOon/oFmT29nABkxSXyIxOr+FCRp dtu/dbXHMrthX4ZpY4bZuf3lymWbUSgl7QQv/BoxJrVZYG8uUvE0OFhtU5nEUrZiYAZy UC/84LPXOqAzBZMzLKUBq/45zN0RtqxE3f/hFx2FxIvoU2V86Ef+ab3AVsDxOOJHcP+s WVgg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=O/BmaZH8GKCmbqbeqjoewwHkpoMs5jYBTbcJLJhjhhY=; b=BL0ZFYbQs5yDYujpv37OmoKaBTNW5nH1H2/toWO3RTfDOWVinz5MMJLDL7bhxLauoL Jmt6cYDIzoBvnGFKHaRJUx3qXK43gPVHG1rNtNT2E1LG9IYz91sW42R+eSW56REepNsB oqCA/e48xVstwRcYuSKFWDMwVrk5zwSgtt+yROvKO3a9D+2Tn1EUUPUZb5m9jPXcLAtl S0a6eUcZNAuD2Wt3D9vVlAP4tUHvh/MNOZr8R2C1y6SpkJEjiS8jxjKrwDKZXWTS3zZd QvAh0UMpTChhVPFQErAKIILTJWgyC3tltBRyHYcruGBafm1bfJHQtcIWe99g4BIjfVQp K2xQ== X-Gm-Message-State: AOAM530wZRb6pX9Uv3rI8Okk9ZsyOOn9sb91l1MlIq54BMOOiSl9Uq1A y/3gXCKMjuv8XZQpRk2QeeGt2b2cOjs= X-Google-Smtp-Source: ABdhPJyOb3i2py7wwdISHmBEWQs/RL3Wtb235ySsTA2Tz1Przz9PFjnbQWxF6FwAB6gxGr9L30krWw== X-Received: by 2002:a2e:9cd:: with SMTP id 196mr18806899ljj.434.1633389232972; Mon, 04 Oct 2021 16:13:52 -0700 (PDT) Received: from localhost.localdomain ([88.201.161.72]) by smtp.gmail.com with ESMTPSA id h4sm1736542lft.184.2021.10.04.16.13.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Oct 2021 16:13:52 -0700 (PDT) From: Oleg Pykhalov Date: Tue, 5 Oct 2021 02:13:29 +0300 Message-Id: <20211004231331.5269-1-go.wigust@gmail.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <87h7dwq4cb.fsf_-_@gnu.org> References: <87h7dwq4cb.fsf_-_@gnu.org> MIME-Version: 1.0 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+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches * gnu/home-services/configuration.scm: Move the content ... * gnu/home/services/configuration.scm: ... here. * gnu/local.mk (GNU_SYSTEM_MODULES): Same. * gnu/home-services/shells.scm: Replace (gnu home-services configuration) with (gnu home services configuration). * gnu/home-services/xdg.scm: Same. * gnu/home-services/symlink-manager.scm: Rename to gnu/home/services/symlink-manager.scm. * gnu/local.mk: Same. * gnu/home.scm: Replace (gnu home-services symlink-manager) with (gnu home services symlink-manager). * gnu/home-services/utils.scm: Rename to gnu/home/services/utils.scm. * gnu/local.mk: Same. * gnu/home-services/shells.scm: Replace (gnu home-services utils) with (gnu home services utils). * gnu/home-services/xdg.scm: Same. * gnu/home-services/fontutils.scm: Rename to gnu/services/fontutils.scm. * gnu/local.mk: Same. * gnu/home.scm: Replace (gnu home-services fontutils) with (gnu services fontutils). * gnu/home-services/shells.scm: Rename to gnu/home/services/shells.scm. * gnu/local.mk: Same. * gnu/home.scm: Replace (gnu home-services shells) with (gnu home services shells). * doc/he-config-bare-bones.scm: Same. * gnu/home-services/xdg.scm: Rename to gnu/home/services/xdg.scm. * gnu/local.mk: Same. * gnu/home.scm: Replace (gnu home-services xdg) with (gnu home services xdg). * gnu/home-services/shepherd.scm: Move to gnu/home/services/shepherd.scm. * gnu/local.mk: Same. * gnu/home-services/mcron.scm: Replace (gnu home-services shepherd) with (gnu home services shepherd). * tests/guix-home.sh: Same. * gnu/home-services/mcron.scm: Move to gnu/home/services/mcron.scm. * gnu/local.mk: Same. * doc/guix.texi: Replace (gnu home-services mcron) with (gnu home services mcron). * guix/scripts/home/import.scm: Replace (gnu home-services bash) with (gnu home services bash). * doc/guix.texi: Replace (gnu home-services) with (gnu home services). * gnu/home-services.scm (%service-type-path): Search home services in "gnu/services". * gnu/home-services.scm: Update documentation string. --- doc/guix.texi | 8 ++++---- doc/he-config-bare-bones.scm | 2 +- gnu/home-services.scm | 4 ++-- gnu/home.scm | 8 ++++---- .../services}/configuration.scm | 2 +- .../services}/fontutils.scm | 2 +- gnu/{home-services => home/services}/mcron.scm | 4 ++-- gnu/{home-services => home/services}/shells.scm | 6 +++--- .../services}/shepherd.scm | 2 +- .../services}/symlink-manager.scm | 2 +- gnu/{home-services => home/services}/utils.scm | 2 +- gnu/{home-services => home/services}/xdg.scm | 6 +++--- gnu/local.mk | 16 ++++++++-------- guix/scripts/home/import.scm | 2 +- 14 files changed, 33 insertions(+), 33 deletions(-) rename gnu/{home-services => home/services}/configuration.scm (98%) rename gnu/{home-services => home/services}/fontutils.scm (98%) rename gnu/{home-services => home/services}/mcron.scm (98%) rename gnu/{home-services => home/services}/shells.scm (99%) rename gnu/{home-services => home/services}/shepherd.scm (99%) rename gnu/{home-services => home/services}/symlink-manager.scm (99%) rename gnu/{home-services => home/services}/utils.scm (98%) rename gnu/{home-services => home/services}/xdg.scm (99%) diff --git a/doc/guix.texi b/doc/guix.texi index a72a726b54..d641935e0f 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -35555,9 +35555,9 @@ services)}. @node Essential Home Services @subsection Essential Home Services -There are a few essential services defined in @code{(gnu -home-services)}, they are mostly for internal use and are required to -build a home environment, but some of them will be useful for the end +There are a few essential home services defined in +@code{(gnu services)}, they are mostly for internal use and are required +to build a home environment, but some of them will be useful for the end user. @cindex environment variables @@ -35810,7 +35810,7 @@ for example). @cindex mcron @cindex scheduling jobs -The @code{(gnu home-services mcron)} module provides an interface to +The @code{(gnu home services mcron)} module provides an interface to GNU@tie{}mcron, a daemon to run jobs at scheduled times (@pxref{Top,,, mcron, GNU@tie{}mcron}). The information about system's mcron is applicable here (@pxref{Scheduled Job Execution}), the only difference diff --git a/doc/he-config-bare-bones.scm b/doc/he-config-bare-bones.scm index 01be46a7b0..1faf75b871 100644 --- a/doc/he-config-bare-bones.scm +++ b/doc/he-config-bare-bones.scm @@ -1,6 +1,6 @@ (use-modules (gnu home) (gnu home-services) - (gnu home-services shells) + (gnu home services shells) (gnu services) (gnu packages admin) (guix gexp)) diff --git a/gnu/home-services.scm b/gnu/home-services.scm index 9f1e986616..a244a15511 100644 --- a/gnu/home-services.scm +++ b/gnu/home-services.scm @@ -512,10 +512,10 @@ environment, and its configuration file, when available."))) (define %service-type-path ;; Search path for service types. - (make-parameter `((,%guix-home-root-directory . "gnu/home-services")))) + (make-parameter `((,%guix-home-root-directory . "gnu/home/services")))) (define (all-home-service-modules) - "Return the default set of 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))) diff --git a/gnu/home.scm b/gnu/home.scm index f4c9359e25..5ac382dc5a 100644 --- a/gnu/home.scm +++ b/gnu/home.scm @@ -18,10 +18,10 @@ (define-module (gnu home) #:use-module (gnu home-services) - #:use-module (gnu home-services symlink-manager) - #:use-module (gnu home-services shells) - #:use-module (gnu home-services xdg) - #:use-module (gnu home-services fontutils) + #:use-module (gnu home services symlink-manager) + #:use-module (gnu home services shells) + #:use-module (gnu home services xdg) + #:use-module (gnu home services fontutils) #:use-module (gnu services) #:use-module (guix records) #:use-module (guix diagnostics) diff --git a/gnu/home-services/configuration.scm b/gnu/home/services/configuration.scm similarity index 98% rename from gnu/home-services/configuration.scm rename to gnu/home/services/configuration.scm index e8f4bc77ec..5e7743e7d6 100644 --- a/gnu/home-services/configuration.scm +++ b/gnu/home/services/configuration.scm @@ -17,7 +17,7 @@ ;;; You should have received a copy of the GNU General Public License ;;; along with GNU Guix. If not, see . -(define-module (gnu home-services configuration) +(define-module (gnu home services configuration) #:use-module (gnu services configuration) #:use-module (guix gexp) #:use-module (srfi srfi-1) diff --git a/gnu/home-services/fontutils.scm b/gnu/home/services/fontutils.scm similarity index 98% rename from gnu/home-services/fontutils.scm rename to gnu/home/services/fontutils.scm index 28bfc3d3f7..72a84fdecd 100644 --- a/gnu/home-services/fontutils.scm +++ b/gnu/home/services/fontutils.scm @@ -17,7 +17,7 @@ ;;; You should have received a copy of the GNU General Public License ;;; along with GNU Guix. If not, see . -(define-module (gnu home-services fontutils) +(define-module (gnu home services fontutils) #:use-module (gnu home-services) #:use-module (gnu packages fontutils) #:use-module (guix gexp) diff --git a/gnu/home-services/mcron.scm b/gnu/home/services/mcron.scm similarity index 98% rename from gnu/home-services/mcron.scm rename to gnu/home/services/mcron.scm index fdfde179a5..cc6faac47f 100644 --- a/gnu/home-services/mcron.scm +++ b/gnu/home/services/mcron.scm @@ -17,11 +17,11 @@ ;;; You should have received a copy of the GNU General Public License ;;; along with GNU Guix. If not, see . -(define-module (gnu home-services mcron) +(define-module (gnu home services mcron) #:use-module (gnu packages guile-xyz) #:use-module (gnu home-services) - #:use-module (gnu home-services shepherd) #:use-module (gnu services shepherd) + #:use-module (gnu home services shepherd) #:use-module (guix records) #:use-module (guix gexp) #:use-module (srfi srfi-1) diff --git a/gnu/home-services/shells.scm b/gnu/home/services/shells.scm similarity index 99% rename from gnu/home-services/shells.scm rename to gnu/home/services/shells.scm index ecb02098f7..2308371dd0 100644 --- a/gnu/home-services/shells.scm +++ b/gnu/home/services/shells.scm @@ -17,10 +17,10 @@ ;;; You should have received a copy of the GNU General Public License ;;; along with GNU Guix. If not, see . -(define-module (gnu home-services shells) +(define-module (gnu home services shells) #:use-module (gnu services configuration) - #:use-module (gnu home-services configuration) - #:use-module (gnu home-services utils) + #:use-module (gnu home services configuration) + #:use-module (gnu home services utils) #:use-module (gnu home-services) #:use-module (gnu packages shells) #:use-module (gnu packages bash) diff --git a/gnu/home-services/shepherd.scm b/gnu/home/services/shepherd.scm similarity index 99% rename from gnu/home-services/shepherd.scm rename to gnu/home/services/shepherd.scm index 120cfde1a1..1a3e849bb2 100644 --- a/gnu/home-services/shepherd.scm +++ b/gnu/home/services/shepherd.scm @@ -17,7 +17,7 @@ ;;; You should have received a copy of the GNU General Public License ;;; along with GNU Guix. If not, see . -(define-module (gnu home-services shepherd) +(define-module (gnu home services shepherd) #:use-module (gnu home-services) #:use-module (gnu packages admin) #:use-module (gnu services shepherd) diff --git a/gnu/home-services/symlink-manager.scm b/gnu/home/services/symlink-manager.scm similarity index 99% rename from gnu/home-services/symlink-manager.scm rename to gnu/home/services/symlink-manager.scm index 11f5d503d4..d53e8f5046 100644 --- a/gnu/home-services/symlink-manager.scm +++ b/gnu/home/services/symlink-manager.scm @@ -17,7 +17,7 @@ ;;; You should have received a copy of the GNU General Public License ;;; along with GNU Guix. If not, see . -(define-module (gnu home-services symlink-manager) +(define-module (gnu home services symlink-manager) #:use-module (gnu home-services) #:use-module (guix gexp) diff --git a/gnu/home-services/utils.scm b/gnu/home/services/utils.scm similarity index 98% rename from gnu/home-services/utils.scm rename to gnu/home/services/utils.scm index f13133a7ae..cea75ee896 100644 --- a/gnu/home-services/utils.scm +++ b/gnu/home/services/utils.scm @@ -17,7 +17,7 @@ ;;; You should have received a copy of the GNU General Public License ;;; along with GNU Guix. If not, see . -(define-module (gnu home-services utils) +(define-module (gnu home services utils) #:use-module (ice-9 string-fun) #:use-module (srfi srfi-1) #:use-module (srfi srfi-26) diff --git a/gnu/home-services/xdg.scm b/gnu/home/services/xdg.scm similarity index 99% rename from gnu/home-services/xdg.scm rename to gnu/home/services/xdg.scm index 94275f3b65..4aed9a5803 100644 --- a/gnu/home-services/xdg.scm +++ b/gnu/home/services/xdg.scm @@ -17,12 +17,12 @@ ;;; You should have received a copy of the GNU General Public License ;;; along with GNU Guix. If not, see . -(define-module (gnu home-services xdg) +(define-module (gnu home services xdg) #:use-module (gnu services configuration) - #:use-module (gnu home-services configuration) + #:use-module (gnu home services configuration) #:use-module (gnu home-services) #:use-module (gnu packages freedesktop) - #:use-module (gnu home-services utils) + #:use-module (gnu home services utils) #:use-module (guix gexp) #:use-module (guix records) #:use-module (guix i18n) diff --git a/gnu/local.mk b/gnu/local.mk index d415b892e9..5e8b769ce9 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -75,14 +75,14 @@ GNU_SYSTEM_MODULES = \ %D%/ci.scm \ %D%/home.scm \ %D%/home-services.scm \ - %D%/home-services/symlink-manager.scm \ - %D%/home-services/fontutils.scm \ - %D%/home-services/configuration.scm \ - %D%/home-services/shells.scm \ - %D%/home-services/shepherd.scm \ - %D%/home-services/mcron.scm \ - %D%/home-services/utils.scm \ - %D%/home-services/xdg.scm \ + %D%/home/services/symlink-manager.scm \ + %D%/home/services/fontutils.scm \ + %D%/home/services/configuration.scm \ + %D%/home/services/shells.scm \ + %D%/home/services/shepherd.scm \ + %D%/home/services/mcron.scm \ + %D%/home/services/utils.scm \ + %D%/home/services/xdg.scm \ %D%/image.scm \ %D%/packages.scm \ %D%/packages/abduco.scm \ diff --git a/guix/scripts/home/import.scm b/guix/scripts/home/import.scm index 79fb23a2fd..c977ec3861 100644 --- a/guix/scripts/home/import.scm +++ b/guix/scripts/home/import.scm @@ -41,7 +41,7 @@ (let ((rc (string-append (getenv "HOME") "/.bashrc")) (profile (string-append (getenv "HOME") "/.bash_profile")) (logout (string-append (getenv "HOME") "/.bash_logout"))) - `((gnu home-services bash) + `((gnu home services bash) (service home-bash-service-type (home-bash-configuration ,@(if (file-exists? rc) From patchwork Mon Oct 4 23:13:30 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Oleg Pykhalov X-Patchwork-Id: 33605 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id A770127BBE3; Tue, 5 Oct 2021 00:15:16 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_MSPIKE_H2, SPF_HELO_PASS,T_DKIM_INVALID,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.2 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id E123A27BBE1 for ; Tue, 5 Oct 2021 00:15:15 +0100 (BST) Received: from localhost ([::1]:35690 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mXXAw-0005Cx-Q0 for patchwork@mira.cbaines.net; Mon, 04 Oct 2021 19:15:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48662) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mXXAk-0005CK-Cx for guix-patches@gnu.org; Mon, 04 Oct 2021 19:15:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:55289) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mXXAk-0008Mz-3L for guix-patches@gnu.org; Mon, 04 Oct 2021 19:15:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mXXAj-0006eR-VL for guix-patches@gnu.org; Mon, 04 Oct 2021 19:15:01 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#50967] [PATCH 2/3] home: services: configuration: Support file-like objects. Resent-From: Oleg Pykhalov Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 04 Oct 2021 23:15:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 50967 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: To: 50967@debbugs.gnu.org Cc: Oleg Pykhalov , Ludovic =?utf-8?q?Court=C3=A8s?= , Xinglu Chen , Andrew Tropin Received: via spool by 50967-submit@debbugs.gnu.org id=B50967.163338924825449 (code B ref 50967); Mon, 04 Oct 2021 23:15:01 +0000 Received: (at 50967) by debbugs.gnu.org; 4 Oct 2021 23:14:08 +0000 Received: from localhost ([127.0.0.1]:38593 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mXX9o-0006cJ-GW for submit@debbugs.gnu.org; Mon, 04 Oct 2021 19:14:08 -0400 Received: from mail-lf1-f43.google.com ([209.85.167.43]:38652) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mXX9j-0006bQ-Pw for 50967@debbugs.gnu.org; Mon, 04 Oct 2021 19:14:03 -0400 Received: by mail-lf1-f43.google.com with SMTP id x27so78306382lfu.5 for <50967@debbugs.gnu.org>; Mon, 04 Oct 2021 16:13:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=f60yKHn+X2EHT6kC0C8BhhkkXKiGuCHiR+X+q1VwQV8=; b=bi4YmzPbsXOjlW/Rk6Nx1LQc36hwLcp6LWSfitHc2tMF5ze2K8754y/jQ5urbacAWW 26LwgkRCuFzSspooF2Zv49ta4iD+0hxjeV3GxVN4vdnUlHrYFdjPwAQiY1+ZHcck9zcJ 0msMWcpmgeMlUo2NnuWPTvaOs0bFnMv8BXsn5qIXwD5mg4gWBAN4lWcZdTeDRdSqEuSG rdHFiG4/FTG/Y3+Xp8y1KrvO/QXflb7c9UXuy6PSL7AqGZEjmWQyXFQ3sH+8iTvaHqnW l8fRGeXvY8w1yPGho1mAPBb8RXV6XI8kv6zy6Z/G85cP+AmnCMXtCfEElgVrEW+T45F7 nVxg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=f60yKHn+X2EHT6kC0C8BhhkkXKiGuCHiR+X+q1VwQV8=; b=mihQAbC3IKB3rnxrj4di0vqqZxI9FtbLJOCav4KCivi5YdGCCr+24njgl5s1fg5+Fp mnYZ4DBEpMyV3UbiNilIpSAk44V+0hKF2NXFBIwcMELwQSoLdAB5C+doeTq3N3PrNnet l0g/iHEqDRZIovKzZh/6sPIxxQWgzDWD/zU1yhb6CUNJpeN4/NPpDUI2bqNYhm+mXCFH deNxtOeE2KbkAqfIeY+h5600Di253PXm9YDvvkriYS5gxPqCLQvsfo45NsGP8BvJxNBv tLWo82LqtMq+iwwtfSyD7zVnvT7mAXg6Faq1c5aSVCBTwiCfkRAHL99TbwpyPpEKHL4K MyDQ== X-Gm-Message-State: AOAM5319w96oM4maENaCgc19wfsxj3zXWKkIp0XC+eRRZwSnbzjsn+Le MngOUwfmfdqf1Zt6QO8etNACpkDAXoU= X-Google-Smtp-Source: ABdhPJxQzDpK8MbVcFSPIRrxlVPXXWpbX4gF1Kk57GIjU/fDHsc09zbxvtpVcO2z2g9VJbSgKNvC6A== X-Received: by 2002:ac2:5ece:: with SMTP id d14mr17263622lfq.451.1633389233557; Mon, 04 Oct 2021 16:13:53 -0700 (PDT) Received: from localhost.localdomain ([88.201.161.72]) by smtp.gmail.com with ESMTPSA id h4sm1736542lft.184.2021.10.04.16.13.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Oct 2021 16:13:53 -0700 (PDT) From: Oleg Pykhalov Date: Tue, 5 Oct 2021 02:13:30 +0300 Message-Id: <20211004231331.5269-2-go.wigust@gmail.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211004231331.5269-1-go.wigust@gmail.com> References: <87h7dwq4cb.fsf_-_@gnu.org> <20211004231331.5269-1-go.wigust@gmail.com> MIME-Version: 1.0 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+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches * gnu/home/services/configuration.scm (interpose): Operate only with file-like objects. (string-or-gexp?): Delete procedure. (serialize-string-or-gexp): Rename to 'serialize-file-like'. (text-config?): Call 'file-like' intead of 'string-or-gexp?'. * guix/scripts/home/import.scm: (generate-bash-module+configuration): Don't call slurp-file-gexp. * gnu/home/services/configuration.scm: Move content ... * gnu/services/configuration.scm: here. * gnu/home/services/shells.scm: Delete (gnu home services configuration). * gnu/home/services/xdg.scm: Same. * gnu/local.mk: Same. --- gnu/home/services/configuration.scm | 109 ---------------------------- gnu/home/services/shells.scm | 1 - gnu/home/services/xdg.scm | 1 - gnu/local.mk | 1 - gnu/services/configuration.scm | 90 ++++++++++++++++++++++- guix/scripts/home/import.scm | 8 +- 6 files changed, 91 insertions(+), 119 deletions(-) delete mode 100644 gnu/home/services/configuration.scm diff --git a/gnu/home/services/configuration.scm b/gnu/home/services/configuration.scm deleted file mode 100644 index 5e7743e7d6..0000000000 --- a/gnu/home/services/configuration.scm +++ /dev/null @@ -1,109 +0,0 @@ -;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2021 Andrew Tropin -;;; Copyright © 2021 Xinglu Chen -;;; -;;; This file is part of GNU Guix. -;;; -;;; GNU Guix is free software; you can redistribute it and/or modify it -;;; under the terms of the GNU General Public License as published by -;;; the Free Software Foundation; either version 3 of the License, or (at -;;; your option) any later version. -;;; -;;; GNU Guix is distributed in the hope that it will be useful, but -;;; WITHOUT ANY WARRANTY; without even the implied warranty of -;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;;; GNU General Public License for more details. -;;; -;;; You should have received a copy of the GNU General Public License -;;; along with GNU Guix. If not, see . - -(define-module (gnu home services configuration) - #:use-module (gnu services configuration) - #:use-module (guix gexp) - #:use-module (srfi srfi-1) - #:use-module (ice-9 curried-definitions) - #:use-module (ice-9 match) - #:use-module (guix i18n) - #:use-module (guix diagnostics) - - #:export (filter-configuration-fields - - interpose - list-of - - list-of-strings? - alist? - string-or-gexp? - serialize-string-or-gexp - text-config? - serialize-text-config - generic-serialize-alist-entry - generic-serialize-alist)) - -(define* (filter-configuration-fields configuration-fields fields - #:optional negate?) - "Retrieve the fields listed in FIELDS from CONFIGURATION-FIELDS. -If NEGATE? is @code{#t}, retrieve all fields except FIELDS." - (filter (lambda (field) - (let ((member? (member (configuration-field-name field) fields))) - (if (not negate?) member? (not member?)))) - configuration-fields)) - - -(define* (interpose ls #:optional (delimiter "\n") (grammar 'infix)) - "Same as @code{string-join}, but without join and string, returns an -DELIMITER interposed LS. Support 'infix and 'suffix GRAMMAR values." - (when (not (member grammar '(infix suffix))) - (raise - (formatted-message - (G_ "The GRAMMAR value must be 'infix or 'suffix, but ~a provided.") - grammar))) - (fold-right (lambda (e acc) - (cons e - (if (and (null? acc) (eq? grammar 'infix)) - acc - (cons delimiter acc)))) - '() ls)) - -(define (list-of pred?) - "Return a procedure that takes a list and check if all the elements of -the list result in @code{#t} when applying PRED? on them." - (lambda (x) - (if (list? x) - (every pred? x) - #f))) - - -(define list-of-strings? - (list-of string?)) - -(define alist? list?) - -(define (string-or-gexp? sg) (or (string? sg) (gexp? sg))) -(define (serialize-string-or-gexp field-name val) "") - -(define (text-config? config) - (and (list? config) (every string-or-gexp? config))) -(define (serialize-text-config field-name val) - #~(string-append #$@(interpose val "\n" 'suffix))) - -(define ((generic-serialize-alist-entry serialize-field) entry) - "Apply the SERIALIZE-FIELD procedure on the field and value of ENTRY." - (match entry - ((field . val) (serialize-field field val)))) - -(define (generic-serialize-alist combine serialize-field fields) - "Generate a configuration from an association list FIELDS. - -SERIALIZE-FIELD is a procedure that takes two arguments, it will be -applied on the fields and values of FIELDS using the -@code{generic-serialize-alist-entry} procedure. - -COMBINE is a procedure that takes one or more arguments and combines -all the alist entries into one value, @code{string-append} or -@code{append} are usually good candidates for this. - -See the @code{serialize-alist} procedure in `@code{(gnu home-services -version-control}' for an example usage.)}" - (apply combine - (map (generic-serialize-alist-entry serialize-field) fields))) diff --git a/gnu/home/services/shells.scm b/gnu/home/services/shells.scm index 2308371dd0..4e5825962c 100644 --- a/gnu/home/services/shells.scm +++ b/gnu/home/services/shells.scm @@ -19,7 +19,6 @@ (define-module (gnu home services shells) #:use-module (gnu services configuration) - #:use-module (gnu home services configuration) #:use-module (gnu home services utils) #:use-module (gnu home-services) #:use-module (gnu packages shells) diff --git a/gnu/home/services/xdg.scm b/gnu/home/services/xdg.scm index 4aed9a5803..c285d126dd 100644 --- a/gnu/home/services/xdg.scm +++ b/gnu/home/services/xdg.scm @@ -19,7 +19,6 @@ (define-module (gnu home services xdg) #:use-module (gnu services configuration) - #:use-module (gnu home services configuration) #:use-module (gnu home-services) #:use-module (gnu packages freedesktop) #:use-module (gnu home services utils) diff --git a/gnu/local.mk b/gnu/local.mk index 5e8b769ce9..9c3bf44a2b 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -77,7 +77,6 @@ GNU_SYSTEM_MODULES = \ %D%/home-services.scm \ %D%/home/services/symlink-manager.scm \ %D%/home/services/fontutils.scm \ - %D%/home/services/configuration.scm \ %D%/home/services/shells.scm \ %D%/home/services/shepherd.scm \ %D%/home/services/mcron.scm \ diff --git a/gnu/services/configuration.scm b/gnu/services/configuration.scm index df3d3b6f9b..60ab75b0c1 100644 --- a/gnu/services/configuration.scm +++ b/gnu/services/configuration.scm @@ -4,6 +4,7 @@ ;;; Copyright © 2017, 2018 Clément Lassieur ;;; Copyright © 2021 Xinglu Chen ;;; Copyright © 2021 Maxim Cournoyer +;;; Copyright © 2021 Andrew Tropin ;;; ;;; This file is part of GNU Guix. ;;; @@ -25,10 +26,12 @@ #:use-module (guix records) #:use-module (guix gexp) #:use-module ((guix utils) #:select (source-properties->location)) - #:use-module ((guix diagnostics) #:select (location-file)) + #:use-module ((guix diagnostics) #:select (formatted-message location-file)) #:use-module ((guix modules) #:select (file-name->module-name)) + #:use-module (guix i18n) #:autoload (texinfo) (texi-fragment->stexi) #:autoload (texinfo serialize) (stexi->texi) + #:use-module (ice-9 curried-definitions) #:use-module (ice-9 match) #:use-module (srfi srfi-1) #:use-module (srfi srfi-34) @@ -56,7 +59,20 @@ generate-documentation configuration->documentation empty-serializer - serialize-package)) + serialize-package + + filter-configuration-fields + + interpose + list-of + + list-of-strings? + alist? + serialize-file-like + text-config? + serialize-text-config + generic-serialize-alist-entry + generic-serialize-alist)) ;;; Commentary: ;;; @@ -323,3 +339,73 @@ Texinfo documentation of its fields." '-fields)))) (display (generate-documentation `((,configuration-symbol ,fields-getter)) configuration-symbol)))) + +(define* (filter-configuration-fields configuration-fields fields + #:optional negate?) + "Retrieve the fields listed in FIELDS from CONFIGURATION-FIELDS. +If NEGATE? is @code{#t}, retrieve all fields except FIELDS." + (filter (lambda (field) + (let ((member? (member (configuration-field-name field) fields))) + (if (not negate?) member? (not member?)))) + configuration-fields)) + + +(define* (interpose ls #:optional (delimiter "\n") (grammar 'infix)) + "Same as @code{string-join}, but without join and string, returns an +DELIMITER interposed LS. Support 'infix and 'suffix GRAMMAR values." + (when (not (member grammar '(infix suffix))) + (raise + (formatted-message + (G_ "The GRAMMAR value must be 'infix or 'suffix, but ~a provided.") + grammar))) + (fold-right (lambda (e acc) + (cons #~(begin + (use-modules (ice-9 rdelim)) + (with-fluids ((%default-port-encoding "UTF-8")) + (with-input-from-file #$e read-string))) + (if (and (null? acc) (eq? grammar 'infix)) + acc + (cons delimiter acc)))) + '() ls)) + +(define (list-of pred?) + "Return a procedure that takes a list and check if all the elements of +the list result in @code{#t} when applying PRED? on them." + (lambda (x) + (if (list? x) + (every pred? x) + #f))) + + +(define list-of-strings? + (list-of string?)) + +(define alist? list?) + +(define serialize-file-like empty-serializer) + +(define (text-config? config) + (list-of file-like?)) +(define (serialize-text-config field-name val) + #~(string-append #$@(interpose val "\n" 'suffix))) + +(define ((generic-serialize-alist-entry serialize-field) entry) + "Apply the SERIALIZE-FIELD procedure on the field and value of ENTRY." + (match entry + ((field . val) (serialize-field field val)))) + +(define (generic-serialize-alist combine serialize-field fields) + "Generate a configuration from an association list FIELDS. + +SERIALIZE-FIELD is a procedure that takes two arguments, it will be +applied on the fields and values of FIELDS using the +@code{generic-serialize-alist-entry} procedure. + +COMBINE is a procedure that takes one or more arguments and combines +all the alist entries into one value, @code{string-append} or +@code{append} are usually good candidates for this. + +See the @code{serialize-alist} procedure in `@code{(gnu home-services +version-control}' for an example usage.)}" + (apply combine + (map (generic-serialize-alist-entry serialize-field) fields))) diff --git a/guix/scripts/home/import.scm b/guix/scripts/home/import.scm index c977ec3861..611f580e85 100644 --- a/guix/scripts/home/import.scm +++ b/guix/scripts/home/import.scm @@ -46,17 +46,15 @@ (home-bash-configuration ,@(if (file-exists? rc) `((bashrc - (list (slurp-file-gexp (local-file ,rc))))) + (list (local-file ,rc)))) '()) ,@(if (file-exists? profile) `((bash-profile - (list (slurp-file-gexp - (local-file ,profile))))) + (list (local-file ,profile)))) '()) ,@(if (file-exists? logout) `((bash-logout - (list (slurp-file-gexp - (local-file ,logout))))) + (list (local-file ,logout)))) '())))))) From patchwork Mon Oct 4 23:13:31 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Oleg Pykhalov X-Patchwork-Id: 33608 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id ED3FE27BBE3; Tue, 5 Oct 2021 00:17:30 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_MSPIKE_H2, SPF_HELO_PASS,T_DKIM_INVALID,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.2 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 6478927BBE1 for ; Tue, 5 Oct 2021 00:17:30 +0100 (BST) Received: from localhost ([::1]:38370 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mXXD7-0007AN-CJ for patchwork@mira.cbaines.net; Mon, 04 Oct 2021 19:17:29 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48676) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mXXAl-0005Co-3x for guix-patches@gnu.org; Mon, 04 Oct 2021 19:15:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:55291) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mXXAk-0008OB-So for guix-patches@gnu.org; Mon, 04 Oct 2021 19:15:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mXXAk-0006eg-Ow for guix-patches@gnu.org; Mon, 04 Oct 2021 19:15:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#50967] [PATCH 3/3] guix: scripts: Make sure profile directory exists. Resent-From: Oleg Pykhalov Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 04 Oct 2021 23:15:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 50967 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: To: 50967@debbugs.gnu.org Cc: Oleg Pykhalov , Ludovic =?utf-8?q?Court=C3=A8s?= , Xinglu Chen , Andrew Tropin Received: via spool by 50967-submit@debbugs.gnu.org id=B50967.163338925725474 (code B ref 50967); Mon, 04 Oct 2021 23:15:02 +0000 Received: (at 50967) by debbugs.gnu.org; 4 Oct 2021 23:14:17 +0000 Received: from localhost ([127.0.0.1]:38597 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mXX9t-0006cZ-If for submit@debbugs.gnu.org; Mon, 04 Oct 2021 19:14:17 -0400 Received: from mail-lf1-f51.google.com ([209.85.167.51]:33753) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mXX9k-0006bS-0G for 50967@debbugs.gnu.org; Mon, 04 Oct 2021 19:14:04 -0400 Received: by mail-lf1-f51.google.com with SMTP id y23so38932772lfb.0 for <50967@debbugs.gnu.org>; Mon, 04 Oct 2021 16:13:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=VWOMu/1y352jN1iQIk1dmRNhHy+2lVBDKGyIJsYzPUE=; b=lxYZemNY3leAxyhEtPN31NTfiFxWiNQCsYk4ALqwzHEjNJe9hd3P/GPNLd0BEIpFfP 35APGVkTTpX0QrleTkqv1wvxrhLpKtheHNDy2u5nmkVGFeKk3bUcywy+yHtpBztKue8U av9OCQJgZQE4JD95KV3ZncVHZVc5rR85fMaSGvpas7iaKxTOZyXKjQj/KuNAQZT3hxc9 a9o67vGfv7gkCwX84u5zWNvczBeAu/qH1tQipdUxG9BakSvXEvg6zSE+qN9aTKLKG1/4 LaWcCSwXVNUjD8qtZb2F5fYt7ESK+9stvbkQ/osdbrygxW3MOnk/Qpzlk7L2nLQG0PuM M28A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=VWOMu/1y352jN1iQIk1dmRNhHy+2lVBDKGyIJsYzPUE=; b=fw4x9ikti35nLffIYMBsKtG0J02sJFL3mpR0RO34JN5pXtIRka6SH5kikBMPD7sZzE 9N6qezomHchsdneOdWGh5vE4las6f9xxEKnX4S0uaZX+d0Bfc63xvZKYERZdGjeSmYlO 3C2SalTQaYLXiS7Ym7WkBLMBdPtIcsHSzBuB9vtqimhp0Hzd4k1FJO7xbFqq95mjIAE1 MCnIkDTKQ/TeU12PVOHDPoXXT4RZ8wm1oif+e0Nhicak5SfI+Nz3jptpTNVoGn2LyFF3 b4TOC1VGhGRFm0OD8DL4PnMFEwLvI6hD8fozKsf91Rdre+0nWOz2GFKXQIUoYF9+VCJg PaLw== X-Gm-Message-State: AOAM532qvBpUWN0nPFhLpoeQJ4FiB/cfFB3OkYUWZWxEaESFiiQefsEo cJovfUc/bfEQbYTaRb896WgCqorJspA= X-Google-Smtp-Source: ABdhPJza8Rgm7Ru2T+8LvkhXM8AVaMZpWnUnnLUMP5Ey5iF8ppwYphW9eu5am8BuYOjzEvbnDsfEuA== X-Received: by 2002:a05:6512:12c7:: with SMTP id p7mr16856894lfg.328.1633389234073; Mon, 04 Oct 2021 16:13:54 -0700 (PDT) Received: from localhost.localdomain ([88.201.161.72]) by smtp.gmail.com with ESMTPSA id h4sm1736542lft.184.2021.10.04.16.13.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Oct 2021 16:13:53 -0700 (PDT) From: Oleg Pykhalov Date: Tue, 5 Oct 2021 02:13:31 +0300 Message-Id: <20211004231331.5269-3-go.wigust@gmail.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211004231331.5269-1-go.wigust@gmail.com> References: <87h7dwq4cb.fsf_-_@gnu.org> <20211004231331.5269-1-go.wigust@gmail.com> MIME-Version: 1.0 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+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches * guix/scripts/home.scm (process-action): Make sure profile directory exists. * tests/guix-home.sh: New file. * Makefile.am (SH_TESTS): Add this. --- Makefile.am | 1 + guix/scripts/home.scm | 2 ++ tests/guix-home.sh | 73 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 76 insertions(+) create mode 100644 tests/guix-home.sh diff --git a/Makefile.am b/Makefile.am index b66789fa0b..5bf2567dc8 100644 --- a/Makefile.am +++ b/Makefile.am @@ -546,6 +546,7 @@ SH_TESTS = \ tests/guix-package-aliases.sh \ tests/guix-package-net.sh \ tests/guix-system.sh \ + tests/guix-home.sh \ tests/guix-archive.sh \ tests/guix-authenticate.sh \ tests/guix-environment.sh \ diff --git a/guix/scripts/home.scm b/guix/scripts/home.scm index 75df6d707d..115dfadb57 100644 --- a/guix/scripts/home.scm +++ b/guix/scripts/home.scm @@ -1,6 +1,7 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2021 Andrew Tropin ;;; Copyright © 2021 Xinglu Chen +;;; Copyright © 2021 Oleg Pykhalov ;;; ;;; This file is part of GNU Guix. ;;; @@ -179,6 +180,7 @@ ACTION must be one of the sub-commands that takes a home environment declaration as an argument (a file name.) OPTS is the raw alist of options resulting from command-line parsing." (define (ensure-home-environment file-or-exp obj) + (ensure-profile-directory) (unless (home-environment? obj) (leave (G_ "'~a' does not return a home environment ~%") file-or-exp)) diff --git a/tests/guix-home.sh b/tests/guix-home.sh new file mode 100644 index 0000000000..e79982b7f7 --- /dev/null +++ b/tests/guix-home.sh @@ -0,0 +1,73 @@ +#!/bin/sh + +# GNU Guix --- Functional package management for GNU +# Copyright © 2021 Oleg Pykhalov +# +# This file is part of GNU Guix. +# +# GNU Guix is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or (at +# your option) any later version. +# +# GNU Guix is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GNU Guix. If not, see . + +# +# Test the 'guix home' using the external store, if any. +# + +guix home --version + +NIX_STORE_DIR="$(guile -c '(use-modules (guix config))(display %storedir)')" +localstatedir="$(guile -c '(use-modules (guix config))(display %localstatedir)')" +GUIX_DAEMON_SOCKET="$localstatedir/guix/daemon-socket/socket" +export NIX_STORE_DIR GUIX_DAEMON_SOCKET + +# Run tests only when a "real" daemon is available. +if ! guile -c '(use-modules (guix)) (exit (false-if-exception (open-connection)))' +then + exit 77 +fi + +STORE_PARENT="$(dirname "$NIX_STORE_DIR")" +export STORE_PARENT +if test "$STORE_PARENT" = "/"; then exit 77; fi + +test_directory="$(mktemp -d)" +export test_directory +trap 'chmod -Rf +w "$test_directory"; rm -rf "$test_directory"' EXIT + +( + cd "$test_directory" || exit 77 + + cat > "dot-bashrc" <<'EOF' +# dot-bashrc test file for guix home +EOF + + cat > "home.scm" <<'EOF' +(use-modules (gnu home) + (gnu home-services) + (gnu home services shells) + (gnu services) + (guix gexp)) + +(home-environment + (services + (list + (service home-bash-service-type + (home-bash-configuration + (guix-defaults? #t) + (bashrc + (list + (local-file (string-append (dirname (current-filename)) + "/dot-bashrc"))))))))) +EOF +) + +guix home reconfigure "${test_directory}/home.scm"