[PATCH 00/12] Move (gnu home-services XYZ) to (gnu services XYZ)

  • Done
  • quality assurance status badge
Details
6 participants
  • Andrew Tropin
  • Andrew Tropin
  • Oleg Pykhalov
  • Ludovic Courtès
  • Maxime Devos
  • Xinglu Chen
Owner
unassigned
Submitted by
Oleg Pykhalov
Severity
normal
O
O
Oleg Pykhalov wrote on 2 Oct 2021 15:43
(address . guix-patches@gnu.org)(name . Oleg Pykhalov)(address . go.wigust@gmail.com)
20211002134352.5735-1-go.wigust@gmail.com
This patch series moves (gnu home-services XYZ) to (gnu services XYZ) for:

1. Better module naming (discussed at

2. Easier code sharing. E.g. (gnu home-services mcron) uses ‘@@’ which should
never be used, and not guaranteed to work these days, due to inlining.

Tests:

passes ‘make check TESTS=tests/guix-home.sh’
succeeded ‘./pre-inst-env guix home build …/home.scm’
succeeded ‘./pre-inst-env guix home reconfigure …/home.scm’

Andrew Tropin (1):
tests: Add tests for guix home cli.

Oleg Pykhalov (11):
gnu: home-services: Move configuration to (gnu services).
gnu: home-services: Move symlink-manager to (gnu services).
gnu: home-services: Move utils to (gnu services).
gnu: home-services: Move fontutils to (gnu services).
gnu: home-services: Move shells to (gnu services).
gnu: home-services: Move xdg to (gnu services).
gnu: home-services: Move shepherd to (gnu services).
gnu: home-services: Move mcron to (gnu services).
gnu: home-services: Change %service-type-path and filter services.
scripts: home: (gnu home-services bash) -> (gnu services bash).
doc: (gnu home-services) -> (gnu services).

Makefile.am | 1 +
doc/guix.texi | 8 +-
doc/he-config-bare-bones.scm | 2 +-
gnu/home-services.scm | 9 +-
gnu/home-services/configuration.scm | 109 --------------
gnu/home-services/mcron.scm | 115 ---------------
gnu/home-services/shepherd.scm | 134 ------------------
gnu/home.scm | 8 +-
gnu/local.mk | 13 +-
gnu/services/configuration.scm | 89 +++++++++++-
gnu/{home-services => services}/fontutils.scm | 2 +-
gnu/services/mcron.scm | 89 +++++++++++-
gnu/{home-services => services}/shells.scm | 6 +-
gnu/services/shepherd.scm | 112 ++++++++++++++-
.../symlink-manager.scm | 2 +-
gnu/{home-services => services}/utils.scm | 2 +-
gnu/{home-services => services}/xdg.scm | 6 +-
guix/scripts/home/import.scm | 2 +-
tests/guix-home.sh | 99 +++++++++++++
19 files changed, 417 insertions(+), 391 deletions(-)
delete mode 100644 gnu/home-services/configuration.scm
delete mode 100644 gnu/home-services/mcron.scm
delete mode 100644 gnu/home-services/shepherd.scm
rename gnu/{home-services => services}/fontutils.scm (98%)
rename gnu/{home-services => services}/shells.scm (99%)
rename gnu/{home-services => services}/symlink-manager.scm (99%)
rename gnu/{home-services => services}/utils.scm (98%)
rename gnu/{home-services => services}/xdg.scm (99%)
create mode 100644 tests/guix-home.sh

--
2.33.0
O
O
Oleg Pykhalov wrote on 2 Oct 2021 15:45
[PATCH 01/12] tests: Add tests for guix home cli.
(address . 50967@debbugs.gnu.org)
20211002134603.6229-1-go.wigust@gmail.com
From: Andrew Tropin <andrew@trop.in>

* tests/guix-home.sh: New file.
* Makefile.am (SH_TESTS): Add tests/guix-home.sh.

Signed-off-by: Oleg Pykhalov <go.wigust@gmail.com>
---
Makefile.am | 1 +
tests/guix-home.sh | 99 ++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 100 insertions(+)
create mode 100644 tests/guix-home.sh

Toggle diff (119 lines)
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/tests/guix-home.sh b/tests/guix-home.sh
new file mode 100644
index 0000000000..cb015c907f
--- /dev/null
+++ b/tests/guix-home.sh
@@ -0,0 +1,99 @@
+# GNU Guix --- Functional package management for GNU
+# Copyright © 2021 Andrew Tropin <andrew@trop.in>
+#
+# 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 <http://www.gnu.org/licenses/>.
+
+#
+# Test 'guix home' cli.
+#
+
+set -e
+
+guix home --version
+
+tmpfile="t-guix-home-$$"
+errorfile="t-guix-home-error-$$"
+
+# Note: This directory is chosen outside $builddir so that relative file name
+# canonicalization doesn't mess up with 'current-source-directory', used by
+# 'local-file' ('load' forces 'relative' for
+# %FILE-PORT-NAME-CANONICALIZATION.)
+tmpdir="${TMPDIR:-/tmp}/t-guix-home-$$"
+mkdir "$tmpdir"
+
+trap 'rm -f "$tmpfile" "$errorfile" "$tmpdir"/*; rmdir "$tmpdir"' EXIT
+
+# Reporting of syntax errors.
+
+cat > "$tmpfile"<<EOF
+;; This is line 1, and the next one is line 2.
+ (home-environment
+ (packages))
+;; The 'T' is at column 3.
+EOF
+
+if guix home build "$tmpfile" 2> "$errorfile"
+then
+ # This must not succeed.
+ exit 1
+else
+ grep "$tmpfile:3:4: error: (packages): invalid field specifier" "$errorfile"
+fi
+
+
+cat > "$tmpfile"<<EOF
+;; This is line 1, and the next one is line 2.
+ (home-environment
+;; This is line 3, and there is no closing paren!
+EOF
+
+if guix home build "$tmpfile" 2> "$errorfile"
+then
+ # This must not succeed.
+ exit 1
+else
+ # Guile 3.0.6 gets line/column numbers for 'read-error' wrong
+ # (zero-indexed): <https://bugs.gnu.org/48089>.
+ grep "$tmpfile:4:1: missing closing paren" "$errorfile" || \
+ grep "$tmpfile:3:0: missing closing paren" "$errorfile"
+fi
+
+# Reporting of duplicate system service declaration.
+
+cat > "$tmpfile" <<EOF
+(use-modules (gnu))
+(use-modules (gnu home-services shepherd))
+
+(home-environment
+ (services (list (service home-shepherd-service-type)
+ (simple-service 'test-shepherd-extension
+ home-shepherd-service-type '())
+ (service home-shepherd-service-type)
+ (service home-shepherd-service-type))))
+EOF
+
+if guix home build "$tmpfile" 2> "$errorfile"
+then
+ # This must not succeed.
+ exit 1
+else
+ grep "guix home: error: more than one target service of type 'home-shepherd'" "$errorfile"
+fi
+
+# Searching.
+
+guix home search mcron | grep "^name: home-mcron"
+guix home search job manager | grep "^name: home-mcron"
--
2.33.0
O
O
Oleg Pykhalov wrote on 2 Oct 2021 15:45
[PATCH 03/12] gnu: home-services: Move symlink-manager to (gnu services).
(address . 50967@debbugs.gnu.org)(name . Oleg Pykhalov)(address . go.wigust@gmail.com)
20211002134603.6229-3-go.wigust@gmail.com
* gnu/home-services/symlink-manager.scm: Rename to
gnu/services/symlink-manager.scm.
* gnu/local.mk: Same.
* gnu/home.scm: Replace (gnu home-services symlink-manager) with
(gnu services symlink-manager).
---
gnu/home.scm | 2 +-
gnu/local.mk | 2 +-
gnu/{home-services => services}/symlink-manager.scm | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
rename gnu/{home-services => services}/symlink-manager.scm (99%)

Toggle diff (51 lines)
diff --git a/gnu/home.scm b/gnu/home.scm
index f4c9359e25..9a25a20b6c 100644
--- a/gnu/home.scm
+++ b/gnu/home.scm
@@ -18,7 +18,7 @@
(define-module (gnu home)
#:use-module (gnu home-services)
- #:use-module (gnu home-services symlink-manager)
+ #:use-module (gnu services symlink-manager)
#:use-module (gnu home-services shells)
#:use-module (gnu home-services xdg)
#:use-module (gnu home-services fontutils)
diff --git a/gnu/local.mk b/gnu/local.mk
index 0e1ff9f462..1c30763ff2 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -75,7 +75,6 @@ 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/shells.scm \
%D%/home-services/shepherd.scm \
@@ -660,6 +659,7 @@ GNU_SYSTEM_MODULES = \
%D%/services/spice.scm \
%D%/services/ssh.scm \
%D%/services/syncthing.scm \
+ %D%/services/symlink-manager.scm \
%D%/services/sysctl.scm \
%D%/services/telephony.scm \
%D%/services/version-control.scm \
diff --git a/gnu/home-services/symlink-manager.scm b/gnu/services/symlink-manager.scm
similarity index 99%
rename from gnu/home-services/symlink-manager.scm
rename to gnu/services/symlink-manager.scm
index 11f5d503d4..84adec8d44 100644
--- a/gnu/home-services/symlink-manager.scm
+++ b/gnu/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 <http://www.gnu.org/licenses/>.
-(define-module (gnu home-services symlink-manager)
+(define-module (gnu services symlink-manager)
#:use-module (gnu home-services)
#:use-module (guix gexp)
--
2.33.0
O
O
Oleg Pykhalov wrote on 2 Oct 2021 15:45
[PATCH 02/12] gnu: home-services: Move configuration to (gnu services).
(address . 50967@debbugs.gnu.org)(name . Oleg Pykhalov)(address . go.wigust@gmail.com)
20211002134603.6229-2-go.wigust@gmail.com
* gnu/home-services/configuration.scm: Move the content ...
* gnu/services/configuration.scm: ... here.
* gnu/local.mk (GNU_SYSTEM_MODULES): Delete gnu/home-services/configuration.
* gnu/home-services/shells.scm: Replace (gnu home-services configuration)
with (gnu services configuration).
* gnu/home-services/xdg.scm: Same.
---
gnu/home-services/configuration.scm | 109 ----------------------------
gnu/home-services/shells.scm | 2 +-
gnu/home-services/xdg.scm | 2 +-
gnu/local.mk | 1 -
gnu/services/configuration.scm | 89 ++++++++++++++++++++++-
5 files changed, 89 insertions(+), 114 deletions(-)
delete mode 100644 gnu/home-services/configuration.scm

Toggle diff (276 lines)
diff --git a/gnu/home-services/configuration.scm b/gnu/home-services/configuration.scm
deleted file mode 100644
index e8f4bc77ec..0000000000
--- a/gnu/home-services/configuration.scm
+++ /dev/null
@@ -1,109 +0,0 @@
-;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2021 Andrew Tropin <andrew@trop.in>
-;;; Copyright © 2021 Xinglu Chen <public@yoctocell.xyz>
-;;;
-;;; 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 <http://www.gnu.org/licenses/>.
-
-(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 ecb02098f7..f9057cc8a2 100644
--- a/gnu/home-services/shells.scm
+++ b/gnu/home-services/shells.scm
@@ -19,7 +19,7 @@
(define-module (gnu home-services shells)
#:use-module (gnu services configuration)
- #:use-module (gnu home-services configuration)
+ #:use-module (gnu 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 94275f3b65..efc1870c28 100644
--- a/gnu/home-services/xdg.scm
+++ b/gnu/home-services/xdg.scm
@@ -19,7 +19,7 @@
(define-module (gnu home-services xdg)
#:use-module (gnu services configuration)
- #:use-module (gnu home-services configuration)
+ #:use-module (gnu 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 d415b892e9..0e1ff9f462 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..54e5cd1a79 100644
--- a/gnu/services/configuration.scm
+++ b/gnu/services/configuration.scm
@@ -4,6 +4,7 @@
;;; Copyright © 2017, 2018 Clément Lassieur <clement@lassieur.org>
;;; Copyright © 2021 Xinglu Chen <public@yoctocell.xyz>
;;; Copyright © 2021 Maxim Cournoyer <maxim.cournoyer@gmail.com>
+;;; Copyright © 2021 Andrew Tropin <andrew@trop.in>
;;;
;;; 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,21 @@
generate-documentation
configuration->documentation
empty-serializer
- serialize-package))
+ serialize-package
+
+ 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))
;;; Commentary:
;;;
@@ -323,3 +340,71 @@ 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 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)))
--
2.33.0
O
O
Oleg Pykhalov wrote on 2 Oct 2021 15:45
[PATCH 04/12] gnu: home-services: Move utils to (gnu services).
(address . 50967@debbugs.gnu.org)(name . Oleg Pykhalov)(address . go.wigust@gmail.com)
20211002134603.6229-4-go.wigust@gmail.com
* gnu/home-services/utils.scm: Rename to gnu/services/utils.scm.
* gnu/local.mk: Same.
* gnu/home-services/shells.scm: Replace (gnu home-services utils) with
(gnu services utils)
* gnu/home-services/xdg.scm: Same.
---
gnu/home-services/shells.scm | 2 +-
gnu/home-services/xdg.scm | 2 +-
gnu/local.mk | 2 +-
gnu/{home-services => services}/utils.scm | 2 +-
4 files changed, 4 insertions(+), 4 deletions(-)
rename gnu/{home-services => services}/utils.scm (98%)

Toggle diff (64 lines)
diff --git a/gnu/home-services/shells.scm b/gnu/home-services/shells.scm
index f9057cc8a2..377ff74542 100644
--- a/gnu/home-services/shells.scm
+++ b/gnu/home-services/shells.scm
@@ -20,7 +20,7 @@
(define-module (gnu home-services shells)
#:use-module (gnu services configuration)
#:use-module (gnu services configuration)
- #:use-module (gnu home-services utils)
+ #:use-module (gnu services utils)
#:use-module (gnu home-services)
#:use-module (gnu packages shells)
#:use-module (gnu packages bash)
diff --git a/gnu/home-services/xdg.scm b/gnu/home-services/xdg.scm
index efc1870c28..183bca630c 100644
--- a/gnu/home-services/xdg.scm
+++ b/gnu/home-services/xdg.scm
@@ -22,7 +22,7 @@
#:use-module (gnu services configuration)
#:use-module (gnu home-services)
#:use-module (gnu packages freedesktop)
- #:use-module (gnu home-services utils)
+ #:use-module (gnu 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 1c30763ff2..50f5e58fbc 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -79,7 +79,6 @@ GNU_SYSTEM_MODULES = \
%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 \
@@ -664,6 +663,7 @@ GNU_SYSTEM_MODULES = \
%D%/services/telephony.scm \
%D%/services/version-control.scm \
%D%/services/vpn.scm \
+ %D%/services/utils.scm \
%D%/services/web.scm \
%D%/services/xorg.scm \
\
diff --git a/gnu/home-services/utils.scm b/gnu/services/utils.scm
similarity index 98%
rename from gnu/home-services/utils.scm
rename to gnu/services/utils.scm
index f13133a7ae..b95f2395c4 100644
--- a/gnu/home-services/utils.scm
+++ b/gnu/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 <http://www.gnu.org/licenses/>.
-(define-module (gnu home-services utils)
+(define-module (gnu services utils)
#:use-module (ice-9 string-fun)
#:use-module (srfi srfi-1)
#:use-module (srfi srfi-26)
--
2.33.0
O
O
Oleg Pykhalov wrote on 2 Oct 2021 15:45
[PATCH 05/12] gnu: home-services: Move fontutils to (gnu services).
(address . 50967@debbugs.gnu.org)(name . Oleg Pykhalov)(address . go.wigust@gmail.com)
20211002134603.6229-5-go.wigust@gmail.com
* 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.scm | 2 +-
gnu/local.mk | 2 +-
gnu/{home-services => services}/fontutils.scm | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
rename gnu/{home-services => services}/fontutils.scm (98%)

Toggle diff (51 lines)
diff --git a/gnu/home.scm b/gnu/home.scm
index 9a25a20b6c..352f19ea06 100644
--- a/gnu/home.scm
+++ b/gnu/home.scm
@@ -21,7 +21,7 @@
#:use-module (gnu 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 fontutils)
#:use-module (gnu services)
#:use-module (guix records)
#:use-module (guix diagnostics)
diff --git a/gnu/local.mk b/gnu/local.mk
index 50f5e58fbc..5df35435e7 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -75,7 +75,6 @@ GNU_SYSTEM_MODULES = \
%D%/ci.scm \
%D%/home.scm \
%D%/home-services.scm \
- %D%/home-services/fontutils.scm \
%D%/home-services/shells.scm \
%D%/home-services/shepherd.scm \
%D%/home-services/mcron.scm \
@@ -630,6 +629,7 @@ GNU_SYSTEM_MODULES = \
%D%/services/docker.scm \
%D%/services/authentication.scm \
%D%/services/file-sharing.scm \
+ %D%/services/fontutils.scm \
%D%/services/games.scm \
%D%/services/ganeti.scm \
%D%/services/getmail.scm \
diff --git a/gnu/home-services/fontutils.scm b/gnu/services/fontutils.scm
similarity index 98%
rename from gnu/home-services/fontutils.scm
rename to gnu/services/fontutils.scm
index 28bfc3d3f7..82c6048bb4 100644
--- a/gnu/home-services/fontutils.scm
+++ b/gnu/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 <http://www.gnu.org/licenses/>.
-(define-module (gnu home-services fontutils)
+(define-module (gnu services fontutils)
#:use-module (gnu home-services)
#:use-module (gnu packages fontutils)
#:use-module (guix gexp)
--
2.33.0
O
O
Oleg Pykhalov wrote on 2 Oct 2021 15:45
[PATCH 06/12] gnu: home-services: Move shells to (gnu services).
(address . 50967@debbugs.gnu.org)(name . Oleg Pykhalov)(address . go.wigust@gmail.com)
20211002134603.6229-6-go.wigust@gmail.com
* gnu/home-services/shells.scm: Rename to gnu/services/shells.scm.
* gnu/local.mk: Same.
* gnu/home.scm: Replace (gnu home-services shells) with (gnu services shells).
* doc/he-config-bare-bones.scm: Same.
---
doc/he-config-bare-bones.scm | 2 +-
gnu/home.scm | 2 +-
gnu/local.mk | 2 +-
gnu/{home-services => services}/shells.scm | 2 +-
4 files changed, 4 insertions(+), 4 deletions(-)
rename gnu/{home-services => services}/shells.scm (99%)

Toggle diff (63 lines)
diff --git a/doc/he-config-bare-bones.scm b/doc/he-config-bare-bones.scm
index 01be46a7b0..c6c5866a17 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 services shells)
(gnu services)
(gnu packages admin)
(guix gexp))
diff --git a/gnu/home.scm b/gnu/home.scm
index 352f19ea06..a36b41daf9 100644
--- a/gnu/home.scm
+++ b/gnu/home.scm
@@ -19,7 +19,7 @@
(define-module (gnu home)
#:use-module (gnu home-services)
#:use-module (gnu services symlink-manager)
- #:use-module (gnu home-services shells)
+ #:use-module (gnu services shells)
#:use-module (gnu home-services xdg)
#:use-module (gnu services fontutils)
#:use-module (gnu services)
diff --git a/gnu/local.mk b/gnu/local.mk
index 5df35435e7..c549a96966 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -75,7 +75,6 @@ GNU_SYSTEM_MODULES = \
%D%/ci.scm \
%D%/home.scm \
%D%/home-services.scm \
- %D%/home-services/shells.scm \
%D%/home-services/shepherd.scm \
%D%/home-services/mcron.scm \
%D%/home-services/xdg.scm \
@@ -655,6 +654,7 @@ GNU_SYSTEM_MODULES = \
%D%/services/pm.scm \
%D%/services/rsync.scm \
%D%/services/sddm.scm \
+ %D%/services/shells.scm \
%D%/services/spice.scm \
%D%/services/ssh.scm \
%D%/services/syncthing.scm \
diff --git a/gnu/home-services/shells.scm b/gnu/services/shells.scm
similarity index 99%
rename from gnu/home-services/shells.scm
rename to gnu/services/shells.scm
index 377ff74542..1e51fa99df 100644
--- a/gnu/home-services/shells.scm
+++ b/gnu/services/shells.scm
@@ -17,7 +17,7 @@
;;; You should have received a copy of the GNU General Public License
;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
-(define-module (gnu home-services shells)
+(define-module (gnu services shells)
#:use-module (gnu services configuration)
#:use-module (gnu services configuration)
#:use-module (gnu services utils)
--
2.33.0
O
O
Oleg Pykhalov wrote on 2 Oct 2021 15:45
[PATCH 07/12] gnu: home-services: Move xdg to (gnu services).
(address . 50967@debbugs.gnu.org)(name . Oleg Pykhalov)(address . go.wigust@gmail.com)
20211002134603.6229-7-go.wigust@gmail.com
* gnu/home-services/xdg.scm: Rename to gnu/services/xdg.scm.
* gnu/local.mk: Same.
* gnu/home.scm: Replace (gnu home-services xdg) with (gnu services xdg).
---
gnu/home.scm | 2 +-
gnu/local.mk | 2 +-
gnu/{home-services => services}/xdg.scm | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
rename gnu/{home-services => services}/xdg.scm (99%)

Toggle diff (51 lines)
diff --git a/gnu/home.scm b/gnu/home.scm
index a36b41daf9..fc4193385e 100644
--- a/gnu/home.scm
+++ b/gnu/home.scm
@@ -20,7 +20,7 @@
#:use-module (gnu home-services)
#:use-module (gnu services symlink-manager)
#:use-module (gnu services shells)
- #:use-module (gnu home-services xdg)
+ #:use-module (gnu services xdg)
#:use-module (gnu services fontutils)
#:use-module (gnu services)
#:use-module (guix records)
diff --git a/gnu/local.mk b/gnu/local.mk
index c549a96966..97ff893bf7 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -77,7 +77,6 @@ GNU_SYSTEM_MODULES = \
%D%/home-services.scm \
%D%/home-services/shepherd.scm \
%D%/home-services/mcron.scm \
- %D%/home-services/xdg.scm \
%D%/image.scm \
%D%/packages.scm \
%D%/packages/abduco.scm \
@@ -665,6 +664,7 @@ GNU_SYSTEM_MODULES = \
%D%/services/vpn.scm \
%D%/services/utils.scm \
%D%/services/web.scm \
+ %D%/services/xdg.scm \
%D%/services/xorg.scm \
\
%D%/system.scm \
diff --git a/gnu/home-services/xdg.scm b/gnu/services/xdg.scm
similarity index 99%
rename from gnu/home-services/xdg.scm
rename to gnu/services/xdg.scm
index 183bca630c..47e1751f75 100644
--- a/gnu/home-services/xdg.scm
+++ b/gnu/services/xdg.scm
@@ -17,7 +17,7 @@
;;; You should have received a copy of the GNU General Public License
;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
-(define-module (gnu home-services xdg)
+(define-module (gnu services xdg)
#:use-module (gnu services configuration)
#:use-module (gnu services configuration)
#:use-module (gnu home-services)
--
2.33.0
O
O
Oleg Pykhalov wrote on 2 Oct 2021 15:46
[PATCH 09/12] gnu: home-services: Move mcron to (gnu services).
(address . 50967@debbugs.gnu.org)(name . Oleg Pykhalov)(address . go.wigust@gmail.com)
20211002134603.6229-9-go.wigust@gmail.com
* gnu/home-services/mcron.scm: Move content without delete job-files and
shepherd-schedule-action ...
* gnu/services/mcron.scm: ... here.
* gnu/local.mk: Delete gnu/home-services/mcron.scm.
* doc/guix.texi: Replace (gnu home-services mcron) with (gnu services mcron).
---
doc/guix.texi | 2 +-
gnu/home-services/mcron.scm | 115 ------------------------------------
gnu/local.mk | 1 -
gnu/services/mcron.scm | 89 +++++++++++++++++++++++++++-
4 files changed, 89 insertions(+), 118 deletions(-)
delete mode 100644 gnu/home-services/mcron.scm

Toggle diff (266 lines)
diff --git a/doc/guix.texi b/doc/guix.texi
index a72a726b54..d06590ab8c 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -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 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/gnu/home-services/mcron.scm b/gnu/home-services/mcron.scm
deleted file mode 100644
index a4e09f509c..0000000000
--- a/gnu/home-services/mcron.scm
+++ /dev/null
@@ -1,115 +0,0 @@
-;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2021 Andrew Tropin <andrew@trop.in>
-;;; Copyright © 2021 Xinglu Chen <public@yoctocell.xyz>
-;;;
-;;; 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 <http://www.gnu.org/licenses/>.
-
-(define-module (gnu home-services mcron)
- #:use-module (gnu packages guile-xyz)
- #:use-module (gnu home-services)
- #:use-module (gnu services shepherd)
- #:use-module (gnu services shepherd)
- #:use-module (guix records)
- #:use-module (guix gexp)
- #:use-module (srfi srfi-1)
- #:use-module (ice-9 match)
-
- #:export (home-mcron-configuration
- home-mcron-service-type))
-
-;;; Commentary:
-;;
-;; Service for the GNU mcron cron job manager.
-;;
-;; Example configuration, the first job runs mbsync once every ten
-;; minutes, the second one writes "Mcron service" to ~/mcron-file once
-;; every minute.
-;;
-;; (service home-mcron-service-type
-;; (home-mcron-configuration
-;; (jobs (list #~(job '(next-minute
-;; (range 0 60 10))
-;; (lambda ()
-;; (system* "mbsync" "--all")))
-;; #~(job next-minute-from
-;; (lambda ()
-;; (call-with-output-file (string-append (getenv "HOME")
-;; "/mcron-file")
-;; (lambda (port)
-;; (display "Mcron service" port)))))))))
-;;
-;;; Code:
-
-(define-record-type* <home-mcron-configuration> home-mcron-configuration
- make-home-mcron-configuration
- home-mcron-configuration?
- (package home-mcron-configuration-package ; package
- (default mcron))
- (jobs home-mcron-configuration-jobs ; list of jobs
- (default '())))
-
-(define job-files (@@ (gnu services mcron) job-files))
-(define shepherd-schedule-action
- (@@ (gnu services mcron) shepherd-schedule-action))
-
-(define home-mcron-shepherd-services
- (match-lambda
- (($ <home-mcron-configuration> mcron '()) ; no jobs to run
- '())
- (($ <home-mcron-configuration> mcron jobs)
- (let ((files (job-files mcron jobs)))
- (list (shepherd-service
- (documentation "User cron jobs.")
- (provision '(mcron))
- (modules `((srfi srfi-1)
- (srfi srfi-26)
- (ice-9 popen) ; for the 'schedule' action
- (ice-9 rdelim)
- (ice-9 match)
- ,@%default-modules))
- (start #~(make-forkexec-constructor
- (list #$(file-append mcron "/bin/mcron") #$@files)
- #:log-file (string-append
- (or (getenv "XDG_LOG_HOME")
- (format #f "~a/.local/var/log"
- (getenv "HOME")))
- "/mcron.log")))
- (stop #~(make-kill-destructor))
- (actions
- (list (shepherd-schedule-action mcron files)))))))))
-
-(define home-mcron-profile (compose list home-mcron-configuration-package))
-
-(define (home-mcron-extend config jobs)
- (home-mcron-configuration
- (inherit config)
- (jobs (append (home-mcron-configuration-jobs config)
- jobs))))
-
-(define home-mcron-service-type
- (service-type (name 'home-mcron)
- (extensions
- (list (service-extension
- home-shepherd-service-type
- home-mcron-shepherd-services)
- (service-extension
- home-profile-service-type
- home-mcron-profile)))
- (compose concatenate)
- (extend home-mcron-extend)
- (default-value (home-mcron-configuration))
- (description
- "Install and configure the GNU mcron cron job manager.")))
diff --git a/gnu/local.mk b/gnu/local.mk
index fb60e6492e..ca4c15ba25 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -75,7 +75,6 @@ GNU_SYSTEM_MODULES = \
%D%/ci.scm \
%D%/home.scm \
%D%/home-services.scm \
- %D%/home-services/mcron.scm \
%D%/image.scm \
%D%/packages.scm \
%D%/packages/abduco.scm \
diff --git a/gnu/services/mcron.scm b/gnu/services/mcron.scm
index 0e675607f3..79639caee4 100644
--- a/gnu/services/mcron.scm
+++ b/gnu/services/mcron.scm
@@ -1,5 +1,7 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2016, 2017, 2018, 2019, 2020 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2021 Andrew Tropin <andrew@trop.in>
+;;; Copyright © 2021 Xinglu Chen <public@yoctocell.xyz>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -19,6 +21,7 @@
(define-module (gnu services mcron)
#:use-module (gnu services)
#:use-module (gnu services shepherd)
+ #:use-module (gnu home-services)
#:use-module (gnu packages guile-xyz)
#:use-module (guix deprecation)
#:use-module (guix records)
@@ -31,7 +34,10 @@
mcron-configuration-mcron
mcron-configuration-jobs
- mcron-service-type))
+ mcron-service-type
+
+ home-mcron-configuration
+ home-mcron-service-type))
;;; Commentary:
;;;
@@ -172,4 +178,85 @@ files."
jobs)))))
(default-value (mcron-configuration)))) ;empty job list
+
+;;;
+;;; Home services
+;;;
+
+;; Service for the GNU mcron cron job manager.
+;;
+;; Example configuration, the first job runs mbsync once every ten
+;; minutes, the second one writes "Mcron service" to ~/mcron-file once
+;; every minute.
+;;
+;; (service home-mcron-service-type
+;; (home-mcron-configuration
+;; (jobs (list #~(job '(next-minute
+;; (range 0 60 10))
+;; (lambda ()
+;; (system* "mbsync" "--all")))
+;; #~(job next-minute-from
+;; (lambda ()
+;; (call-with-output-file (string-append (getenv "HOME")
+;; "/mcron-file")
+;; (lambda (port)
+;; (display "Mcron service" port)))))))))
+
+(define-record-type* <home-mcron-configuration> home-mcron-configuration
+ make-home-mcron-configuration
+ home-mcron-configuration?
+ (package home-mcron-configuration-package ; package
+ (default mcron))
+ (jobs home-mcron-configuration-jobs ; list of jobs
+ (default '())))
+
+(define home-mcron-shepherd-services
+ (match-lambda
+ (($ <home-mcron-configuration> mcron '()) ; no jobs to run
+ '())
+ (($ <home-mcron-configuration> mcron jobs)
+ (let ((files (job-files mcron jobs)))
+ (list (shepherd-service
+ (documentation "User cron jobs.")
+ (provision '(mcron))
+ (modules `((srfi srfi-1)
+ (srfi srfi-26)
+ (ice-9 popen) ; for the 'schedule' action
+ (ice-9 rdelim)
+ (ice-9 match)
+ ,@%default-modules))
+ (start #~(make-forkexec-constructor
+ (list #$(file-append mcron "/bin/mcron") #$@files)
+ #:log-file (string-append
+ (or (getenv "XDG_LOG_HOME")
+ (format #f "~a/.local/var/log"
+ (getenv "HOME")))
+ "/mcron.log")))
+ (stop #~(make-kill-destructor))
+ (actions
+ (list (shepherd-schedule-action mcron files)))))))))
+
+(define home-mcron-profile (compose list home-mcron-configuration-package))
+
+(define (home-mcron-extend config jobs)
+ (home-mcron-configuration
+ (inherit config)
+ (jobs (append (home-mcron-configuration-jobs config)
+ jobs))))
+
+(define home-mcron-service-type
+ (service-type (name 'home-mcron)
+ (extensions
+ (list (service-extension
+ home-shepherd-service-type
+ home-mcron-shepherd-services)
+ (service-extension
+ home-profile-service-type
+ home-mcron-profile)))
+ (compose concatenate)
+ (extend home-mcron-extend)
+ (default-value (home-mcron-configuration))
+ (description
+ "Install and configure the GNU mcron cron job manager.")))
+
;;; mcron.scm ends here
--
2.33.0
O
O
Oleg Pykhalov wrote on 2 Oct 2021 15:46
[PATCH 10/12] gnu: home-services: Change %service-type-path and filter services.
(address . 50967@debbugs.gnu.org)(name . Oleg Pykhalov)(address . go.wigust@gmail.com)
20211002134603.6229-10-go.wigust@gmail.com
* gnu/home-services.scm
(%service-type-path): Search home services in "gnu/services".
* gnu/home-services.scm (fold-home-service-types): Filter home services.
---
gnu/home-services.scm | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)

Toggle diff (26 lines)
diff --git a/gnu/home-services.scm b/gnu/home-services.scm
index 9f1e986616..bc4b857715 100644
--- a/gnu/home-services.scm
+++ b/gnu/home-services.scm
@@ -512,7 +512,7 @@ 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/services"))))
(define (all-home-service-modules)
"Return the default set of home-service modules."
@@ -521,4 +521,9 @@ environment, and its configuration file, when available.")))
#:warn warn-about-load-error)))
(define* (fold-home-service-types proc seed)
- (fold-service-types proc seed (all-home-service-modules)))
+ (filter (match-lambda
+ ((service-type . _)
+ (string-prefix? "home-"
+ (symbol->string
+ (service-type-name service-type)))))
+ (fold-service-types proc seed (all-home-service-modules))))
--
2.33.0
O
O
Oleg Pykhalov wrote on 2 Oct 2021 15:46
[PATCH 11/12] scripts: home: (gnu home-services bash) -> (gnu services bash).
(address . 50967@debbugs.gnu.org)(name . Oleg Pykhalov)(address . go.wigust@gmail.com)
20211002134603.6229-11-go.wigust@gmail.com
* guix/scripts/home/import.scm: Replace (gnu home-services bash) with
(gnu services bash).
---
guix/scripts/home/import.scm | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

Toggle diff (15 lines)
diff --git a/guix/scripts/home/import.scm b/guix/scripts/home/import.scm
index 79fb23a2fd..98dcdea388 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 services bash)
(service home-bash-service-type
(home-bash-configuration
,@(if (file-exists? rc)
--
2.33.0
O
O
Oleg Pykhalov wrote on 2 Oct 2021 15:46
[PATCH 12/12] doc: (gnu home-services) -> (gnu services).
(address . 50967@debbugs.gnu.org)(name . Oleg Pykhalov)(address . go.wigust@gmail.com)
20211002134603.6229-12-go.wigust@gmail.com
* doc/guix.texi: Replace (gnu home-services) with (gnu services).
---
doc/guix.texi | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

Toggle diff (19 lines)
diff --git a/doc/guix.texi b/doc/guix.texi
index d06590ab8c..a647ea150a 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
--
2.33.0
O
O
Oleg Pykhalov wrote on 2 Oct 2021 15:45
[PATCH 08/12] gnu: home-services: Move shepherd to (gnu services).
(address . 50967@debbugs.gnu.org)(name . Oleg Pykhalov)(address . go.wigust@gmail.com)
20211002134603.6229-8-go.wigust@gmail.com
* gnu/home-services/shepherd.scm: Move content ...
* gnu/services/shepherd.scm: ... here.
* gnu/local.mk: Delete gnu/home-services/shepherd.scm.
* gnu/home-services/mcron.scm: Replace (gnu home-services shepherd) with
(gnu services shepherd).
* tests/guix-home.sh: Same.
---
gnu/home-services/mcron.scm | 2 +-
gnu/home-services/shepherd.scm | 134 ---------------------------------
gnu/local.mk | 1 -
gnu/services/shepherd.scm | 112 ++++++++++++++++++++++++++-
tests/guix-home.sh | 2 +-
5 files changed, 113 insertions(+), 138 deletions(-)
delete mode 100644 gnu/home-services/shepherd.scm

Toggle diff (322 lines)
diff --git a/gnu/home-services/mcron.scm b/gnu/home-services/mcron.scm
index fdfde179a5..a4e09f509c 100644
--- a/gnu/home-services/mcron.scm
+++ b/gnu/home-services/mcron.scm
@@ -20,7 +20,7 @@
(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 services shepherd)
#:use-module (guix records)
#:use-module (guix gexp)
diff --git a/gnu/home-services/shepherd.scm b/gnu/home-services/shepherd.scm
deleted file mode 100644
index 120cfde1a1..0000000000
--- a/gnu/home-services/shepherd.scm
+++ /dev/null
@@ -1,134 +0,0 @@
-;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2021 Andrew Tropin <andrew@trop.in>
-;;; Copyright © 2021 Xinglu Chen <public@yoctocell.xyz>
-;;;
-;;; 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 <http://www.gnu.org/licenses/>.
-
-(define-module (gnu home-services shepherd)
- #:use-module (gnu home-services)
- #:use-module (gnu packages admin)
- #:use-module (gnu services shepherd)
- #:use-module (guix sets)
- #:use-module (guix gexp)
- #:use-module (guix records)
-
- #:use-module (srfi srfi-1)
-
- #:export (home-shepherd-service-type
- home-shepherd-configuration)
- #:re-export (shepherd-service
- shepherd-action))
-
-(define-record-type* <home-shepherd-configuration>
- home-shepherd-configuration make-home-shepherd-configuration
- home-shepherd-configuration?
- (shepherd home-shepherd-configuration-shepherd
- (default shepherd)) ; package
- (auto-start? home-shepherd-configuration-auto-start?
- (default #t))
- (services home-shepherd-configuration-services
- (default '())))
-
-(define (home-shepherd-configuration-file services shepherd)
- "Return the shepherd configuration file for SERVICES. SHEPHERD is used
-as shepherd package."
- (assert-valid-graph services)
-
- (let ((files (map shepherd-service-file services))
- ;; TODO: Add compilation of services, it can improve start
- ;; time.
- ;; (scm->go (cute scm->go <> shepherd))
- )
- (define config
- #~(begin
- (use-modules (srfi srfi-34)
- (system repl error-handling))
- (apply
- register-services
- (map
- (lambda (file) (load file))
- '#$files))
- (action 'root 'daemonize)
- (format #t "Starting services...~%")
- (for-each
- (lambda (service) (start service))
- '#$(append-map shepherd-service-provision
- (filter shepherd-service-auto-start?
- services)))
- (newline)))
-
- (scheme-file "shepherd.conf" config)))
-
-(define (launch-shepherd-gexp config)
- (let* ((shepherd (home-shepherd-configuration-shepherd config))
- (services (home-shepherd-configuration-services config)))
- (if (home-shepherd-configuration-auto-start? config)
- (with-imported-modules '((guix build utils))
- #~(let ((log-dir (or (getenv "XDG_LOG_HOME")
- (format #f "~a/.local/var/log" (getenv "HOME")))))
- ((@ (guix build utils) mkdir-p) log-dir)
- (system*
- #$(file-append shepherd "/bin/shepherd")
- "--logfile"
- (string-append
- log-dir
- "/shepherd.log")
- "--config"
- #$(home-shepherd-configuration-file services shepherd))))
- #~"")))
-
-(define (reload-configuration-gexp config)
- (let* ((shepherd (home-shepherd-configuration-shepherd config))
- (services (home-shepherd-configuration-services config)))
- #~(system*
- #$(file-append shepherd "/bin/herd")
- "load" "root"
- #$(home-shepherd-configuration-file services shepherd))))
-
-(define (ensure-shepherd-gexp config)
- #~(if (file-exists?
- (string-append
- (or (getenv "XDG_RUNTIME_DIR")
- (format #f "/run/user/~a" (getuid)))
- "/shepherd/socket"))
- #$(reload-configuration-gexp config)
- #$(launch-shepherd-gexp config)))
-
-(define-public home-shepherd-service-type
- (service-type (name 'home-shepherd)
- (extensions
- (list (service-extension
- home-run-on-first-login-service-type
- launch-shepherd-gexp)
- (service-extension
- home-activation-service-type
- ensure-shepherd-gexp)
- (service-extension
- home-profile-service-type
- (lambda (config)
- `(,(home-shepherd-configuration-shepherd config))))))
- (compose concatenate)
- (extend
- (lambda (config extra-services)
- (home-shepherd-configuration
- (inherit config)
- (services
- (append (home-shepherd-configuration-services config)
- extra-services)))))
- (default-value (home-shepherd-configuration))
- (description "Configure and install userland Shepherd.")))
-
-
diff --git a/gnu/local.mk b/gnu/local.mk
index 97ff893bf7..fb60e6492e 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -75,7 +75,6 @@ GNU_SYSTEM_MODULES = \
%D%/ci.scm \
%D%/home.scm \
%D%/home-services.scm \
- %D%/home-services/shepherd.scm \
%D%/home-services/mcron.scm \
%D%/image.scm \
%D%/packages.scm \
diff --git a/gnu/services/shepherd.scm b/gnu/services/shepherd.scm
index 7277273686..46c80472dc 100644
--- a/gnu/services/shepherd.scm
+++ b/gnu/services/shepherd.scm
@@ -4,6 +4,8 @@
;;; Copyright © 2018 Carlo Zancanaro <carlo@zancanaro.id.au>
;;; Copyright © 2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
;;; Copyright © 2021 Maxime Devos <maximedevos@telenet.be>
+;;; Copyright © 2021 Andrew Tropin <andrew@trop.in>
+;;; Copyright © 2021 Xinglu Chen <public@yoctocell.xyz>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -28,6 +30,7 @@
#:use-module (guix records)
#:use-module (guix derivations) ;imported-modules, etc.
#:use-module (guix utils)
+ #:use-module (gnu home-services)
#:use-module (gnu services)
#:use-module (gnu services herd)
#:use-module (gnu packages admin)
@@ -75,7 +78,10 @@
user-processes-service-type
- assert-valid-graph))
+ assert-valid-graph
+
+ home-shepherd-service-type
+ home-shepherd-configuration))
;;; Commentary:
;;;
@@ -590,4 +596,108 @@ read-only, just before rebooting/halting. Processes still running after a few
seconds after @code{SIGTERM} has been sent are terminated with
@code{SIGKILL}.")))
+
+;;;
+;;; Home services
+;;;
+
+(define-record-type* <home-shepherd-configuration>
+ home-shepherd-configuration make-home-shepherd-configuration
+ home-shepherd-configuration?
+ (shepherd home-shepherd-configuration-shepherd
+ (default shepherd)) ; package
+ (auto-start? home-shepherd-configuration-auto-start?
+ (default #t))
+ (services home-shepherd-configuration-services
+ (default '())))
+
+(define (home-shepherd-configuration-file services shepherd)
+ "Return the shepherd configuration file for SERVICES. SHEPHERD is used
+as shepherd package."
+ (assert-valid-graph services)
+
+ (let ((files (map shepherd-service-file services))
+ ;; TODO: Add compilation of services, it can improve start
+ ;; time.
+ ;; (scm->go (cute scm->go <> shepherd))
+ )
+ (define config
+ #~(begin
+ (use-modules (srfi srfi-34)
+ (system repl error-handling))
+ (apply
+ register-services
+ (map
+ (lambda (file) (load file))
+ '#$files))
+ (action 'root 'daemonize)
+ (format #t "Starting services...~%")
+ (for-each
+ (lambda (service) (start service))
+ '#$(append-map shepherd-service-provision
+ (filter shepherd-service-auto-start?
+ services)))
+ (newline)))
+
+ (scheme-file "shepherd.conf" config)))
+
+(define (launch-shepherd-gexp config)
+ (let* ((shepherd (home-shepherd-configuration-shepherd config))
+ (services (home-shepherd-configuration-services config)))
+ (if (home-shepherd-configuration-auto-start? config)
+ (with-imported-modules '((guix build utils))
+ #~(let ((log-dir (or (getenv "XDG_LOG_HOME")
+ (format #f "~a/.local/var/log" (getenv "HOME")))))
+ ((@ (guix build utils) mkdir-p) log-dir)
+ (system*
+ #$(file-append shepherd "/bin/shepherd")
+ "--logfile"
+ (string-append
+ log-dir
+ "/shepherd.log")
+ "--config"
+ #$(home-shepherd-configuration-file services shepherd))))
+ #~"")))
+
+(define (reload-configuration-gexp config)
+ (let* ((shepherd (home-shepherd-configuration-shepherd config))
+ (services (home-shepherd-configuration-services config)))
+ #~(system*
+ #$(file-append shepherd "/bin/herd")
+ "load" "root"
+ #$(home-shepherd-configuration-file services shepherd))))
+
+(define (ensure-shepherd-gexp config)
+ #~(if (file-exists?
+ (string-append
+ (or (getenv "XDG_RUNTIME_DIR")
+ (format #f "/run/user/~a" (getuid)))
+ "/shepherd/socket"))
+ #$(reload-configuration-gexp config)
+ #$(launch-shepherd-gexp config)))
+
+(define-public home-shepherd-service-type
+ (service-type (name 'home-shepherd)
+ (extensions
+ (list (service-extension
+ home-run-on-first-login-service-type
+ launch-shepherd-gexp)
+ (service-extension
+ home-activation-service-type
+ ensure-shepherd-gexp)
+ (service-extension
+ home-profile-service-type
+ (lambda (config)
+ `(,(home-shepherd-configuration-shepherd config))))))
+ (compose concatenate)
+ (extend
+ (lambda (config extra-services)
+ (home-shepherd-configuration
+ (inherit config)
+ (services
+ (append (home-shepherd-configuration-services config)
+ extra-services)))))
+ (default-value (home-shepherd-configuration))
+ (description "Configure and install userland Shepherd.")))
+
;;; shepherd.scm ends here
diff --git a/tests/guix-home.sh b/tests/guix-home.sh
index cb015c907f..46cd779c81 100644
--- a/tests/guix-home.sh
+++ b/tests/guix-home.sh
@@ -75,7 +75,7 @@ fi
cat > "$tmpfile" <<EOF
(use-modules (gnu))
-(use-modules (gnu home-services shepherd))
+(use-modules (gnu services shepherd))
(home-environment
(services (list (service home-shepherd-service-type)
--
2.33.0
O
O
Oleg Pykhalov wrote on 2 Oct 2021 18:37
[PATCH 00/14] (gnu home services), file-like objects, guix home import documentation
(address . guix-patches@gnu.org)
20211002163716.29226-1-go.wigust@gmail.com
This patch series is a replacement for https://issues.guix.gnu.org/50967

* Moves every home service to (gnu home services).

* Adds support for file-like objects in configuration.scm, e.g. the following
will work now:

(home-environment
(services
(list
(service home-bash-service-type
(home-bash-configuration
(bashrc
(list
(local-file .bashrc))))))))

* Documents guix home import.

Andrew Tropin (1):
tests: Add tests for guix home cli.

Oleg Pykhalov (13):
gnu: home-services: Move configuration to (gnu home services).
gnu: home-services: Move symlink-manager to (gnu home services).
gnu: home-services: Move utils to (gnu home services).
gnu: home-services: Move fontutils to (gnu services).
gnu: home-services: Move shells to (gnu home services).
gnu: home-services: Move xdg to (gnu home services).
gnu: home-services: Move shepherd to (gnu home services).
gnu: home-services: Move mcron to (gnu home services).
scripts: home: (gnu home-services bash) -> (gnu home services bash).
doc: (gnu home-services) -> (gnu home services).
gnu: home-services: Update %service-type-path.
home: services: configuration: Support file-like objects.
doc: Document guix home import.

Makefile.am | 1 +
doc/guix.texi | 12 ++-
doc/he-config-bare-bones.scm | 2 +-
gnu/home-services.scm | 4 +-
gnu/home.scm | 8 +-
.../services}/configuration.scm | 16 ++-
.../services}/fontutils.scm | 2 +-
.../services}/mcron.scm | 4 +-
.../services}/shells.scm | 6 +-
.../services}/shepherd.scm | 2 +-
.../services}/symlink-manager.scm | 2 +-
.../services}/utils.scm | 2 +-
gnu/{home-services => home/services}/xdg.scm | 6 +-
gnu/local.mk | 16 +--
guix/scripts/home/import.scm | 10 +-
tests/guix-home.sh | 99 +++++++++++++++++++
16 files changed, 150 insertions(+), 42 deletions(-)
rename gnu/{home-services => home/services}/configuration.scm (86%)
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%)
create mode 100644 tests/guix-home.sh


base-commit: 159b94cfb526e8695ae159ae29edc608b7a29bef
--
2.33.0
Closed
O
O
Oleg Pykhalov wrote on 2 Oct 2021 18:38
[PATCH 01/14] tests: Add tests for guix home cli.
(address . 50967@debbugs.gnu.org)
20211002163834.29583-1-go.wigust@gmail.com
From: Andrew Tropin <andrew@trop.in>

* tests/guix-home.sh: New file.
* Makefile.am (SH_TESTS): Add tests/guix-home.sh.

Signed-off-by: Oleg Pykhalov <go.wigust@gmail.com>
---
Makefile.am | 1 +
tests/guix-home.sh | 99 ++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 100 insertions(+)
create mode 100644 tests/guix-home.sh

Toggle diff (119 lines)
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/tests/guix-home.sh b/tests/guix-home.sh
new file mode 100644
index 0000000000..cb015c907f
--- /dev/null
+++ b/tests/guix-home.sh
@@ -0,0 +1,99 @@
+# GNU Guix --- Functional package management for GNU
+# Copyright © 2021 Andrew Tropin <andrew@trop.in>
+#
+# 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 <http://www.gnu.org/licenses/>.
+
+#
+# Test 'guix home' cli.
+#
+
+set -e
+
+guix home --version
+
+tmpfile="t-guix-home-$$"
+errorfile="t-guix-home-error-$$"
+
+# Note: This directory is chosen outside $builddir so that relative file name
+# canonicalization doesn't mess up with 'current-source-directory', used by
+# 'local-file' ('load' forces 'relative' for
+# %FILE-PORT-NAME-CANONICALIZATION.)
+tmpdir="${TMPDIR:-/tmp}/t-guix-home-$$"
+mkdir "$tmpdir"
+
+trap 'rm -f "$tmpfile" "$errorfile" "$tmpdir"/*; rmdir "$tmpdir"' EXIT
+
+# Reporting of syntax errors.
+
+cat > "$tmpfile"<<EOF
+;; This is line 1, and the next one is line 2.
+ (home-environment
+ (packages))
+;; The 'T' is at column 3.
+EOF
+
+if guix home build "$tmpfile" 2> "$errorfile"
+then
+ # This must not succeed.
+ exit 1
+else
+ grep "$tmpfile:3:4: error: (packages): invalid field specifier" "$errorfile"
+fi
+
+
+cat > "$tmpfile"<<EOF
+;; This is line 1, and the next one is line 2.
+ (home-environment
+;; This is line 3, and there is no closing paren!
+EOF
+
+if guix home build "$tmpfile" 2> "$errorfile"
+then
+ # This must not succeed.
+ exit 1
+else
+ # Guile 3.0.6 gets line/column numbers for 'read-error' wrong
+ # (zero-indexed): <https://bugs.gnu.org/48089>.
+ grep "$tmpfile:4:1: missing closing paren" "$errorfile" || \
+ grep "$tmpfile:3:0: missing closing paren" "$errorfile"
+fi
+
+# Reporting of duplicate system service declaration.
+
+cat > "$tmpfile" <<EOF
+(use-modules (gnu))
+(use-modules (gnu home-services shepherd))
+
+(home-environment
+ (services (list (service home-shepherd-service-type)
+ (simple-service 'test-shepherd-extension
+ home-shepherd-service-type '())
+ (service home-shepherd-service-type)
+ (service home-shepherd-service-type))))
+EOF
+
+if guix home build "$tmpfile" 2> "$errorfile"
+then
+ # This must not succeed.
+ exit 1
+else
+ grep "guix home: error: more than one target service of type 'home-shepherd'" "$errorfile"
+fi
+
+# Searching.
+
+guix home search mcron | grep "^name: home-mcron"
+guix home search job manager | grep "^name: home-mcron"
--
2.33.0
O
O
Oleg Pykhalov wrote on 2 Oct 2021 18:38
[PATCH 02/14] gnu: home-services: Move configuration to (gnu home services).
(address . 50967@debbugs.gnu.org)(name . Oleg Pykhalov)(address . go.wigust@gmail.com)
20211002163834.29583-2-go.wigust@gmail.com
* 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/shells.scm | 2 +-
gnu/home-services/xdg.scm | 2 +-
gnu/{home-services => home/services}/configuration.scm | 2 +-
gnu/local.mk | 2 +-
4 files changed, 4 insertions(+), 4 deletions(-)
rename gnu/{home-services => home/services}/configuration.scm (98%)

Toggle diff (57 lines)
diff --git a/gnu/home-services/shells.scm b/gnu/home-services/shells.scm
index ecb02098f7..2be35ac56e 100644
--- a/gnu/home-services/shells.scm
+++ b/gnu/home-services/shells.scm
@@ -19,7 +19,7 @@
(define-module (gnu home-services shells)
#:use-module (gnu services configuration)
- #:use-module (gnu home-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 94275f3b65..07b25e9e12 100644
--- a/gnu/home-services/xdg.scm
+++ b/gnu/home-services/xdg.scm
@@ -19,7 +19,7 @@
(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)
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 <http://www.gnu.org/licenses/>.
-(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/local.mk b/gnu/local.mk
index d415b892e9..ac0b8947d5 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -77,7 +77,7 @@ 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/configuration.scm \
%D%/home-services/shells.scm \
%D%/home-services/shepherd.scm \
%D%/home-services/mcron.scm \
--
2.33.0
O
O
Oleg Pykhalov wrote on 2 Oct 2021 18:38
[PATCH 03/14] gnu: home-services: Move symlink-manager to (gnu home services).
(address . 50967@debbugs.gnu.org)(name . Oleg Pykhalov)(address . go.wigust@gmail.com)
20211002163834.29583-3-go.wigust@gmail.com
* 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.scm | 2 +-
gnu/{home-services => home/services}/symlink-manager.scm | 2 +-
gnu/local.mk | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
rename gnu/{home-services => home/services}/symlink-manager.scm (99%)

Toggle diff (44 lines)
diff --git a/gnu/home.scm b/gnu/home.scm
index f4c9359e25..c981c5aef9 100644
--- a/gnu/home.scm
+++ b/gnu/home.scm
@@ -18,7 +18,7 @@
(define-module (gnu home)
#:use-module (gnu home-services)
- #:use-module (gnu home-services symlink-manager)
+ #: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)
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 <http://www.gnu.org/licenses/>.
-(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/local.mk b/gnu/local.mk
index ac0b8947d5..29dd4ae5b5 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -75,7 +75,7 @@ GNU_SYSTEM_MODULES = \
%D%/ci.scm \
%D%/home.scm \
%D%/home-services.scm \
- %D%/home-services/symlink-manager.scm \
+ %D%/home/services/symlink-manager.scm \
%D%/home-services/fontutils.scm \
%D%/home/services/configuration.scm \
%D%/home-services/shells.scm \
--
2.33.0
O
O
Oleg Pykhalov wrote on 2 Oct 2021 18:38
[PATCH 04/14] gnu: home-services: Move utils to (gnu home services).
(address . 50967@debbugs.gnu.org)(name . Oleg Pykhalov)(address . go.wigust@gmail.com)
20211002163834.29583-4-go.wigust@gmail.com
* 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/shells.scm | 2 +-
gnu/home-services/xdg.scm | 2 +-
gnu/{home-services => home/services}/utils.scm | 2 +-
gnu/local.mk | 2 +-
4 files changed, 4 insertions(+), 4 deletions(-)
rename gnu/{home-services => home/services}/utils.scm (98%)

Toggle diff (57 lines)
diff --git a/gnu/home-services/shells.scm b/gnu/home-services/shells.scm
index 2be35ac56e..4939f86b2c 100644
--- a/gnu/home-services/shells.scm
+++ b/gnu/home-services/shells.scm
@@ -20,7 +20,7 @@
(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 utils)
#:use-module (gnu home-services)
#:use-module (gnu packages shells)
#:use-module (gnu packages bash)
diff --git a/gnu/home-services/xdg.scm b/gnu/home-services/xdg.scm
index 07b25e9e12..7f91da9ece 100644
--- a/gnu/home-services/xdg.scm
+++ b/gnu/home-services/xdg.scm
@@ -22,7 +22,7 @@
#: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/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 <http://www.gnu.org/licenses/>.
-(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/local.mk b/gnu/local.mk
index 29dd4ae5b5..729cfda100 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -81,7 +81,7 @@ GNU_SYSTEM_MODULES = \
%D%/home-services/shells.scm \
%D%/home-services/shepherd.scm \
%D%/home-services/mcron.scm \
- %D%/home-services/utils.scm \
+ %D%/home/services/utils.scm \
%D%/home-services/xdg.scm \
%D%/image.scm \
%D%/packages.scm \
--
2.33.0
O
O
Oleg Pykhalov wrote on 2 Oct 2021 18:38
[PATCH 05/14] gnu: home-services: Move fontutils to (gnu services).
(address . 50967@debbugs.gnu.org)(name . Oleg Pykhalov)(address . go.wigust@gmail.com)
20211002163834.29583-5-go.wigust@gmail.com
* 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.scm | 2 +-
gnu/{home-services => home/services}/fontutils.scm | 2 +-
gnu/local.mk | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
rename gnu/{home-services => home/services}/fontutils.scm (98%)

Toggle diff (44 lines)
diff --git a/gnu/home.scm b/gnu/home.scm
index c981c5aef9..5591d12704 100644
--- a/gnu/home.scm
+++ b/gnu/home.scm
@@ -21,7 +21,7 @@
#: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 fontutils)
#:use-module (gnu services)
#:use-module (guix records)
#:use-module (guix diagnostics)
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 <http://www.gnu.org/licenses/>.
-(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/local.mk b/gnu/local.mk
index 729cfda100..dbc4221937 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -76,7 +76,7 @@ GNU_SYSTEM_MODULES = \
%D%/home.scm \
%D%/home-services.scm \
%D%/home/services/symlink-manager.scm \
- %D%/home-services/fontutils.scm \
+ %D%/home/services/fontutils.scm \
%D%/home/services/configuration.scm \
%D%/home-services/shells.scm \
%D%/home-services/shepherd.scm \
--
2.33.0
O
O
Oleg Pykhalov wrote on 2 Oct 2021 18:38
[PATCH 06/14] gnu: home-services: Move shells to (gnu home services).
(address . 50967@debbugs.gnu.org)(name . Oleg Pykhalov)(address . go.wigust@gmail.com)
20211002163834.29583-6-go.wigust@gmail.com
* 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.
---
doc/he-config-bare-bones.scm | 2 +-
gnu/home.scm | 2 +-
gnu/{home-services => home/services}/shells.scm | 2 +-
gnu/local.mk | 2 +-
4 files changed, 4 insertions(+), 4 deletions(-)
rename gnu/{home-services => home/services}/shells.scm (99%)

Toggle diff (56 lines)
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.scm b/gnu/home.scm
index 5591d12704..c0d4c71d51 100644
--- a/gnu/home.scm
+++ b/gnu/home.scm
@@ -19,7 +19,7 @@
(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 shells)
#:use-module (gnu home-services xdg)
#:use-module (gnu home services fontutils)
#:use-module (gnu services)
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 4939f86b2c..2308371dd0 100644
--- a/gnu/home-services/shells.scm
+++ b/gnu/home/services/shells.scm
@@ -17,7 +17,7 @@
;;; You should have received a copy of the GNU General Public License
;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
-(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)
diff --git a/gnu/local.mk b/gnu/local.mk
index dbc4221937..2e48a70130 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -78,7 +78,7 @@ GNU_SYSTEM_MODULES = \
%D%/home/services/symlink-manager.scm \
%D%/home/services/fontutils.scm \
%D%/home/services/configuration.scm \
- %D%/home-services/shells.scm \
+ %D%/home/services/shells.scm \
%D%/home-services/shepherd.scm \
%D%/home-services/mcron.scm \
%D%/home/services/utils.scm \
--
2.33.0
O
O
Oleg Pykhalov wrote on 2 Oct 2021 18:38
[PATCH 07/14] gnu: home-services: Move xdg to (gnu home services).
(address . 50967@debbugs.gnu.org)(name . Oleg Pykhalov)(address . go.wigust@gmail.com)
20211002163834.29583-7-go.wigust@gmail.com
* 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.scm | 2 +-
gnu/{home-services => home/services}/xdg.scm | 2 +-
gnu/local.mk | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
rename gnu/{home-services => home/services}/xdg.scm (99%)

Toggle diff (44 lines)
diff --git a/gnu/home.scm b/gnu/home.scm
index c0d4c71d51..5ac382dc5a 100644
--- a/gnu/home.scm
+++ b/gnu/home.scm
@@ -20,7 +20,7 @@
#: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 xdg)
#:use-module (gnu home services fontutils)
#:use-module (gnu services)
#:use-module (guix records)
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 7f91da9ece..4aed9a5803 100644
--- a/gnu/home-services/xdg.scm
+++ b/gnu/home/services/xdg.scm
@@ -17,7 +17,7 @@
;;; You should have received a copy of the GNU General Public License
;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
-(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)
diff --git a/gnu/local.mk b/gnu/local.mk
index 2e48a70130..78ca4688e3 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -82,7 +82,7 @@ GNU_SYSTEM_MODULES = \
%D%/home-services/shepherd.scm \
%D%/home-services/mcron.scm \
%D%/home/services/utils.scm \
- %D%/home-services/xdg.scm \
+ %D%/home/services/xdg.scm \
%D%/image.scm \
%D%/packages.scm \
%D%/packages/abduco.scm \
--
2.33.0
O
O
Oleg Pykhalov wrote on 2 Oct 2021 18:38
[PATCH 08/14] gnu: home-services: Move shepherd to (gnu home services).
(address . 50967@debbugs.gnu.org)(name . Oleg Pykhalov)(address . go.wigust@gmail.com)
20211002163834.29583-8-go.wigust@gmail.com
* 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 | 2 +-
gnu/{home-services => home/services}/shepherd.scm | 2 +-
gnu/local.mk | 2 +-
tests/guix-home.sh | 2 +-
4 files changed, 4 insertions(+), 4 deletions(-)
rename gnu/{home-services => home/services}/shepherd.scm (99%)

Toggle diff (58 lines)
diff --git a/gnu/home-services/mcron.scm b/gnu/home-services/mcron.scm
index fdfde179a5..fb044351a9 100644
--- a/gnu/home-services/mcron.scm
+++ b/gnu/home-services/mcron.scm
@@ -20,8 +20,8 @@
(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/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 <http://www.gnu.org/licenses/>.
-(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/local.mk b/gnu/local.mk
index 78ca4688e3..5e3722a2d8 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -79,7 +79,7 @@ GNU_SYSTEM_MODULES = \
%D%/home/services/fontutils.scm \
%D%/home/services/configuration.scm \
%D%/home/services/shells.scm \
- %D%/home-services/shepherd.scm \
+ %D%/home/services/shepherd.scm \
%D%/home-services/mcron.scm \
%D%/home/services/utils.scm \
%D%/home/services/xdg.scm \
diff --git a/tests/guix-home.sh b/tests/guix-home.sh
index cb015c907f..86ba42bb8b 100644
--- a/tests/guix-home.sh
+++ b/tests/guix-home.sh
@@ -75,7 +75,7 @@ fi
cat > "$tmpfile" <<EOF
(use-modules (gnu))
-(use-modules (gnu home-services shepherd))
+(use-modules (gnu home services shepherd))
(home-environment
(services (list (service home-shepherd-service-type)
--
2.33.0
O
O
Oleg Pykhalov wrote on 2 Oct 2021 18:38
[PATCH 09/14] gnu: home-services: Move mcron to (gnu home services).
(address . 50967@debbugs.gnu.org)(name . Oleg Pykhalov)(address . go.wigust@gmail.com)
20211002163834.29583-9-go.wigust@gmail.com
* 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).
---
doc/guix.texi | 2 +-
gnu/{home-services => home/services}/mcron.scm | 2 +-
gnu/local.mk | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
rename gnu/{home-services => home/services}/mcron.scm (99%)

Toggle diff (44 lines)
diff --git a/doc/guix.texi b/doc/guix.texi
index a72a726b54..8edbcd4edf 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -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/gnu/home-services/mcron.scm b/gnu/home/services/mcron.scm
similarity index 99%
rename from gnu/home-services/mcron.scm
rename to gnu/home/services/mcron.scm
index fb044351a9..cc6faac47f 100644
--- a/gnu/home-services/mcron.scm
+++ b/gnu/home/services/mcron.scm
@@ -17,7 +17,7 @@
;;; You should have received a copy of the GNU General Public License
;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
-(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 services shepherd)
diff --git a/gnu/local.mk b/gnu/local.mk
index 5e3722a2d8..5e8b769ce9 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -80,7 +80,7 @@ GNU_SYSTEM_MODULES = \
%D%/home/services/configuration.scm \
%D%/home/services/shells.scm \
%D%/home/services/shepherd.scm \
- %D%/home-services/mcron.scm \
+ %D%/home/services/mcron.scm \
%D%/home/services/utils.scm \
%D%/home/services/xdg.scm \
%D%/image.scm \
--
2.33.0
O
O
Oleg Pykhalov wrote on 2 Oct 2021 18:38
[PATCH 10/14] scripts: home: (gnu home-services bash) -> (gnu home services bash).
(address . 50967@debbugs.gnu.org)(name . Oleg Pykhalov)(address . go.wigust@gmail.com)
20211002163834.29583-10-go.wigust@gmail.com
* guix/scripts/home/import.scm: Replace (gnu home-services bash) with
(gnu home services bash).
---
guix/scripts/home/import.scm | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

Toggle diff (15 lines)
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)
--
2.33.0
O
O
Oleg Pykhalov wrote on 2 Oct 2021 18:38
[PATCH 11/14] doc: (gnu home-services) -> (gnu home services).
(address . 50967@debbugs.gnu.org)(name . Oleg Pykhalov)(address . go.wigust@gmail.com)
20211002163834.29583-11-go.wigust@gmail.com
* doc/guix.texi: Replace (gnu home-services) with (gnu home services).
---
doc/guix.texi | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

Toggle diff (19 lines)
diff --git a/doc/guix.texi b/doc/guix.texi
index 8edbcd4edf..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
--
2.33.0
O
O
Oleg Pykhalov wrote on 2 Oct 2021 18:38
[PATCH 12/14] gnu: home-services: Update %service-type-path.
(address . 50967@debbugs.gnu.org)(name . Oleg Pykhalov)(address . go.wigust@gmail.com)
20211002163834.29583-12-go.wigust@gmail.com
* gnu/home-services.scm
(%service-type-path): Search home services in "gnu/services".
* gnu/home-services.scm: Update documentation string.
---
gnu/home-services.scm | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

Toggle diff (19 lines)
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)))
--
2.33.0
O
O
Oleg Pykhalov wrote on 2 Oct 2021 18:38
[PATCH 13/14] home: services: configuration: Support file-like objects.
(address . 50967@debbugs.gnu.org)(name . Oleg Pykhalov)(address . go.wigust@gmail.com)
20211002163834.29583-13-go.wigust@gmail.com
* gnu/home/services/configuration.scm (interpose): Include content of files.
(string-or-gexp?): Rename to 'file-or-string-or-gexp?' and check for file-like
object.
(serialize-string-or-gexp): Rename to 'serialize-file-or-string-or-gexp'.
(text-config?): Call 'file-or-string-or-gexp?' 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 | 14 ++++++++++----
guix/scripts/home/import.scm | 8 +++-----
2 files changed, 13 insertions(+), 9 deletions(-)

Toggle diff (61 lines)
diff --git a/gnu/home/services/configuration.scm b/gnu/home/services/configuration.scm
index 5e7743e7d6..39db7a5693 100644
--- a/gnu/home/services/configuration.scm
+++ b/gnu/home/services/configuration.scm
@@ -59,7 +59,12 @@ DELIMITER interposed LS. Support 'infix and 'suffix GRAMMAR values."
(G_ "The GRAMMAR value must be 'infix or 'suffix, but ~a provided.")
grammar)))
(fold-right (lambda (e acc)
- (cons e
+ (cons (if (file-like? e)
+ #~(begin
+ (use-modules (ice-9 rdelim))
+ (with-fluids ((%default-port-encoding "UTF-8"))
+ (with-input-from-file #$e read-string)))
+ e)
(if (and (null? acc) (eq? grammar 'infix))
acc
(cons delimiter acc))))
@@ -79,11 +84,12 @@ the list result in @code{#t} when applying PRED? on them."
(define alist? list?)
-(define (string-or-gexp? sg) (or (string? sg) (gexp? sg)))
-(define (serialize-string-or-gexp field-name val) "")
+(define (file-or-string-or-gexp? fsg)
+ (or (string? fsg) (gexp? fsg) (file-like? fsg)))
+(define (serialize-file-or-string-or-gexp field-name val) "")
(define (text-config? config)
- (and (list? config) (every string-or-gexp? config)))
+ (and (list? config) (every file-or-string-or-gexp? config)))
(define (serialize-text-config field-name val)
#~(string-append #$@(interpose val "\n" 'suffix)))
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))))
'()))))))
--
2.33.0
O
O
Oleg Pykhalov wrote on 2 Oct 2021 18:38
[PATCH 14/14] doc: Document guix home import.
(address . 50967@debbugs.gnu.org)(name . Oleg Pykhalov)(address . go.wigust@gmail.com)
20211002163834.29583-14-go.wigust@gmail.com
* doc/guix.texi (Invoking guix home): Document guix home import.
---
doc/guix.texi | 4 ++++
1 file changed, 4 insertions(+)

Toggle diff (17 lines)
diff --git a/doc/guix.texi b/doc/guix.texi
index d641935e0f..2f09f50629 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -36091,6 +36091,10 @@ generations that are up to 10 days old:
$ guix home list-generations 10d
@end example
+@item import
+Generate a Scheme code template that could be saved as a file and passed
+to @command{guix home reconfigure} command.
+
@end table
@node Documentation
--
2.33.0
O
O
Oleg Pykhalov wrote on 2 Oct 2021 18:51
control message for bug #50967
(address . control@debbugs.gnu.org)
87pmsn8j4n.fsf@gmail.com
reopen 50967
tags 50967 - fixed patch
quit
X
X
Xinglu Chen wrote on 2 Oct 2021 20:35
Re: [bug#50967] [PATCH 13/14] home: services: configuration: Support file-like objects.
(name . Oleg Pykhalov)(address . go.wigust@gmail.com)
87pmsnnukj.fsf@yoctocell.xyz
On Sat, Oct 02 2021, Oleg Pykhalov wrote:

Toggle quote (4 lines)
> * gnu/home/services/configuration.scm (interpose): Include content of files.
> (string-or-gexp?): Rename to 'file-or-string-or-gexp?' and check for file-like
> object.

I would call it ‘file-like-or-string-or-gexp?’, just ‘files’ doesn’t
really make it clear that it should be a “file-like object”.

Toggle quote (37 lines)
> (serialize-string-or-gexp): Rename to 'serialize-file-or-string-or-gexp'.
> (text-config?): Call 'file-or-string-or-gexp?' 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 | 14 ++++++++++----
> guix/scripts/home/import.scm | 8 +++-----
> 2 files changed, 13 insertions(+), 9 deletions(-)
>
> diff --git a/gnu/home/services/configuration.scm b/gnu/home/services/configuration.scm
> index 5e7743e7d6..39db7a5693 100644
> --- a/gnu/home/services/configuration.scm
> +++ b/gnu/home/services/configuration.scm
> @@ -59,7 +59,12 @@ DELIMITER interposed LS. Support 'infix and 'suffix GRAMMAR values."
> (G_ "The GRAMMAR value must be 'infix or 'suffix, but ~a provided.")
> grammar)))
> (fold-right (lambda (e acc)
> - (cons e
> + (cons (if (file-like? e)
> + #~(begin
> + (use-modules (ice-9 rdelim))
> + (with-fluids ((%default-port-encoding "UTF-8"))
> + (with-input-from-file #$e read-string)))
> + e)
> (if (and (null? acc) (eq? grammar 'infix))
> acc
> (cons delimiter acc))))
> @@ -79,11 +84,12 @@ the list result in @code{#t} when applying PRED? on them."
>
> (define alist? list?)
>
> -(define (string-or-gexp? sg) (or (string? sg) (gexp? sg)))
> -(define (serialize-string-or-gexp field-name val) "")
> +(define (file-or-string-or-gexp? fsg)
> + (or (string? fsg) (gexp? fsg) (file-like? fsg)))
> +(define (serialize-file-or-string-or-gexp field-name val) "")

This could defined as ‘empty-serializer’ from (gnu services
configuration).

Toggle quote (5 lines)
>
> (define (text-config? config)
> - (and (list? config) (every string-or-gexp? config)))
> + (and (list? config) (every file-or-string-or-gexp? config)))

‘text-config?’ could be defined as (list-of file-or-string-or-gexp?)

Toggle quote (30 lines)
> (define (serialize-text-config field-name val)
> #~(string-append #$@(interpose val "\n" 'suffix)))
>
> 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))))
> '()))))))
>
>
> --
> 2.33.0
-----BEGIN PGP SIGNATURE-----

iQJJBAEBCAAzFiEEAVhh4yyK5+SEykIzrPUJmaL7XHkFAmFYpnwVHHB1YmxpY0B5
b2N0b2NlbGwueHl6AAoJEKz1CZmi+1x56r4P/0E3sjdTwEFvKzLyUbKzrOiJ0oDS
hbIR60OeZvwObum5nTBtsgPuQSdyV5tM/owT3CTEPAF23OukIQfqNA4w4SiOa12f
QEDhw8rqQzis1DTowJ2/Tq0wWhTugJEmhJvZ9w3Nyg4cM8UT7GWYY9XVkluwKX3z
8OVITAkSzMh+sA3P+cTSoEjy6K4I/xNlnnbropn5SEwK+q95DlD5Uz0CBDhPTPPt
GOQuO2PRIQsMMKT4L/FTaieZql+7bedD4xCotuBsGgYDmfKasFm0z4P2B/vGDzb8
ef0byxg3NbdX8lrzt3g+MtwIRWXY7IJxmFdplGhNbASAKHSlb1alqdgYGW/2CWeT
c94QD77itFURRkI3S4nm5Ukeh+nNfSwM9tDY4koo905R/QgJvS2FQhJgnOuD+hqI
73VTuCTtTIxpPKMP6exhBd8wPCioFlW+CceTVljh+MHwGbVlgeqYDOKBTXXihDrO
UFxzGNoM0XG6xECA2z3ZBRplDd6az2XWxekYtEgWoCD6iYRPvHrm6CR12HkLKQZv
LN+uidEyT2aVa8G0wJ/MJlE+ff0S4ck4fh7Cwfn2KePAss07KOcLsybjEchpyCEQ
huj/IczfOS8Tcv7o1WMR0hL70cb2aV/3n5pkSNwAR4G18cbEmO01A3ABNLS1KXaU
neMyfiIH7o+2qZqY
=Y9dG
-----END PGP SIGNATURE-----

X
X
Xinglu Chen wrote on 2 Oct 2021 20:37
Re: [bug#50967] [PATCH 02/14] gnu: home-services: Move configuration to (gnu home services).
(name . Oleg Pykhalov)(address . go.wigust@gmail.com)
87lf3bnuh5.fsf@yoctocell.xyz
On Sat, Oct 02 2021, Oleg Pykhalov wrote:

Toggle quote (12 lines)
> * 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/shells.scm | 2 +-
> gnu/home-services/xdg.scm | 2 +-
> gnu/{home-services => home/services}/configuration.scm | 2 +-
> gnu/local.mk | 2 +-

I think it makes more sense to move (gnu home-services configuration) to
(gnu services configuration) since none of the things in (gnu
home-services configuration) seem specific to home services.
-----BEGIN PGP SIGNATURE-----

iQJJBAEBCAAzFiEEAVhh4yyK5+SEykIzrPUJmaL7XHkFAmFYpvcVHHB1YmxpY0B5
b2N0b2NlbGwueHl6AAoJEKz1CZmi+1x5h6UQALWMKRX/oxq3jsT5TDhNsTcxxmHa
KExsbv85+69dpGmMtadSH6yor7xhKnmu796q9PJtzejshOXLBdb0Ohnxrq5xGO+d
6Hsdb9VICuNhEcOpSGGaUWsrliahQCvet3RAiAWoNX5aTNcklVqce9MFVnW8rJzb
XcacCihqsIoqE/thzKts3ixoM5aDcagLP90DCsIinTBVELiq2NJEMz6D9M8MhVFl
D+uqhLGGjNhQHSRS5gIXKypAunCJPJHMI3BFUa54qOF6PAMwv5+vtA8fGSbhsKKB
M8q6JzXeMxw+7RZ1KKhPvnj9dvVdpWusGHyi5FLDeFpqIrcVmntLXzn8cwEwHohs
LWCK6LrZxjOcpFmjVpcC+1INYni5cwUbHA5bMS9Pfm+3MzJwyG0KFURa3JGxCIJM
Eub0oE7vjAeRcOi2QKaWPXeLrLz0OMJKU7hCIU3AtBKgqrYw8KrsILW7eGY15ESm
78ZX7OvyyHjdWGpwyFpSYqNFosGYDGmTP6I9or4ynMml7UZ/8iOR4d5xwy+cncaO
G3kspgBOYtgwPlmbramZBtMhg5Xyyi0zxDkpLtPyL7VlBOP1mmUbRYybC+ixPH14
pF324Sv2uWjLBN8k+3U+W/lNaKOC4/WaYUCMj4eb3J0rDtBzAYdr6fDVTQktWFWJ
+sV6HBfFGTssLYf1
=qspw
-----END PGP SIGNATURE-----

X
X
Xinglu Chen wrote on 2 Oct 2021 20:42
Re: [bug#50967] [PATCH 14/14] doc: Document guix home import.
(name . Oleg Pykhalov)(address . go.wigust@gmail.com)
87h7dznu9i.fsf@yoctocell.xyz
On Sat, Oct 02 2021, Oleg Pykhalov wrote:

Toggle quote (5 lines)
> * doc/guix.texi (Invoking guix home): Document guix home import.
> ---
> doc/guix.texi | 4 ++++
> 1 file changed, 4 insertions(+)

I sent a patch that documents ‘guix home import’ in a separate series
which also fixes some things about ‘guix home import’[1].

-----BEGIN PGP SIGNATURE-----

iQJJBAEBCAAzFiEEAVhh4yyK5+SEykIzrPUJmaL7XHkFAmFYqAkVHHB1YmxpY0B5
b2N0b2NlbGwueHl6AAoJEKz1CZmi+1x5B9sP/jXTVVz7SEJxY565uW03Q2XE5RAA
qHhUWrna/vF+kwC9qNm7sSQDcR1AdPtyQ0Ns9XjJyryNGXf99LjZWyYZuLWwcgo3
ARlEY8xKZ5PXb+n6L7c43KAmWatal1Bg4PL86ODdZKWVRg2xa91FmmfqNLgjAGoA
sPH0gmU6N1l2J70XtToGvrHg9xnaASPnG/Av2o4meEXAxSbqMkgtQFO4pj3cdwbN
1fd+sR8g+2Fqi68bsL5MQ2Szcd8diu6c7UONB4UEpqaQAIdsPmQNJ1Au5ouBc929
dAfxTH3qLuDSEl1gqhdfuApogtIbMYiCPvoFZqYD/0RqtZbRDmWLBKrgn3D62Ezp
TQr6QH8fwFFm2uBjqmU78JchL0nVO8v/8iN/zO1lUi69kC8NZ2CsZQBnn8M9+wye
BWi34OMxtwhG4UC8yNAV1NTzUasybNt5XV5KUM3rTgGwrTopxCmdJuvt3QXLDj+B
jTslnyK4fdREDbIkFN5iWQ3qWiYrnhb0pYHnFLs1Q5tJZ7n3uUqDb3zQPBNcA2w1
XYDDlHEyvwn2B7WNI32nRZOC1EHpKsHTjDjhH/ob7NQXpQw8URYYVwafWvxRkX2c
eElRg5uF41w9/2VlJCrOptbQjjYA324gWKbFp5bdx9hueowyEtQ1CPBJL7CdEEuV
DpR5yhmheY7kaall
=xDA0
-----END PGP SIGNATURE-----

O
O
Oleg Pykhalov wrote on 2 Oct 2021 22:13
[PATCH] home: services: configuration: Move and refactor content.
(address . 50967@debbugs.gnu.org)(name . Oleg Pykhalov)(address . go.wigust@gmail.com)
20211002201346.10568-1-go.wigust@gmail.com
* 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 | 115 ----------------------------
gnu/home/services/shells.scm | 1 -
gnu/home/services/xdg.scm | 1 -
gnu/local.mk | 1 -
gnu/services/configuration.scm | 95 ++++++++++++++++++++++-
5 files changed, 93 insertions(+), 120 deletions(-)
delete mode 100644 gnu/home/services/configuration.scm

Toggle diff (286 lines)
diff --git a/gnu/home/services/configuration.scm b/gnu/home/services/configuration.scm
deleted file mode 100644
index 39db7a5693..0000000000
--- a/gnu/home/services/configuration.scm
+++ /dev/null
@@ -1,115 +0,0 @@
-;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2021 Andrew Tropin <andrew@trop.in>
-;;; Copyright © 2021 Xinglu Chen <public@yoctocell.xyz>
-;;;
-;;; 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 <http://www.gnu.org/licenses/>.
-
-(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 (if (file-like? e)
- #~(begin
- (use-modules (ice-9 rdelim))
- (with-fluids ((%default-port-encoding "UTF-8"))
- (with-input-from-file #$e read-string)))
- 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 (file-or-string-or-gexp? fsg)
- (or (string? fsg) (gexp? fsg) (file-like? fsg)))
-(define (serialize-file-or-string-or-gexp field-name val) "")
-
-(define (text-config? config)
- (and (list? config) (every file-or-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..1829dbd2bf 100644
--- a/gnu/services/configuration.scm
+++ b/gnu/services/configuration.scm
@@ -4,6 +4,7 @@
;;; Copyright © 2017, 2018 Clément Lassieur <clement@lassieur.org>
;;; Copyright © 2021 Xinglu Chen <public@yoctocell.xyz>
;;; Copyright © 2021 Maxim Cournoyer <maxim.cournoyer@gmail.com>
+;;; Copyright © 2021 Andrew Tropin <andrew@trop.in>
;;;
;;; 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,21 @@
generate-documentation
configuration->documentation
empty-serializer
- serialize-package))
+ serialize-package
+
+ 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))
;;; Commentary:
;;;
@@ -323,3 +340,77 @@ 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 (if (file-like? e)
+ #~(begin
+ (use-modules (ice-9 rdelim))
+ (with-fluids ((%default-port-encoding "UTF-8"))
+ (with-input-from-file #$e read-string)))
+ 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 (file-like-or-string-or-gexp? fsg)
+ (or (string? fsg) (gexp? fsg) (file-like? fsg)))
+(define serialize-file-like-or-string-or-gexp empty-serializer)
+
+(define (text-config? config)
+ (list-of file-like-or-string-or-gexp?))
+(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)))
--
2.33.0
O
O
Oleg Pykhalov wrote on 2 Oct 2021 21:45
Re: [bug#50967] [PATCH 14/14] doc: Document guix home import.
(name . Xinglu Chen)(address . public@yoctocell.xyz)(address . 50967@debbugs.gnu.org)
87fstj8b2s.fsf@gmail.com
Xinglu Chen <public@yoctocell.xyz> writes:

Toggle quote (12 lines)
> On Sat, Oct 02 2021, Oleg Pykhalov wrote:
>
>> * doc/guix.texi (Invoking guix home): Document guix home import.
>> ---
>> doc/guix.texi | 4 ++++
>> 1 file changed, 4 insertions(+)
>
> I sent a patch that documents ‘guix home import’ in a separate series
> which also fixes some things about ‘guix home import’[1].
>
> [1]: <https://issues.guix.gnu.org/50873>

OK, then I just remove my commit.
-----BEGIN PGP SIGNATURE-----

iQJIBAEBCgAyFiEEcjhxI46s62NFSFhXFn+OpQAa+pwFAmFYtusUHGdvLndpZ3Vz
dEBnbWFpbC5jb20ACgkQFn+OpQAa+py5Mg/+MIc3n4cGWpKsO6Whl2pM/PnfVWr6
wKPkWEwKiemTfG6l4yLa2oefJcJue/ROYT74FBHxkU7IEnwDvpaii0CxQ9CaY5ZB
Yf06AXWkS5BidGQ0KuPUJ1zAl0Bi5uNznhfnpCb3zFLypmsDiVMH5HjfFJ4sVCo1
OuZhwyr5iA6UpIpBrypCLp9z2oKOeeuYf28TlHxBYXEgds4wzzF7uMfaJhsoCJoI
JI9/+8YWb1E2gvjhQ88hu4i8Q3S/kHIOWyc3XlJQq9QGsHFmrt/vXcLqsdQ6YZHu
Dx+BSCgX2QGrhk+c5wxtE7zQPjPNQ7FePigwLBVgIkhx+9lzL3ELkeA7MXnflVnI
wiR8Hp6KtLfqvy6QHfDTCQ/fi1LYzxi1uq3O2yOY7Hetkc3KlBgZPt+wLDU9bZ/h
Oy9ApJpkbObPFdxF95aF9YLgdFtMIw4zSrJoBZRCnQ5CT5Ln2a6htTbnThH3SWiS
EOK29noAzUOd8V1p7JP7eKpcptyJ1y27b0R/AHSi2Ec26+qNGYDtyTAxftxQJmjD
u4SITAiMmo2ytXrZ129na6O47eGnYER44ll7FuYZxW6nERkQrPnaKK8xbLKnmHWL
wKeeYpD+2CO7zKRAyZjwf6UJfAZph8Asff9p5AYt0uOqyn9iIdKhdMtIBJtLzPvY
mHblKICaIu8i9rY=
=uIAU
-----END PGP SIGNATURE-----

L
L
Ludovic Courtès wrote on 4 Oct 2021 15:58
Re: bug#50967: [PATCH 00/12] Move (gnu home-services XYZ) to (gnu services XYZ)
(name . Oleg Pykhalov)(address . go.wigust@gmail.com)
87h7dwq4cb.fsf_-_@gnu.org
Hi Oleg,

Oleg Pykhalov <go.wigust@gmail.com> skribis:

Toggle quote (7 lines)
> From: Andrew Tropin <andrew@trop.in>
>
> * tests/guix-home.sh: New file.
> * Makefile.am (SH_TESTS): Add tests/guix-home.sh.
>
> Signed-off-by: Oleg Pykhalov <go.wigust@gmail.com>

[...]

Toggle quote (9 lines)
> +# Reporting of syntax errors.
> +
> +cat > "$tmpfile"<<EOF
> +;; This is line 1, and the next one is line 2.
> + (home-environment
> + (packages))
> +;; The 'T' is at column 3.
> +EOF

This test is more or less copied from guix-system.sh, and I think it’s
not that useful because it’s testing the exact same functionality.

Would it be possible to have a CLI test that really tests ‘guix home’
functionality?

The difficulty is that this would tend to rebuild the world. This can
be worked around in one of two ways:

1. Add a ‘--bootstrap’ flag for force the use of the “guile-bootstrap”
package instead of “guile”, for instance, as is done for
tests/guix-package.sh.

2. Run tests only when a “real” daemon is available, using it instead
of the test daemon, as is done in tests/guix-pack-relocatable.sh.

3. Run tests in a VM using the (gnu tests …) infrastructure.

I don’t think #1 would work well for Guix Home. #2 is the easiest; the
downside is that tests would only be run on developer machines, not in
CI. #3 is the most flexible approach, but the downside is that it’s
more resource-intensive (needs to build a VM image, etc.).

Overall, I’d recommend starting with #2 and eventually add tests as #3,
as far as integration tests are concerned.

Then again, it’s also possible to have focused unit tests for specific
pieces, just like we have tests/union.scm for instance.

WDYT?

Thanks,
Ludo’.
L
L
Ludovic Courtès wrote on 4 Oct 2021 16:01
(name . Oleg Pykhalov)(address . go.wigust@gmail.com)(address . 50967@debbugs.gnu.org)
87czokq47b.fsf_-_@gnu.org
Oleg Pykhalov <go.wigust@gmail.com> skribis:

Toggle quote (19 lines)
> * gnu/home-services.scm
> (%service-type-path): Search home services in "gnu/services".
> * gnu/home-services.scm: Update documentation string.
> ---
> gnu/home-services.scm | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> 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"))))
>

I think it would make more sense to squeeze patches 2 to 12 (inclusive)
as a single patch. That way, both the previous and the next commit
would be in working state, which may not be the case when we rename
things one by one (for example, renamed service modules won’t be
discovered until the hunk above is applied.)

Otherwise LGTM, thanks!

Ludo’.
L
L
Ludovic Courtès wrote on 4 Oct 2021 16:04
(name . Xinglu Chen)(address . public@yoctocell.xyz)
878rz8q42z.fsf_-_@gnu.org
Xinglu Chen <public@yoctocell.xyz> skribis:

Toggle quote (9 lines)
> On Sat, Oct 02 2021, Oleg Pykhalov wrote:
>
>> * gnu/home/services/configuration.scm (interpose): Include content of files.
>> (string-or-gexp?): Rename to 'file-or-string-or-gexp?' and check for file-like
>> object.
>
> I would call it ‘file-like-or-string-or-gexp?’, just ‘files’ doesn’t
> really make it clear that it should be a “file-like object”.

As a matter of API, I would make it monomorphic: accept a file-like
object, period. This is what’s done for System services (and
polymorphic APIs are rare in general in Guix).

‘plain-file’ and ‘scheme-file’ allow users to “convert” a string or a
gexp into a file-like object.

WDYT?

Ludo’.
O
O
Oleg Pykhalov wrote on 5 Oct 2021 01:13
[PATCH 2/3] home: services: configuration: Support file-like objects.
(address . 50967@debbugs.gnu.org)
20211004231331.5269-2-go.wigust@gmail.com
* 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

Toggle diff (300 lines)
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 <andrew@trop.in>
-;;; Copyright © 2021 Xinglu Chen <public@yoctocell.xyz>
-;;;
-;;; 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 <http://www.gnu.org/licenses/>.
-
-(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 <clement@lassieur.org>
;;; Copyright © 2021 Xinglu Chen <public@yoctocell.xyz>
;;; Copyright © 2021 Maxim Cournoyer <maxim.cournoyer@gmail.com>
+;;; Copyright © 2021 Andrew Tropin <andrew@trop.in>
;;;
;;; 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))))
'()))))))
--
2.33.0
O
O
Oleg Pykhalov wrote on 5 Oct 2021 01:13
[PATCH 1/3] gnu: Move (gnu home-services) to (gnu home services).
(address . 50967@debbugs.gnu.org)
20211004231331.5269-1-go.wigust@gmail.com
* 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%)

Toggle diff (261 lines)
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 <http://www.gnu.org/licenses/>.
-(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 <http://www.gnu.org/licenses/>.
-(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 <http://www.gnu.org/licenses/>.
-(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 <http://www.gnu.org/licenses/>.
-(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 <http://www.gnu.org/licenses/>.
-(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 <http://www.gnu.org/licenses/>.
-(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 <http://www.gnu.org/licenses/>.
-(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 <http://www.gnu.org/licenses/>.
-(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)
--
2.33.0
O
O
Oleg Pykhalov wrote on 5 Oct 2021 01:13
[PATCH 3/3] guix: scripts: Make sure profile directory exists.
(address . 50967@debbugs.gnu.org)
20211004231331.5269-3-go.wigust@gmail.com
* 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

Toggle diff (113 lines)
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 <andrew@trop.in>
;;; Copyright © 2021 Xinglu Chen <public@yoctocell.xyz>
+;;; Copyright © 2021 Oleg Pykhalov <go.wigust@gmail.com>
;;;
;;; 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 <go.wigust@gmail.com>
+#
+# 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 <http://www.gnu.org/licenses/>.
+
+#
+# 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"
--
2.33.0
O
O
Oleg Pykhalov wrote on 5 Oct 2021 12:20
(address . 50967@debbugs.gnu.org)
87v92bixhr.fsf@gmail.com
Oleg Pykhalov <go.wigust@gmail.com> writes:

Toggle quote (54 lines)
> * 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 <andrew@trop.in>
> ;;; Copyright © 2021 Xinglu Chen <public@yoctocell.xyz>
> +;;; Copyright © 2021 Oleg Pykhalov <go.wigust@gmail.com>
> ;;;
> ;;; 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 <go.wigust@gmail.com>
> +#

[…]

Well, guix home reconfigure will break your ~/.bashrc. Sorry.

Don't use this "test".
-----BEGIN PGP SIGNATURE-----

iQJIBAEBCgAyFiEEcjhxI46s62NFSFhXFn+OpQAa+pwFAmFcJvAUHGdvLndpZ3Vz
dEBnbWFpbC5jb20ACgkQFn+OpQAa+pzZGg/9FxJRXgCH8BvRG0EHpGCfi28wXqrD
PxrrF8w3WLQ6wCSy86ord1Mn/I7zQ+KaXw3MeX7Z6rFfE5yPf9U1xuUdiv0wY1FA
Ms9PGvumiBhDR1iw/a8qtOjPoeFETQZyZW+tHJ1p6bSfvWQwWRrirHO6fCDtOjl3
naktFqbh1SEtLNYq6Pt1Ze5H7S5txA4c7gYwP9aJWg5FA9HspRv0UyVv0B4h6c41
kE/IUCoXF1XFazNpR/GPciajNXPmddIuOlF8ZXNOgUzorYrNCt/jC0knd4NsaI91
cA3O5G7I5WDXQcbFdi7O4xaOnZEPXo4FKUEkanJ/kd7mdq/r3EP1U9jdAp2vkUU3
+AkwNWLd7sBwdT2xu5OGPEKPXxZjPfyqBQOtkDpA2Ib5/oBjAQHjU4btKNSzr0+J
kJXGo6N9kpGdJ3AYGsKl3bcH2j8xBhGGR8sWVmc6ZEA2XGCXoGXZ5vY6u9u67FZM
xnECiIAMdHkX06fRYtr7vEhiagrEhkgG/myfui3l7NSGX6e4ziPPM7AtpChzpMDO
vQEyBz+hDptCoZxE4DBrFvcOvWBonrYJSvLQLkudHnQRfM7fc4o1Zom90U/o7kl4
lqlCV2g4TDzPxUb+fYIJxh/ShU3Uj0aSJhvXfgMvfS6iIvbjbSnVc3oEqm4wqubJ
QakheHRr28JsBRA=
=TGuH
-----END PGP SIGNATURE-----

A
A
Andrew Tropin wrote on 6 Oct 2021 10:15
[bug#50967] file-like objects instead of gexps
87czoilgbg.fsf@trop.in
On 2021-10-04 16:04, Ludovic Courtès wrote:

Toggle quote (15 lines)
> Xinglu Chen <public@yoctocell.xyz> skribis:
>
>> On Sat, Oct 02 2021, Oleg Pykhalov wrote:
>>
>>> * gnu/home/services/configuration.scm (interpose): Include content of files.
>>> (string-or-gexp?): Rename to 'file-or-string-or-gexp?' and check for file-like
>>> object.
>>
>> I would call it ‘file-like-or-string-or-gexp?’, just ‘files’ doesn’t
>> really make it clear that it should be a “file-like object”.
>
> As a matter of API, I would make it monomorphic: accept a file-like
> object, period. This is what’s done for System services (and
> polymorphic APIs are rare in general in Guix).

At least some of system services are far from ideal, recently I tried to
add rtmp section to nginx configuration using nginx system service. I
had two options and both does look hacky, I could use extra-content
starting with closing curly bracket:

Toggle snippet (36 lines)
(service nginx-service-type
(nginx-configuration
(modules
(list
(file-append nginx-rtmp-module "\
/etc/nginx/modules/ngx_rtmp_module.so")))
(extra-content
(format #f "\
}
rtmp {
server {
listen 1935;
chunk_size 4096;

application live {
live on;
record off;
push rtmp://a.rtmp.youtube.com/live2/~a;
push rtmp://diode.zone:1935/live/~a;
}
}
" youtube-key peertube-key))

(server-blocks
(list (nginx-server-configuration
;; (locations
;; (list
;; (nginx-location-configuration
;; (uri "/stat")
;; (body '("rtmp_stat all;"
;; "rtmp_stat_stylesheet stat.xsl;")))))
(server-name `(,ip))
(listen '("8088"))
(root "/var/www/"))))))

or use file field of nginx-configuration record and generate the whole
configuration myself inside computed-file, loosing all the benifits of
other nginx-configuration fields.

Personally, I don't find both of these approaches appealing and
convenient. Maybe it's an issue of exact system service, but the way
the configuration for this service is implemented is getting in the way
of the user.

Toggle quote (11 lines)
>
> ‘plain-file’ and ‘scheme-file’ allow users to “convert” a string or a
> gexp into a file-like object.
>
> WDYT?
>
> Ludo’.
>
>
>

Imagine the following use case: I want to create a home service, which
accepts a package (zsh plugin) and adds a code for loading this package
to zshrc, currently it's implemented like that:


Exteding the service above with `(list zsh-autosuggestions)` will add
the following line to zshrc:

source /gnu/store/w7d43gk1qszplj9i0rkzqvzz6kp88qfm-zsh-autosuggestions-0.7.0/share/zsh/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh

Or the same thing can be done manually by user:

Toggle snippet (11 lines)
(service
home-zsh-service-type
(home-zsh-configuration
(zshrc
(list
#~(string-append "source " #$zsh-autosuggestions "/share/zs../..ions.zsh")
;; or
"source \\"
(file-append zsh-autosuggestions "/share/zs../..ions.zsh")))))

gexps returns a string, file-like object returns a path to the file in
the store, kinda expected behavior. Both implementations looks quite
simple.


Now I'll try to reimplement it with file-like objects. The code below
is a pseudo code, but should demonstrate the overall concerns I have:

Toggle snippet (42 lines)
;; Some generic functions
(define get-file-like-object-path (file-like)
"Because all file-like object get inserted literally by home services,
we need a function, which returns a file, which contains a path to the
file."
(computed-file
"tmp-file"
#~#$file-like))

(define fl-append-strings (lst)
"Accepts a list of strings and file-like object, reads the content of
the file-like objects (to be consistent with behavior of home services
configuration)."
(define file-like->str (mb-file-like)
(if (string? mb-file-like)
mb-file-like
#~(begin
(use-modules (ice-9 rdelim))
(with-fluids ((%default-port-encoding "UTF-8"))
(with-input-from-file #$mb-file-like read-string)))))
(computed-file
"tmp-file"
#~(apply string-append '#$(map file-like->str lst))))


;; A home service, declared in home-environment.
(service
home-zsh-service-type
(home-zsh-configuration
(zshrc
(list
(fl-append-strings
(list
"source "
(get-file-like-object-path zsh-autosuggestions)
"/share/zs../..ions.zsh"))
;; or
"source \\"
(get-file-like-object-path
(file-append zsh-autosuggestions "/share/zs../..ions.zsh"))))))

Here we don't use gexps inside configuration and all file-like objects
are "expanded" as their content instead of path in the store.

It can work, but looks a little strange and hard to copmose. Perhaps, I
miss something and doesn't see the whole picture, but for now expanding
file-like objects to their content and throwing out gexps doesn't look
appealing to me.

BTW, I've skimmed through the paper "Code Staging in GNU Guix" and
limitations section, still not sure what your concerns are, I'll try to
re-read the paper and your message <87pmvqckws.fsf@gnu.org> one more
time a few days later to better understand it. If you have a spare
time, please make a simple code snippet, which demonstrates the problem
you've mentioned in the message, which will hit the users of home
services. It will help me to figure out possible shortcommings and
better understand the problem.

Ludovic, sorry for spending your time on that, but I really need to
understand this thing better. Thank you in advance for hepling on that.

Oleg, thank you for working on this patch series, much appreciate)


--
Best regards,
Andrew Tropin
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCgAdFiEEKEGaxlA4dEDH6S/6IgjSCVjB3rAFAmFdWyQACgkQIgjSCVjB
3rCm3xAAjsd63c+cTwumpE1H48QV4JifrjD25yU3p+Bal5h8KVW03eQBdz6eeSjD
Bd1ukegCB+1Om0GEhd0W0i3mm6UF5xEj+neBAZLXyopqDIKd4HaQG/mR+3SNg99M
nDP2VeTwSAZQb8WoLwl28eX6wTuAkXWBeGPA77icRcHmo9ItT6criYe3cgFjk0Ki
TyhUKzHhmICJtziBLyglj6JiXapkJfK6DPk+7qCWCPxzXsbr8kL2fcOlgxKT+oAI
PkR98VIO7xsrssOclKSAo1uYfskZQTBSMXt7+Xv2zfEdZRP1UWw98dPCN3lHCOJy
OMK6VRLNdlN6pCl9DjxnF+a3RJaNgjBJLABZxHISdl/vm89OTWSs9IIYKza7NW/4
UbhwTg0zUwjn0W1H+DZqVG6GWlOHqcEnSoeUPJ8v/5mLM0CROCPeAEJB/3lnwIUn
+SYHnLHXEMqz+caHCYDYC0fQ/kfxU7JEES+UzJ57Y+N0x0aANbvvjdQoL+Pv/GeD
daaopcnZByhFEvsmOBy/D2tjgiUNUzLzir6rje6izx3NsWoKhP0Mj0/LRU3rHBZk
BS6Stk8oykX8GsDlgUC+XnV+1oJmW2+Qc7Y7SjqzHza65HFH/ynyPsKnj6IjxarL
0lUG3CvKQVsJ+i+5Ix4fMzr/JQDKz/y10Gv9jois7QeFGdoOONs=
=cA22
-----END PGP SIGNATURE-----

L
L
Ludovic Courtès wrote on 6 Oct 2021 23:22
Re: bug#50967: [PATCH 00/12] Move (gnu home-services XYZ) to (gnu services XYZ)
(name . Oleg Pykhalov)(address . go.wigust@gmail.com)
87pmshhmrg.fsf_-_@gnu.org
Hi,

Oleg Pykhalov <go.wigust@gmail.com> skribis:

Toggle quote (2 lines)
> Well, guix home reconfigure will break your ~/.bashrc. Sorry.

Ah, thanks for letting us know. :-)

Perhaps you need to set HOME before, or is there another way you could
achieve that?

Thanks,
Ludo’.
O
O
Oleg Pykhalov wrote on 7 Oct 2021 00:05
Re: [PATCH 3/3] guix: scripts: Make sure profile directory exists.
(address . 50967@debbugs.gnu.org)
878rz54xmy.fsf@gmail.com
This patch fixes user's files corruption. Also, I applied suggestions
about commit message, thanks zimoun!
From eec2ab5f514ec6e156244898f8a635baf323ab70 Mon Sep 17 00:00:00 2001
From: Oleg Pykhalov <go.wigust@gmail.com>
Date: Tue, 5 Oct 2021 02:10:25 +0300
Subject: [PATCH] scripts: home: Make sure profile directory exists.

* 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 | 86 +++++++++++++++++++++++++++++++++++++++++++
3 files changed, 89 insertions(+)
create mode 100644 tests/guix-home.sh

Toggle diff (126 lines)
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 <andrew@trop.in>
;;; Copyright © 2021 Xinglu Chen <public@yoctocell.xyz>
+;;; Copyright © 2021 Oleg Pykhalov <go.wigust@gmail.com>
;;;
;;; 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..96cbd12857
--- /dev/null
+++ b/tests/guix-home.sh
@@ -0,0 +1,86 @@
+#!/usr/bin/env bash
+
+# GNU Guix --- Functional package management for GNU
+# Copyright © 2021 Oleg Pykhalov <go.wigust@gmail.com>
+#
+# 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 <http://www.gnu.org/licenses/>.
+
+#
+# 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
+
+run_guix_home_without_home()
+{
+ (
+ # Save current directory (Guix source directory) for later mount
+ test_directory="$(mktemp -d)"
+ trap 'umount $test_directory; rmdir $test_directory' EXIT
+ mount --bind "$PWD" "$test_directory"
+
+ # Make $HOME directory empty to preserve user's files
+ mount --types tmpfs none "$HOME"
+
+ # Mount Guix source directory in a clean environment
+ mkdir -p "$PWD"
+ mount --bind "$test_directory" "$PWD"
+ cd "$PWD" || 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"
+ )
+}
+export -f run_guix_home_without_home
+
+unshare -mrf bash -c "run_guix_home_without_home"
--
2.33.0
-----BEGIN PGP SIGNATURE-----

iQJIBAEBCgAyFiEEcjhxI46s62NFSFhXFn+OpQAa+pwFAmFeHbUUHGdvLndpZ3Vz
dEBnbWFpbC5jb20ACgkQFn+OpQAa+pzcVw/9GatHpe40Jvzj1r2DWlgM+iNFyMOH
GIZb4l5nMgG0BvhaJ3jwgiAz5xuDMaUW0YVDi7fvJA1p1PQfFHcTc53N5ekh+hml
dY/Qfd6ABDtZElqzihbC/vBvHBYriH+HfCX8TaXUsFxjltu+MegOWeSC1kKW896Y
TRuiaBGcp0WukGf1IAN/TQHmPDndIqpSuInPhdeDRM6ZJGNDRagYMyIXf7Ysw/iX
49+RF3HN78S8kmQvPsUDFl7Jt/ga9Gv3KCWaf2iD27+ZakohZg01tzKLDqTu1BI1
5lz38QifwDrYj3IhTMy6mWnF3SHXPeWsAgfK/h5b+l8GZPHD7H2kNGO8+1nArJ3k
nQxkbKP6J1ar4WBQ29cUGRrto1JbI82CS00iPRtprApr3aRFkeu9cWZsnN+Z+a4c
/rimbBPVOw7W52jGCsXO2YG/f0oLjFsW0oQPEDOT/AxGyOqi6vMNfBmETwpLthfQ
V75S5/NwYm3l7UgaOOgZEDihRdFUx6x577W4iquATY2LItuyL4ok6BztpbQU4hrf
Sd+KpmOMawsfSWDYekGJXZNV096/s7A+8hNS8mN5DfQsMW49PI9wClJoIOJeYxSD
06F7NzDD5tQ9dkLhrNLJZrvCxR8yDd6WgIFMkh0defOsKA6lUFVNp4+zHvNaYZG3
x7YuYcv9N9BV5Rk=
=mzI0
-----END PGP SIGNATURE-----

O
O
Oleg Pykhalov wrote on 7 Oct 2021 00:15
Re: bug#50967: [PATCH 00/12] Move (gnu home-services XYZ) to (gnu services XYZ)
(address . 50967@debbugs.gnu.org)
871r4x4x6e.fsf_-_@gmail.com
Oleg Pykhalov <go.wigust@gmail.com> writes:

Toggle quote (3 lines)
> This patch fixes user's files corruption. Also, I applied suggestions
> about commit message, thanks zimoun!

Also, in addion I forget to:

Replace '#!/usr/bin/env bash' with '#!/bin/bash'

Maybe a /bin/sh would be more Guix friendly, but shellcheck warns about
export -f does not exist in posix shell. Thoughts are welcome ;-)


Remove a unnecessary subshell in run_guix_home_without_home.
From 6351e3f099d3c09143c5f0289216d52ee45664d9 Mon Sep 17 00:00:00 2001
From: Oleg Pykhalov <go.wigust@gmail.com>
Date: Tue, 5 Oct 2021 02:10:25 +0300
Subject: [PATCH] scripts: home: Make sure profile directory exists.

* 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 | 84 +++++++++++++++++++++++++++++++++++++++++++
3 files changed, 87 insertions(+)
create mode 100644 tests/guix-home.sh

Toggle diff (124 lines)
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 <andrew@trop.in>
;;; Copyright © 2021 Xinglu Chen <public@yoctocell.xyz>
+;;; Copyright © 2021 Oleg Pykhalov <go.wigust@gmail.com>
;;;
;;; 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..b0b85737b0
--- /dev/null
+++ b/tests/guix-home.sh
@@ -0,0 +1,84 @@
+#!/bin/bash
+
+# GNU Guix --- Functional package management for GNU
+# Copyright © 2021 Oleg Pykhalov <go.wigust@gmail.com>
+#
+# 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 <http://www.gnu.org/licenses/>.
+
+#
+# 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
+
+run_guix_home_without_home()
+{
+ # Save current directory (Guix source directory) for later mount
+ test_directory="$(mktemp -d)"
+ trap 'umount $test_directory; rmdir $test_directory' EXIT
+ mount --bind "$PWD" "$test_directory"
+
+ # Make $HOME directory empty to preserve user's files
+ mount --types tmpfs none "$HOME"
+
+ # Mount Guix source directory in a clean environment
+ mkdir -p "$PWD"
+ mount --bind "$test_directory" "$PWD"
+ cd "$PWD" || 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"
+}
+export -f run_guix_home_without_home
+
+unshare --mount --map-root-user --fork sh -c "run_guix_home_without_home"
--
2.33.0
-----BEGIN PGP SIGNATURE-----

iQJIBAEBCgAyFiEEcjhxI46s62NFSFhXFn+OpQAa+pwFAmFeIAkUHGdvLndpZ3Vz
dEBnbWFpbC5jb20ACgkQFn+OpQAa+pzd+hAAuDUWd2yfNf/J3Vu7pPJv4hGGU3Lf
lpsmppoch6gXCIqFGDE4rQk+mJhZQo+53HfNkj6sQYctiBGkbMCGiWvFCW7gjpTM
mcThPIJqTzrD2UzBgKLoEpOHuwV6/KnZWFA//SwBIQDvHP1FRQn6PEDtK/B7uHAS
yNW59D2SH2Qa6NPRhwFcCsy623GceLLwEYjvdx2F9w4UYPDEX0zezS9GqlUIghnN
yUVmT/djl5r6FhXm1Ovv0vskWbGmxj2G/i38i/0oBm+4UUtfnGxCbeUOUhB0MNBz
SaHbkY1wrJQ25L+Ao9K3R19iIh24UI8Ce1fUeR1LvdyVPIKQzE9J7V+Yw94scOL1
vA6LWTm6tYaz5wZdm1Ii+lUH4zNM/tPUH4MnGCsk6sxIh5QsWjXyyN7kSZZH6YpZ
eQQYk91MBIvfRltou/Terqxn1Z7lUA697dC95Uo+Jh5Z2S2R0yTupe0tI2PxTZ0x
6AHQgU44OaDUMQsas3Mnl2/cYLnJ9WYNn0ncWEkCN4rbNCTy/o5T0d1CwvskGR4q
E8HukErsJpIoclWpp2tDv+7/2b9tg+/T1hOw81GQT+qLDFlNkQTmWArMDcAtxCB5
OL4Ty+t3nqSrK4rQka3NAWVV+gEqprVVZXKq+5hmzFzWsANwL+r+pVtvEqO5aESt
OT1sKJiRZqu1eH4=
=Smsa
-----END PGP SIGNATURE-----

M
M
Maxime Devos wrote on 7 Oct 2021 08:37
Re: [bug#50967] [PATCH 00/12] Move (gnu home-services XYZ) to (gnu services XYZ)
e580508b60a3dceef992535d8678981c56eaf77b.camel@telenet.be
Oleg Pykhalov schreef op do 07-10-2021 om 01:15 [+0300]:
Toggle quote (12 lines)
> Oleg Pykhalov <go.wigust@gmail.com> writes:
>
> > This patch fixes user's files corruption. Also, I applied suggestions
> > about commit message, thanks zimoun!
>
> Also, in addion I forget to:
>
> Replace '#!/usr/bin/env bash' with '#!/bin/bash'
>
> Maybe a /bin/sh would be more Guix friendly, but shellcheck warns about
> export -f does not exist in posix shell. Thoughts are welcome ;-)

/bin/bash doesn't exist on Guix System, so it seems a bit weird to me
to use that in Guix. Anyway, I think shellcheck should classify
'#!/usr/bin/env bash' as a bash shell instead of a posix shell?

Greetings,
Maxime.
-----BEGIN PGP SIGNATURE-----

iI0EABYKADUWIQTB8z7iDFKP233XAR9J4+4iGRcl7gUCYV6VkBccbWF4aW1lZGV2
b3NAdGVsZW5ldC5iZQAKCRBJ4+4iGRcl7iduAQD9HszSunTD7w/cFyDSTk1IVLCu
tf5gSWzg/h/cQADhxwD/UvasRKAvS8hTcW/Yx2J6SXR3QxYe1eUCstMyLBW8vQw=
=f8F+
-----END PGP SIGNATURE-----


O
O
Oleg Pykhalov wrote on 7 Oct 2021 11:56
(name . Maxime Devos)(address . maximedevos@telenet.be)(address . 50967@debbugs.gnu.org)
87czohw42v.fsf@gmail.com
Maxime Devos <maximedevos@telenet.be> writes:

[…]

Toggle quote (9 lines)
>> Replace '#!/usr/bin/env bash' with '#!/bin/bash'
>>
>> Maybe a /bin/sh would be more Guix friendly, but shellcheck warns about
>> export -f does not exist in posix shell. Thoughts are welcome ;-)
>
> /bin/bash doesn't exist on Guix System, so it seems a bit weird to me
> to use that in Guix. Anyway, I think shellcheck should classify
> '#!/usr/bin/env bash' as a bash shell instead of a posix shell?

Yes, also /usr/bin/env does not exist on Guix as well. So in that sense
both /bin/bash and /usr/bin/env bash are equal.

I see special-files-service-type has an example about creating
/usr/bin/env, so probable should use /usr/bin/env bash in test's
shebang line to make shellcheck happy.
-----BEGIN PGP SIGNATURE-----

iQJIBAEBCgAyFiEEcjhxI46s62NFSFhXFn+OpQAa+pwFAmFexFgUHGdvLndpZ3Vz
dEBnbWFpbC5jb20ACgkQFn+OpQAa+pyxJhAAnqKvPhyy1Y8rdn1Ho5Bl0XQXSPr0
yM6Sl6IZfEBg51pGWF1wAfbZSQBV9Bkr28x0v/jFvU7IdQ77wzGRrQfuY0P4JaPO
+Vu+bmJz1jXJmlTZGnKcbcwGYf7qIDlG0VzWCLc6b1HasCzrenpoE8nEhhzYYoih
4ilGplohjq9lZ3tfYjh3efZXwdqWC0ZukxmOq7hWDm0/5nhdnO/6OZXT7uy9Z89T
olmM9JhSE4Twccbu8ABdwlrLofbZH+6XuD+6do79gefYaW/uaZdqKXkpsviOrY85
vUM9phGYHiM9X25WpmG8MXL43EP+zgswXvErz7brL/WWjQk5dzM0CzHOcVKM0k5D
QsNQo4Ce9/9EVbwImIUBr2nwK5b4RnoXL1bQoxTSA6tzdD9TsD6auHz1oAGA7dBY
2RNXhGeYPwv/77J8U/uNL0jmo1ygB7pyrfAxHwalclp3cCdtBDrc6dhpAMsQ09hR
CfXz/7TzBmj+kn724M63FwMvZehOI2JNUR/7cNcVkUQuuoh1m5XrqBb//m27DCsz
v2DxHiu2LqT7HYWRgCS6X5XxuQ65iBMaJgDpka4BeoMUdyTxLccLj2VysEyRXVV9
jqld7XoALANCJ/ADFL02vrBZ8YAFL0S/FdJ3dwX41fTvDwDXC8iJ4Iv1afnb2Nec
zeR0t+6lQdZlz9E=
=EyOU
-----END PGP SIGNATURE-----

M
M
Maxime Devos wrote on 7 Oct 2021 18:43
(name . Oleg Pykhalov)(address . go.wigust@gmail.com)(address . 50967@debbugs.gnu.org)
60d0736f471240e0a0c3feb40423f02f61dfe017.camel@telenet.be
Oleg Pykhalov schreef op do 07-10-2021 om 12:56 [+0300]:
Toggle quote (16 lines)
> Maxime Devos <maximedevos@telenet.be> writes:
>
> […]
>
> > > Replace '#!/usr/bin/env bash' with '#!/bin/bash'
> > >
> > > Maybe a /bin/sh would be more Guix friendly, but shellcheck warns about
> > > export -f does not exist in posix shell. Thoughts are welcome ;-)
> >
> > /bin/bash doesn't exist on Guix System, so it seems a bit weird to me
> > to use that in Guix. Anyway, I think shellcheck should classify
> > '#!/usr/bin/env bash' as a bash shell instead of a posix shell?
>
> Yes, also /usr/bin/env does not exist on Guix as well. So in that sense
> both /bin/bash and /usr/bin/env bash are equal.

It does exist:

$ ls /usr/bin/env
/usr/bin/env

It's supposed to be possible to do without on Guix System though, by removing it
from %base-services.

FWIW, the shell scripts in tests/*.sh do not have a shebang.

Greetings,
Maxime.
-----BEGIN PGP SIGNATURE-----

iI0EABYKADUWIQTB8z7iDFKP233XAR9J4+4iGRcl7gUCYV8jpxccbWF4aW1lZGV2
b3NAdGVsZW5ldC5iZQAKCRBJ4+4iGRcl7mllAQClpe3drrzzjH8AJpw9WCndhnCP
TTn+9W9Bg+9p1lyXRwEA5AATT4zMA/tHJ18j7pEpqvp72TnoPwqGDsRbPYJccwc=
=D8bU
-----END PGP SIGNATURE-----


L
L
Ludovic Courtès wrote on 8 Oct 2021 09:56
Re: [bug#50967] file-like objects instead of gexps
(name . Andrew Tropin)(address . andrew@trop.in)
87a6jk54ro.fsf@gnu.org
Hi Andrew,

Andrew Tropin <andrew@trop.in> skribis:

Toggle quote (20 lines)
> On 2021-10-04 16:04, Ludovic Courtès wrote:
>
>> Xinglu Chen <public@yoctocell.xyz> skribis:
>>
>>> On Sat, Oct 02 2021, Oleg Pykhalov wrote:
>>>
>>>> * gnu/home/services/configuration.scm (interpose): Include content of files.
>>>> (string-or-gexp?): Rename to 'file-or-string-or-gexp?' and check for file-like
>>>> object.
>>>
>>> I would call it ‘file-like-or-string-or-gexp?’, just ‘files’ doesn’t
>>> really make it clear that it should be a “file-like object”.
>>
>> As a matter of API, I would make it monomorphic: accept a file-like
>> object, period. This is what’s done for System services (and
>> polymorphic APIs are rare in general in Guix).
>
> At least some of system services are far from ideal, recently I tried to
> add rtmp section to nginx configuration using nginx system service.

I agree that nginx config is problematic:


But IMO that’s off-topic. :-)

Toggle quote (11 lines)
> Imagine the following use case: I want to create a home service, which
> accepts a package (zsh plugin) and adds a code for loading this package
> to zshrc, currently it's implemented like that:
>
> https://git.sr.ht/~abcdw/rde/tree/69dd2baf0384c899a4a4f97bdac8bf0b6e499b82/item/gnu/home-services/shellutils.scm#L18
>
> Exteding the service above with `(list zsh-autosuggestions)` will add
> the following line to zshrc:
>
> source /gnu/store/w7d43gk1qszplj9i0rkzqvzz6kp88qfm-zsh-autosuggestions-0.7.0/share/zsh/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh

OK.

Then that’s fine: you can have special code that emits those “source”
lines in .zshrc while still allowing users to provide their own
file-like object for .zshrc lines they want to add. Again, see how
‘torrc’ is generated in ‘tor-service-type’.

I’m happy to discuss specific service examples in mode details if you
want. Overall, I’m confident Home services don’t require any pattern
that’s not already found in one of the many System services. :-)

HTH,
Ludo’.
A
A
Andrew Tropin wrote on 8 Oct 2021 12:00
(name . Ludovic Courtès)(address . ludo@gnu.org)
87ily7hm4x.fsf@trop.in
On 2021-10-08 09:56, Ludovic Courtès wrote:

Toggle quote (31 lines)
> Hi Andrew,
>
> Andrew Tropin <andrew@trop.in> skribis:
>
>> On 2021-10-04 16:04, Ludovic Courtès wrote:
>>
>>> Xinglu Chen <public@yoctocell.xyz> skribis:
>>>
>>>> On Sat, Oct 02 2021, Oleg Pykhalov wrote:
>>>>
>>>>> * gnu/home/services/configuration.scm (interpose): Include content of files.
>>>>> (string-or-gexp?): Rename to 'file-or-string-or-gexp?' and check for file-like
>>>>> object.
>>>>
>>>> I would call it ‘file-like-or-string-or-gexp?’, just ‘files’ doesn’t
>>>> really make it clear that it should be a “file-like object”.
>>>
>>> As a matter of API, I would make it monomorphic: accept a file-like
>>> object, period. This is what’s done for System services (and
>>> polymorphic APIs are rare in general in Guix).
>>
>> At least some of system services are far from ideal, recently I tried to
>> add rtmp section to nginx configuration using nginx system service.
>
> I agree that nginx config is problematic:
>
> https://issues.guix.gnu.org/37388
>
> But IMO that’s off-topic. :-)
>

Even not taking into account that ngixn-configuration is not ideally
implemented, probably it still relevant:

1. Highlights the problem of current service configuration
implementation approach with records: we will need to mimic the whole
underlying configuration language with records, for some small languages
it's possible, but in general it's very thankless job, which also force
use to keep an eye on upstream configuration language, possible
extensions to it and keep our implementation in sync. In addition to
that in most cases provided set of nested records requires destructuring
and custom serialization code.

Other system services also affected by this issue.

2. Usage of separate config-file fields with file-like object values is
problematic:

For nginx service it substitutes the whole file, for tor service it will
be inserted at the end of the file for service X it will be inserted at
the middle.


Using a slightly different approach, implemented in many home services
we get ultimate configuration flexibility, we don't need to handle
existing file as some special case, create a separate field for it and
wonder where it should be inserted, when provided.

I'll provide more details in a separate thread, but for now just take a
look at too implementations of sway services using both approaches:


Toggle quote (18 lines)
>> Imagine the following use case: I want to create a home service, which
>> accepts a package (zsh plugin) and adds a code for loading this package
>> to zshrc, currently it's implemented like that:
>>
>> https://git.sr.ht/~abcdw/rde/tree/69dd2baf0384c899a4a4f97bdac8bf0b6e499b82/item/gnu/home-services/shellutils.scm#L18
>>
>> Exteding the service above with `(list zsh-autosuggestions)` will add
>> the following line to zshrc:
>>
>> source /gnu/store/w7d43gk1qszplj9i0rkzqvzz6kp88qfm-zsh-autosuggestions-0.7.0/share/zsh/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh
>
> OK.
>
> Then that’s fine: you can have special code that emits those “source”
> lines in .zshrc while still allowing users to provide their own
> file-like object for .zshrc lines they want to add. Again, see how
> ‘torrc’ is generated in ‘tor-service-type’.

From what I understand you want a separate bashrc-file,
bash-profile-file and bash-logout-file fields to be present, but where
the content of those files should be inserted? At the beginning/end or
instead of the rest of configuration?

We already can achieve the same result by providing gexp, which will
read the content of the file-like object, a very small helper for that
(slurp-file-gexp) makes it even easier to do. Such approach is more
flexible and doesn't seem much harder.

I remember that you had concerns about slurp-file-gexp, but still don't
understand what exactly you are concerned about.

Toggle quote (8 lines)
>
> I’m happy to discuss specific service examples in mode details if you
> want. Overall, I’m confident Home services don’t require any pattern
> that’s not already found in one of the many System services. :-)
>
> HTH,
> Ludo’.

I'll write a few examples of service configurations and rationale behind
the design descisions for that next week, to make the discussion more
practically oriented.


--
Best regards,
Andrew Tropin
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCgAdFiEEKEGaxlA4dEDH6S/6IgjSCVjB3rAFAmFgFq4ACgkQIgjSCVjB
3rC1CQ//SfnqHSBc7BYNk2QKH6JXmnYOTJCv3Lw1dpBjn3aQ5DNKHMeeW0QgdTVr
x7CbXbtdesia0VE5ZH7KuZ7QqW0FIJ3TCDPPQIB0ky2jZKqobJwhdyGdN4fBFpWy
QK6BgPYgKkYUTaczgt+E7LMfjIfbUnZ5hjInqTUTD4CZWzHHLGzcX1ngaWPLmtkq
XFRdjD6XFGleAkpg2i0Gi4dZAXFU/HmpBCWo2sBzFzy53FGOwzdTwVUffGwMMLcV
F6UeBSKNF65mtqBN5P8eK9w86uKCKhL0mX+v7UtoSFeHShvop8+GRET6mlSaeoc5
Fl75TT+NMMQknORMw3cPAWSiS+HuJQTWbP8X1aEOEbKt4H2RoZKo30tZJETRdM3G
qAxPeLJBzRoe0xPjupmNEws7Dca58CAsuYRGJu2Eb8sQ2LH7kXJV4oryybWny+n4
deRESz1MdsCUKYb5ze0xI3hfSr/H/rzA+B+94WnA6ZYBdfjXVQugnQ5md3kb3XQl
Q3YTu930b8P86c9JR1TSoK+6+k9zLUup+4jKLngJKLSjdpWnmEAG57siKTLufqJb
u7sxVMtHdKTIl902aBP1ymaiIk/k5AfAzntACAJSjbUg3kwHl+TPFZXFDBSRQobI
nqvA2yNvIaoYKbVVDTiuTiCt2vtIEmcPYA5ELz8C53JwRkrUzZA=
=tmb8
-----END PGP SIGNATURE-----

A
A
Andrew Tropin wrote on 8 Oct 2021 12:06
Re: [bug#50967] [PATCH 13/14] home: services: configuration: Support file-like objects.
(name . Oleg Pykhalov)(address . go.wigust@gmail.com)
87fstbhlv9.fsf@trop.in
On 2021-10-02 19:38, Oleg Pykhalov wrote:

Toggle quote (70 lines)
> * gnu/home/services/configuration.scm (interpose): Include content of files.
> (string-or-gexp?): Rename to 'file-or-string-or-gexp?' and check for file-like
> object.
> (serialize-string-or-gexp): Rename to 'serialize-file-or-string-or-gexp'.
> (text-config?): Call 'file-or-string-or-gexp?' 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 | 14 ++++++++++----
> guix/scripts/home/import.scm | 8 +++-----
> 2 files changed, 13 insertions(+), 9 deletions(-)
>
> diff --git a/gnu/home/services/configuration.scm b/gnu/home/services/configuration.scm
> index 5e7743e7d6..39db7a5693 100644
> --- a/gnu/home/services/configuration.scm
> +++ b/gnu/home/services/configuration.scm
> @@ -59,7 +59,12 @@ DELIMITER interposed LS. Support 'infix and 'suffix GRAMMAR values."
> (G_ "The GRAMMAR value must be 'infix or 'suffix, but ~a provided.")
> grammar)))
> (fold-right (lambda (e acc)
> - (cons e
> + (cons (if (file-like? e)
> + #~(begin
> + (use-modules (ice-9 rdelim))
> + (with-fluids ((%default-port-encoding "UTF-8"))
> + (with-input-from-file #$e read-string)))
> + e)
> (if (and (null? acc) (eq? grammar 'infix))
> acc
> (cons delimiter acc))))
> @@ -79,11 +84,12 @@ the list result in @code{#t} when applying PRED? on them."
>
> (define alist? list?)
>
> -(define (string-or-gexp? sg) (or (string? sg) (gexp? sg)))
> -(define (serialize-string-or-gexp field-name val) "")
> +(define (file-or-string-or-gexp? fsg)
> + (or (string? fsg) (gexp? fsg) (file-like? fsg)))
> +(define (serialize-file-or-string-or-gexp field-name val) "")
>
> (define (text-config? config)
> - (and (list? config) (every string-or-gexp? config)))
> + (and (list? config) (every file-or-string-or-gexp? config)))
> (define (serialize-text-config field-name val)
> #~(string-append #$@(interpose val "\n" 'suffix)))
>
> 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))))
> '()))))))

I think this patch requires more discussion and better to keep it
outside of this patch series. Skimmed throught other patches, overall
LGTM.

--
Best regards,
Andrew Tropin
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCgAdFiEEKEGaxlA4dEDH6S/6IgjSCVjB3rAFAmFgGAoACgkQIgjSCVjB
3rAViQ//bui0/CPZfJtHqydLQFolWIk1nBv7hhHx3MnL2vauudU84d+vHnU9FoIQ
plfS3MneMwgTsqIGu1VFFzaPgbI/XiU8A2hSlcU9cxG8UnaITg5+rnIe017Qzvok
WHlIEvq+U2NKB+Q8kQexlo4xQadxGqqDsgqyTGN4T6gyO5H+Tf01iah3AcZ4Rpzi
3/zOijcoUPJjfA+FSo1kPAvdnGW3t0k04JnHWPfp6AnyHlX5IbRXZuldhSKLB6VT
xLQZZwMtQ9K5XYAmjdV0DRO2aeD3igrIP1no2n4BDPyARS1OrH2DoKYn4zk/HmVN
gdN2jK1QzQqI+PVU3kXn4YJvoZZyXVVvjOsxHosIYQOrOhNHkR4RhGLbokcAWOhp
wDi4hbv+FeBCDzxxjR2NWgbuwvPD2gey4+7mwLWoTIplk0P6WjMfGkxyG1DelGXi
Qj0u/rpCJN9bmfB5AYCNYEVM7QN3P1yHDovmheWgIWNeePNCdTfFR4HZLp+Ur0lc
s3+fqcRa0AiJiNCTWT/3oBpmZFqEqTvzj9O3FxTikMOiVdmV8AK9P8578fr33Q3j
slKsHbKnkKtlzeXWv7KTDeROcWdLST/DmkI/egp2Hv8EQeDcfkeDwAyEpYEjV6rG
/XHjv3YrpY3cgCLMg7xs9BE7UDTeVgx6qqATPJ29+wTPCcjJRew=
=L/hd
-----END PGP SIGNATURE-----

O
O
Oleg Pykhalov wrote on 8 Oct 2021 14:44
Re: bug#50967: [PATCH 00/12] Move (gnu home-services XYZ) to (gnu services XYZ)
(address . 50967@debbugs.gnu.org)
87lf33znwv.fsf_-_@gmail.com
Oleg Pykhalov <go.wigust@gmail.com> writes:

Toggle quote (18 lines)
> * gnu/home-services/configuration.scm: Move the content ...
> ...
> * 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 ++++++++--------

[…]

I pushed only this patch to master.
-----BEGIN PGP SIGNATURE-----

iQJIBAEBCgAyFiEEcjhxI46s62NFSFhXFn+OpQAa+pwFAmFgPTAUHGdvLndpZ3Vz
dEBnbWFpbC5jb20ACgkQFn+OpQAa+pyqvQ//WHkmRtN7bBIOOR/ThDe/NdmDurJ5
aIVxzu4ejm8xtQHWmRfIyk69vLnFuDqgFcevemQ/uyjWZX619o+KRrCC08ZXSXPS
WHkheAjZD+X4qzg1JDHIiam8w+K0qkVsY6dc1zZoDdNHWGXrPTxvGHgwJN3j/Lyb
9zrCh9arb+dRdyrlaZ+bcp0vHbe4wRD9LIcKCKSHSvy4mEA5uPcwTDBI+pmygnfV
ViGuFVpPxkniXAopXUA10h74bYrJsJX1Ed/4FnrhBhvnrYjmAb1lMEmydZYUiLJ0
1w9flW8pLzkcWoHekglbWQYpHCVbQdf0XV2KrPJpA+VcidqsosAnopLHZkdcV4/0
rFY02j4AjmJNzdoKUU/0B6sxXy+EpI6f4GfnD6gUpwOjOccsEyAMryQtFcEoskKJ
rhLGZ9rUOKv4WmKPs2QMgYjtWzxDVl2pfiIfIzkxOL0k9ZhyqYw4MOz7ZWS9TBpg
jIThW8KyteZDcO9xWPPvD/Q/IitWzGCzD3uGxI5JxE11JMxdq9cjei5+6sRMrgC1
RLNuyTYUBokJeW7lM1AHchSYUXBw2hFz/dhlcIMnJlvxpUT2s+xEx+YGzFLfFHiw
yjZkRbW2hhWCWKbZeuEOz+l70YCicwIF+BTwegGCAAjgUW0oKhbdfBVLSO72BW1o
nmCk4Kwb6D7Inxw=
=+hKo
-----END PGP SIGNATURE-----

X
X
Xinglu Chen wrote on 8 Oct 2021 15:45
Re: [bug#50967] file-like objects instead of gexps
87ee8vmxyo.fsf@yoctocell.xyz
On Wed, Oct 06 2021, Andrew Tropin wrote:

Toggle quote (76 lines)
> Imagine the following use case: I want to create a home service, which
> accepts a package (zsh plugin) and adds a code for loading this package
> to zshrc, currently it's implemented like that:
>
> https://git.sr.ht/~abcdw/rde/tree/69dd2baf0384c899a4a4f97bdac8bf0b6e499b82/item/gnu/home-services/shellutils.scm#L18
>
> Exteding the service above with `(list zsh-autosuggestions)` will add
> the following line to zshrc:
>
> source /gnu/store/w7d43gk1qszplj9i0rkzqvzz6kp88qfm-zsh-autosuggestions-0.7.0/share/zsh/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh
>
> Or the same thing can be done manually by user:
>
> --8<---------------cut here---------------start------------->8---
> (service
> home-zsh-service-type
> (home-zsh-configuration
> (zshrc
> (list
> #~(string-append "source " #$zsh-autosuggestions "/share/zs../..ions.zsh")
> ;; or
> "source \\"
> (file-append zsh-autosuggestions "/share/zs../..ions.zsh")))))
> --8<---------------cut here---------------end--------------->8---
>
> gexps returns a string, file-like object returns a path to the file in
> the store, kinda expected behavior. Both implementations looks quite
> simple.
>
>
> Now I'll try to reimplement it with file-like objects. The code below
> is a pseudo code, but should demonstrate the overall concerns I have:
>
> --8<---------------cut here---------------start------------->8---
> ;; Some generic functions
> (define get-file-like-object-path (file-like)
> "Because all file-like object get inserted literally by home services,
> we need a function, which returns a file, which contains a path to the
> file."
> (computed-file
> "tmp-file"
> #~#$file-like))
>
> (define fl-append-strings (lst)
> "Accepts a list of strings and file-like object, reads the content of
> the file-like objects (to be consistent with behavior of home services
> configuration)."
> (define file-like->str (mb-file-like)
> (if (string? mb-file-like)
> mb-file-like
> #~(begin
> (use-modules (ice-9 rdelim))
> (with-fluids ((%default-port-encoding "UTF-8"))
> (with-input-from-file #$mb-file-like read-string)))))
> (computed-file
> "tmp-file"
> #~(apply string-append '#$(map file-like->str lst))))
>
>
> ;; A home service, declared in home-environment.
> (service
> home-zsh-service-type
> (home-zsh-configuration
> (zshrc
> (list
> (fl-append-strings
> (list
> "source "
> (get-file-like-object-path zsh-autosuggestions)
> "/share/zs../..ions.zsh"))
> ;; or
> "source \\"
> (get-file-like-object-path
> (file-append zsh-autosuggestions "/share/zs../..ions.zsh"))))))
> --8<---------------cut here---------------end--------------->8---

Wouldn’t something like the following work

Toggle snippet (10 lines)
(service home-zsh-service-type
(home-zsh-configuration
(zshrc
(list (mixed-text-file
"zshrc"
"source "
(file-append zsh-autosuggestions "/share/zsh/..."))
(local-file "./some-zshrc")))))

and since ‘zshrc’ is already a list of file-like objects, we could
implement ‘serialize-text-config’ using something like
‘fl-append-strings’, which would read the contents of the two files and
append them. That way users don’t have to deal with ‘fl-append-strings’
or ‘slurp-file-gexp’.
-----BEGIN PGP SIGNATURE-----

iQJJBAEBCAAzFiEEAVhh4yyK5+SEykIzrPUJmaL7XHkFAmFgS48VHHB1YmxpY0B5
b2N0b2NlbGwueHl6AAoJEKz1CZmi+1x5IegP/3N6sllx+97nIbG7lzoe0XMnm7XS
9BWteu3/4O51LgJtli5irkohFDUK1eBLIOxbCS1YRMkzcIPAZtKNJcglc3YMjo6m
Bdwoa07uc9H4rehrzDX+e7DGRB8EW2EPfwupHR8I6Abzw7KAwpsYLqd8MB7Mzv6S
CksV5lv6Dg7LxkRJ1kghrzCWo48Mpu+Y53aalrKYXgDkYTTIRirsgiOMCXJWXoXe
B6KMJp0kJ92g10Q+acxwAs154HVeYQnHpXeKu8XJPFHrCKnTmD+fvro79+85hrp1
jbhHwMXioX8F5sCgfVmYI4/gNoUz/UhTtqZtq8cibZimlopm/5Iw1ss4lizV1TPi
SCYgaMc4qMXxrHJoGS6hvkhjvZJdnuJNiyLRu+oIKyi3/YIGDBIdEubkiOlDD4u4
owteA1RULTi7xByMVe6t8FyPE3fOssSOBbTbyjzdHx6JIhJtyjkaMYuS+BtaYwRk
8NntbfftcPr+J1t4Yf9xNf26RmyTjXzWgzVcplUp9a0YVC6nwvW+NOcEYPqgZfX3
+wlGEiTxAd+YAzyK1WTZ1HOEJHSGmcM0TLWneZFtv0IpCKy8w/FS3ihJCxWdAyfe
/8lNNry9+GNx/qwYXqqSfgIsDWyp0+iU0h97QE6LB/wl/dw6+r+RVmdBAuCuuLS4
O/4WgOwOu3L2odoc
=4wZg
-----END PGP SIGNATURE-----

A
A
Andrew Tropin wrote on 8 Oct 2021 16:27
Re: bug#50967: [PATCH 00/12] Move (gnu home-services XYZ) to (gnu services XYZ)
877denvbfb.fsf@trop.in
On 2021-10-08 15:44, Oleg Pykhalov wrote:

Toggle quote (26 lines)
> Oleg Pykhalov <go.wigust@gmail.com> writes:
>
>> * gnu/home-services/configuration.scm: Move the content ...
>> ...
>> * 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 ++++++++--------
>
> […]
>
> I pushed only this patch to master.
>
>

Good. I'll update rde home services accordingly next week.

It would be cool to notify people about this update, because they
probably already have configurations, which will break. etc/news.scm,
message in mailing list? What is the best way to do it?

Sorry for the late idea, but don't we want gnu/home-services.scm to be
gnu/home/services.scm? WDYT?

Also, I completely missed this:
It should be updated.

Oleg, Thank you for working on this!)

--
Best regards,
Andrew Tropin
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCgAdFiEEKEGaxlA4dEDH6S/6IgjSCVjB3rAFAmFgVWkACgkQIgjSCVjB
3rAamw/8CdhDN5ce/yhvZciGZUG2JoNx52jQ6KO0R+2oNNW0/OtXgJRqvlLJB+a1
yaUgPoP2LdqhCCBGW5aXaDsCYCmwXePEgS7qf13QknfQBa+r06WwLRbOgXPCYvty
EV67qTZ+dtNDXG1kPaMN9FovVIqVGrGLY4XMKJ0Fe+uszP5A5sdKQkqrSrxGcyZp
P2L07mbdC/UUatMsvhIu5tak6rzikIo2noNgpVHj/TavsQmvvpfOubUjNkbUeok6
x6JqxzAEu6Wl8SLP2oWfR8WKdJ0Kv1o4cxcwBo6cDrKk2M0t0XNUMmnEzVFYk4LD
P3U5oErZWGAOfAWNmi4IKHA9kTKbEEIiDtuB7tBatQCRNfcUzyGOwEbyyjaL+nCN
jQFaR3e91MQ3tXf+6UafO9tXFQZQr9ByqgZvkE6icv4yos0+zDpIWs4uyTTG89a0
LeeOye2YSOcV5BE/PeiusYasoh/+zeX+agRuQhNXfa4fUPF/j0uyFbcLbrhofOXE
9GJG9iAoDRzQUp+NL631G5EGmLlxv56zgGCw9dlfDce+V4e7aGgbkRV+zXKB9Z4/
wEYtGrv1TM0ivkvZB4dbooJ3j9ktCWOXSjCAePNak2bYsujn8qiWunYRcIvRxEU8
2MccGDdg2xgz1qZyBzU99wFMPWAuiD52WWkadxzC6tHftUTp7i0=
=tF+Z
-----END PGP SIGNATURE-----

A
A
Andrew Tropin wrote on 8 Oct 2021 16:34
Re: [bug#50967] file-like objects instead of gexps
874k9rvb4z.fsf@trop.in
On 2021-10-08 15:45, Xinglu Chen wrote:

Toggle quote (88 lines)
> On Wed, Oct 06 2021, Andrew Tropin wrote:
>
>> Imagine the following use case: I want to create a home service, which
>> accepts a package (zsh plugin) and adds a code for loading this package
>> to zshrc, currently it's implemented like that:
>>
>> https://git.sr.ht/~abcdw/rde/tree/69dd2baf0384c899a4a4f97bdac8bf0b6e499b82/item/gnu/home-services/shellutils.scm#L18
>>
>> Exteding the service above with `(list zsh-autosuggestions)` will add
>> the following line to zshrc:
>>
>> source /gnu/store/w7d43gk1qszplj9i0rkzqvzz6kp88qfm-zsh-autosuggestions-0.7.0/share/zsh/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh
>>
>> Or the same thing can be done manually by user:
>>
>> --8<---------------cut here---------------start------------->8---
>> (service
>> home-zsh-service-type
>> (home-zsh-configuration
>> (zshrc
>> (list
>> #~(string-append "source " #$zsh-autosuggestions "/share/zs../..ions.zsh")
>> ;; or
>> "source \\"
>> (file-append zsh-autosuggestions "/share/zs../..ions.zsh")))))
>> --8<---------------cut here---------------end--------------->8---
>>
>> gexps returns a string, file-like object returns a path to the file in
>> the store, kinda expected behavior. Both implementations looks quite
>> simple.
>>
>>
>> Now I'll try to reimplement it with file-like objects. The code below
>> is a pseudo code, but should demonstrate the overall concerns I have:
>>
>> --8<---------------cut here---------------start------------->8---
>> ;; Some generic functions
>> (define get-file-like-object-path (file-like)
>> "Because all file-like object get inserted literally by home services,
>> we need a function, which returns a file, which contains a path to the
>> file."
>> (computed-file
>> "tmp-file"
>> #~#$file-like))
>>
>> (define fl-append-strings (lst)
>> "Accepts a list of strings and file-like object, reads the content of
>> the file-like objects (to be consistent with behavior of home services
>> configuration)."
>> (define file-like->str (mb-file-like)
>> (if (string? mb-file-like)
>> mb-file-like
>> #~(begin
>> (use-modules (ice-9 rdelim))
>> (with-fluids ((%default-port-encoding "UTF-8"))
>> (with-input-from-file #$mb-file-like read-string)))))
>> (computed-file
>> "tmp-file"
>> #~(apply string-append '#$(map file-like->str lst))))
>>
>>
>> ;; A home service, declared in home-environment.
>> (service
>> home-zsh-service-type
>> (home-zsh-configuration
>> (zshrc
>> (list
>> (fl-append-strings
>> (list
>> "source "
>> (get-file-like-object-path zsh-autosuggestions)
>> "/share/zs../..ions.zsh"))
>> ;; or
>> "source \\"
>> (get-file-like-object-path
>> (file-append zsh-autosuggestions "/share/zs../..ions.zsh"))))))
>> --8<---------------cut here---------------end--------------->8---
>
> Wouldn’t something like the following work
>
> --8<---------------cut here---------------start------------->8---
> (service home-zsh-service-type
> (home-zsh-configuration
> (zshrc
> (list (mixed-text-file
> "zshrc"
> "source "
> (file-append zsh-autosuggestions "/share/zsh/..."))
^ place1
Toggle quote (1 lines)
> (local-file "./some-zshrc")))))
^ place2
Toggle quote (8 lines)
> --8<---------------cut here---------------end--------------->8---
>
> and since ‘zshrc’ is already a list of file-like objects, we could
> implement ‘serialize-text-config’ using something like
> ‘fl-append-strings’, which would read the contents of the two files and
> append them. That way users don’t have to deal with ‘fl-append-strings’
> or ‘slurp-file-gexp’.

Yep, it looks much better than what I was trying to prototype.

Still feels inconsistent that file-like object in place1 will be
evaluated to the path in the store, but in place2 to the content of the
file.

--
Best regards,
Andrew Tropin
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCgAdFiEEKEGaxlA4dEDH6S/6IgjSCVjB3rAFAmFgVtwACgkQIgjSCVjB
3rB/MQ//RogABVv2MpJjTa4l3tLbJwD4Ys6QmTlJXbs0WD4qY48ShsNo3HI6Chg3
Co6cGOB89jN5pS0cguiY8K9kMSTj7xTPGH6w3XLNwo1D36iz21datc+UHXLi+nKk
kCmr3DEC94tt/YgD2qLtIKUBpP9R4wEm8yHNe1xMgb2NrlNpg6A6PIK+uA/Gtnbg
RL4mgsO3sUQ9pvzaztDa03CympuYBa+NGx0JRgOXVipV7W856wuMkvCQBe6r9Y7K
rQSHXkJMihblQSY7dV4YfSGQalINz9Vpm+bVbVqYlNMecnhyXAEd5U/uw1bnFii+
fD4Wh45Ymi/nlxveXHKsGVkmlSunkLI+6j4VaidDPMfqlpKwSlZisC/bxqCpwSZL
o4vbmaaB20xEJ0xp0lUC4oW3cYj6S7kqA2FRP1fYubw34Ua92gKYQ1g5c8ZiDkyu
5Plj4/tzTlmpDzCddSHLp4sqJPVQgIdZolkv563OGx7kVHGd1VQnOODrJ4GqOVrn
iwmonTwgyGtymUDfDyA+q0JdNqdF4O2k2dFqauIoe6j23YO7OEviy0wqBCh5lWS6
CGg7k5hm0Xul4UGtYGshRgv3RwStGefnfRyujPjrpoxA1KKxcRm2XogvCdiN1aGU
5fS86VE4mmuFXG+WpLD32pkUUx+shZ///hguHnzDS63bgOQ+6/I=
=8O5B
-----END PGP SIGNATURE-----

L
L
Ludovic Courtès wrote on 9 Oct 2021 00:44
Re: bug#50967: [PATCH 00/12] Move (gnu home-services XYZ) to (gnu services XYZ)
(name . Maxime Devos)(address . maximedevos@telenet.be)
87a6jj3zns.fsf_-_@gnu.org
Maxime Devos <maximedevos@telenet.be> skribis:

Toggle quote (15 lines)
> Oleg Pykhalov schreef op do 07-10-2021 om 01:15 [+0300]:
>> Oleg Pykhalov <go.wigust@gmail.com> writes:
>>
>> > This patch fixes user's files corruption. Also, I applied suggestions
>> > about commit message, thanks zimoun!
>>
>> Also, in addion I forget to:
>>
>> Replace '#!/usr/bin/env bash' with '#!/bin/bash'
>>
>> Maybe a /bin/sh would be more Guix friendly, but shellcheck warns about
>> export -f does not exist in posix shell. Thoughts are welcome ;-)
>
> /bin/bash doesn't exist on Guix System,

Also, tests/*.sh are not executable and thus have no shebang; you can do
the same here.

Ludo’.
L
L
Ludovic Courtès wrote on 9 Oct 2021 00:46
(name . Andrew Tropin)(address . andrew@trop.in)
875yu73zjv.fsf_-_@gnu.org
Hi,

Andrew Tropin <andrew@trop.in> skribis:

Toggle quote (4 lines)
> It would be cool to notify people about this update, because they
> probably already have configurations, which will break. etc/news.scm,
> message in mailing list? What is the best way to do it?

A message on the mailing list would be nice, but IMO that’s enough.

Toggle quote (3 lines)
> Sorry for the late idea, but don't we want gnu/home-services.scm to be
> gnu/home/services.scm? WDYT?

I think so, that’d be consistent.

Thanks,
Ludo’.
L
L
Ludovic Courtès wrote on 9 Oct 2021 00:49
(name . Oleg Pykhalov)(address . go.wigust@gmail.com)
87wnmn2ktu.fsf_-_@gnu.org
Hi,

Oleg Pykhalov <go.wigust@gmail.com> skribis:

Toggle quote (43 lines)
> * 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.

This part LGTM, though as Andrew suggested, I’d also rename
gnu/home-services.scm to gnu/home/services.scm.

Thanks,
Ludo’.
L
L
Ludovic Courtès wrote on 9 Oct 2021 00:57
(name . Oleg Pykhalov)(address . go.wigust@gmail.com)
87o87z2kge.fsf_-_@gnu.org
Oleg Pykhalov <go.wigust@gmail.com> skribis:

Toggle quote (9 lines)
> From eec2ab5f514ec6e156244898f8a635baf323ab70 Mon Sep 17 00:00:00 2001
> From: Oleg Pykhalov <go.wigust@gmail.com>
> Date: Tue, 5 Oct 2021 02:10:25 +0300
> Subject: [PATCH] scripts: home: Make sure profile directory exists.
>
> * guix/scripts/home.scm (process-action): Make sure profile directory exists.
> * tests/guix-home.sh: New file.
> * Makefile.am (SH_TESTS): Add this.

IMO the home.scm change should perhaps be a separate commit because it’s
not strictly what the test exercises.

Toggle quote (5 lines)
> +++ b/tests/guix-home.sh
> @@ -0,0 +1,86 @@
> +#!/usr/bin/env bash
> +

You can remove these two lines.

Toggle quote (16 lines)
> +run_guix_home_without_home()
> +{
> + (
> + # Save current directory (Guix source directory) for later mount
> + test_directory="$(mktemp -d)"
> + trap 'umount $test_directory; rmdir $test_directory' EXIT
> + mount --bind "$PWD" "$test_directory"
> +
> + # Make $HOME directory empty to preserve user's files
> + mount --types tmpfs none "$HOME"
> +
> + # Mount Guix source directory in a clean environment
> + mkdir -p "$PWD"
> + mount --bind "$test_directory" "$PWD"
> + cd "$PWD" || exit 77

How about ‘set -e’ to make sure we abort as soon as things go wrong?

Also, wouldn’t it be easier to set HOME to a new directory?

Toggle quote (2 lines)
> + guix home reconfigure "${test_directory}/home.scm"

Looks like the test is not checking anything after ‘reconfigure’ has
completed. Should it check for the presence of certain things in
~/.bashrc, for the presence of ~/.guix-home, the output of ‘guix home
describe’ maybe?

Toggle quote (2 lines)
> +unshare -mrf bash -c "run_guix_home_without_home"

If we keep this strategy (rather than setting HOME), we need a check for
unprivileged user namespace support. In
‘tests/guix-pack-relocatable.sh’, this is done by invoking “unshare -r
true” and checking the return value.

Could you send an updated patch?

Thanks,
Ludo’.
O
O
Oleg Pykhalov wrote on 9 Oct 2021 14:34
(name . Ludovic Courtès)(address . ludo@gnu.org)
87k0im74x5.fsf@gmail.com
Ludovic Courtès <ludo@gnu.org> writes:

Toggle quote (5 lines)
>> From eec2ab5f514ec6e156244898f8a635baf323ab70 Mon Sep 17 00:00:00 2001
>> From: Oleg Pykhalov <go.wigust@gmail.com>
>> Date: Tue, 5 Oct 2021 02:10:25 +0300
>> Subject: [PATCH] scripts: home: Make sure profile directory exists.

[…]

Toggle quote (4 lines)
> Also, wouldn’t it be easier to set HOME to a new directory?
>
>> + guix home reconfigure "${test_directory}/home.scm"

We probably should clean temporary $HOME directory with 'rm -rf' or
delete each file with 'rm' and then invoke 'rmdir' inside a Bash's
'trap'. I fill worry about removing operations on $HOME directories.

Alternative is not to remove $HOME by calling some command and just exit
from a namespace, which will remove $HOME mounted as tmpfs after exiting
a process running the guix-home.sh test.

[…]

Toggle quote (2 lines)
> Could you send an updated patch?

Also returned Andrew's 'guix home search' tests.

And 'home-bash-service-type' is replaced with 'simple-service' to not to
block the guix-home.sh test from merging in master until completion of
discussion about file-like objects.
From 4b29f7f1592f4256c7cd628624d2225e2d427a9d Mon Sep 17 00:00:00 2001
From: Oleg Pykhalov <go.wigust@gmail.com>
Date: Sat, 9 Oct 2021 14:52:10 +0300
Subject: [PATCH 1/2] scripts: home: Make sure profile directory exists.

* guix/scripts/home.scm (process-action): Make sure profile directory exists.
---
guix/scripts/home.scm | 2 ++
1 file changed, 2 insertions(+)

Toggle diff (22 lines)
diff --git a/guix/scripts/home.scm b/guix/scripts/home.scm
index a4d4aaa562..e6e35513fd 100644
--- a/guix/scripts/home.scm
+++ b/guix/scripts/home.scm
@@ -2,6 +2,7 @@
;;; Copyright © 2021 Andrew Tropin <andrew@trop.in>
;;; Copyright © 2021 Xinglu Chen <public@yoctocell.xyz>
;;; Copyright © 2021 Pierre Langlois <pierre.langlois@gmx.com>
+;;; Copyright © 2021 Oleg Pykhalov <go.wigust@gmail.com>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -189,6 +190,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))
--
2.33.0
From 5cc0b064af3f4a6238722fbb451a98b499c8d6d2 Mon Sep 17 00:00:00 2001
From: Oleg Pykhalov <go.wigust@gmail.com>
Date: Sat, 9 Oct 2021 14:52:13 +0300
Subject: [PATCH 2/2] tests: Add guix-home.sh.

* tests/guix-home.sh: New file.
* Makefile.am (SH_TESTS): Add this.
---
Makefile.am | 1 +
tests/guix-home.sh | 122 +++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 123 insertions(+)
create mode 100644 tests/guix-home.sh

Toggle diff (142 lines)
diff --git a/Makefile.am b/Makefile.am
index bb0b5989d2..b341031ec9 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -552,6 +552,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/tests/guix-home.sh b/tests/guix-home.sh
new file mode 100644
index 0000000000..f251304083
--- /dev/null
+++ b/tests/guix-home.sh
@@ -0,0 +1,122 @@
+
+# GNU Guix --- Functional package management for GNU
+# Copyright © 2021 Andrew Tropin <andrew@trop.in>
+# Copyright © 2021 Oleg Pykhalov <go.wigust@gmail.com>
+#
+# 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 <http://www.gnu.org/licenses/>.
+
+#
+# Test the 'guix home' using the external store, if any.
+#
+
+set -e
+
+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
+
+run_guix_home_without_home()
+{
+ set -e
+
+ # Save current directory (Guix source directory) for later mount
+ test_directory="$(mktemp -d)"
+ trap 'umount $test_directory; rmdir $test_directory' EXIT
+ mount --bind "$PWD" "$test_directory"
+
+ # Make $HOME directory empty to preserve user's files
+ mount --types tmpfs none "$HOME"
+
+ # Mount Guix source directory in a clean environment
+ mkdir -p "$PWD"
+ mount --bind "$test_directory" "$PWD"
+ cd "$PWD" || exit 77
+
+ #
+ # Test 'guix home reconfigure'.
+ #
+
+ cat > "home.scm" <<'EOF'
+(use-modules (guix gexp)
+ (gnu home)
+ (gnu home-services)
+ (gnu services))
+
+(home-environment
+ (services
+ (list
+ (simple-service 'test-config
+ home-files-service-type
+ (list `("config/test.conf"
+ ,(plain-file
+ "tmp-file.txt"
+ "the content of ~/.config/test.conf")))))))
+EOF
+
+ guix home reconfigure "${test_directory}/home.scm"
+ test -d "${HOME}/.guix-home"
+ grep -q "the content of ~/.config/test.conf" "${HOME}/.config/test.conf"
+
+ #
+ # Test 'guix home describe'.
+ #
+
+ configuration_file()
+ {
+ guix home describe \
+ | grep 'configuration file:' \
+ | cut -d : -f 2 \
+ | xargs echo
+ }
+ test "$(cat "$(configuration_file)")" == "$(cat home.scm)"
+
+ canonical_file_name()
+ {
+ guix home describe \
+ | grep 'canonical file name:' \
+ | cut -d : -f 2 \
+ | xargs echo
+ }
+ test "$(canonical_file_name)" == "$(readlink "${HOME}/.guix-home")"
+
+ #
+ # Test 'guix home search'.
+ #
+
+ guix home search mcron | grep "^name: home-mcron"
+ guix home search job manager | grep "^name: home-mcron"
+}
+export -f run_guix_home_without_home
+
+if unshare -r true # Are user namespaces supported?
+then
+ unshare --mount --map-root-user --fork sh -c "run_guix_home_without_home"
+else
+ exit 77
+fi
--
2.33.0
Oleg.
-----BEGIN PGP SIGNATURE-----

iQJIBAEBCgAyFiEEcjhxI46s62NFSFhXFn+OpQAa+pwFAmFhjFYUHGdvLndpZ3Vz
dEBnbWFpbC5jb20ACgkQFn+OpQAa+px6xA/+IyBC69mIdZDVaSslhxm+CiIgNZFn
KZAl89bVZz35rx4E8pULhB1RCXCMUeFipJhnjcWOcsGtO3g7LJgU/VBPAE+dx2YO
QencgoqvduUctnYmnIUyoEVqxLtAwDO/qu+riOjZo+Nfwq47CjQU5UMbDxqYZfMb
Q1iSB3eVPYcL5fVKfrYWtgKi0Ouzoj16Qo/orIPe3+PZFw5SYoTB4Nom8UGE450J
kWU9ukPQ7giC7wSP6KrwJ7hCKJgcsmUFyB4Ffo1HNc6BviiFxQZY1/263mluDeoz
C8dxAebgSCCtZDVePNOZK6E6AXRfXKI7kzvv1PoAC7M28DB3FzsnZjYXTGUq67pX
IESqXcqww98ltgx5pZbhR/vZJyUcmPnLFSmD2v+vT3KuQwTf+U5QXaVYeN3fyNj5
LNUfneMeb6I5MInykseSqvkjtdYGH+mScQ0XoTEudBTz2L7nJ/CThvnoGcwe4c28
3tg0FMyqpHEbpsQYDpn1Xcjr+XK7WUf/O5OJMEAK9qRmGuNq6XW4DsBFSn4l+0Gc
geDrmdPnf7fXSKBmHw7jMhnVIGkGJfPxw0/cp0I/as8GzHn55pZc8LyaahaRcY+b
mT/FIsbe34ZYxlskkMWMs7uEyAcGxzf3lTrZ1VmLOFLgyqGxfViSZtEjOpHVIkdB
aejEXR8OVMUj+KU=
=Xz3D
-----END PGP SIGNATURE-----

O
O
Oleg Pykhalov wrote on 9 Oct 2021 14:45
Re: [bug#50967] [PATCH 00/12] Move (gnu home-services XYZ) to (gnu services XYZ)
(name . Ludovic Courtès)(address . ludo@gnu.org)
87czoe74en.fsf@gmail.com
Oleg Pykhalov <go.wigust@gmail.com> writes:

[…]

Toggle quote (8 lines)
> We probably should clean temporary $HOME directory with 'rm -rf' or
> delete each file with 'rm' and then invoke 'rmdir' inside a Bash's
> 'trap'. I fill worry about removing operations on $HOME directories.
>
> Alternative is not to remove $HOME by calling some command and just exit
> from a namespace, which will remove $HOME mounted as tmpfs after exiting
> a process running the guix-home.sh test.

Actually, we could just point 'rm -rf' on '$test_directory'. :-)
From 6b0378643df42a963c74cb2a304a0bd369f041cf Mon Sep 17 00:00:00 2001
From: Oleg Pykhalov <go.wigust@gmail.com>
Date: Sat, 9 Oct 2021 14:52:13 +0300
Subject: [PATCH] tests: Add guix-home.sh.

* tests/guix-home.sh: New file.
* Makefile.am (SH_TESTS): Add this.
---
Makefile.am | 1 +
tests/guix-home.sh | 106 +++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 107 insertions(+)
create mode 100644 tests/guix-home.sh

Toggle diff (126 lines)
diff --git a/Makefile.am b/Makefile.am
index bb0b5989d2..b341031ec9 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -552,6 +552,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/tests/guix-home.sh b/tests/guix-home.sh
new file mode 100644
index 0000000000..2104edb41a
--- /dev/null
+++ b/tests/guix-home.sh
@@ -0,0 +1,106 @@
+
+# GNU Guix --- Functional package management for GNU
+# Copyright © 2021 Andrew Tropin <andrew@trop.in>
+# Copyright © 2021 Oleg Pykhalov <go.wigust@gmail.com>
+#
+# 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 <http://www.gnu.org/licenses/>.
+
+#
+# Test the 'guix home' using the external store, if any.
+#
+
+set -e
+
+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)"
+trap 'chmod -Rf +w "$test_directory"; rm -rf "$test_directory"' EXIT
+
+(
+ cd "$test_directory" || exit 77
+
+ HOME="$test_directory"
+ export HOME
+
+ #
+ # Test 'guix home reconfigure'.
+ #
+
+ cat > "home.scm" <<'EOF'
+(use-modules (guix gexp)
+ (gnu home)
+ (gnu home-services)
+ (gnu services))
+
+(home-environment
+ (services
+ (list
+ (simple-service 'test-config
+ home-files-service-type
+ (list `("config/test.conf"
+ ,(plain-file
+ "tmp-file.txt"
+ "the content of ~/.config/test.conf")))))))
+EOF
+
+ guix home reconfigure "${test_directory}/home.scm"
+ test -d "${HOME}/.guix-home"
+ grep -q "the content of ~/.config/test.conf" "${HOME}/.config/test.conf"
+
+ #
+ # Test 'guix home describe'.
+ #
+
+ configuration_file()
+ {
+ guix home describe \
+ | grep 'configuration file:' \
+ | cut -d : -f 2 \
+ | xargs echo
+ }
+ test "$(cat "$(configuration_file)")" == "$(cat home.scm)"
+
+ canonical_file_name()
+ {
+ guix home describe \
+ | grep 'canonical file name:' \
+ | cut -d : -f 2 \
+ | xargs echo
+ }
+ test "$(canonical_file_name)" == "$(readlink "${HOME}/.guix-home")"
+
+ #
+ # Test 'guix home search'.
+ #
+
+ guix home search mcron | grep "^name: home-mcron"
+ guix home search job manager | grep "^name: home-mcron"
+)
--
2.33.0
Oleg.
-----BEGIN PGP SIGNATURE-----

iQJIBAEBCgAyFiEEcjhxI46s62NFSFhXFn+OpQAa+pwFAmFhjvAUHGdvLndpZ3Vz
dEBnbWFpbC5jb20ACgkQFn+OpQAa+pxhjRAAp8Ziczp2YkY9v3aT1zxhSWkJR3k9
p4lRboOXszQTU5ois0E8gof/dDE83Iy7ZD2/fl8KkHDmw/avzY21eaLwnYpLzh2s
0Ib0GJFdKqN9DLdjKIAOXuT0OocjqfLLwXeXbUL8llGJ0CCIoTOE5lnIzh3BvqvS
ubBBiqTIUxHjR/GBWn0cAcce9oinTu93gHpLmLey/t+2oKLwWBxKQLYBDRgEAmfP
n1XxWgNChnlj7QVyKwxKefjnPS0R2YLz5tY4jjQRrn9A8eHcyoZxhNDqA81uYdnZ
heDFYdXfAOHBiq+hib3aXDQ6joK1IgOKTIomZd4mJBDV7YaZwIZ9srW34fF5Ryvd
sSqMBHsuH5HwBMTMXlLd6GAgYYH2ODk4F1fwsBPZNQyLlUcOyWK6A2fAk204ddG4
6eMN1BhOna/NxwoESpGJi1IN1HslawYEU2TiB6Gu1VR1GBimBAiixR9f/RqeNpSy
IS/rPTse1TF+wgtQwRMMaePx9h75q2ncBk+f75Oliyzt2DgwMYSqQwDn9BYnWgeQ
y7zOkkBfnuasL+fDcn9KlMhaTB8hmJkvZwLAsMApcKWXdbmFv5TNwVPA0oqNxGW4
A/IcAIXlSr0RoSXXggpn04xyL7JDaPpNSSpKOFvijhOtvx6IUV7esJfMZGjMZudI
UgJkS8yXizP2jvw=
=R6Ys
-----END PGP SIGNATURE-----

L
L
Ludovic Courtès wrote on 9 Oct 2021 15:34
Re: [bug#50967] file-like objects instead of gexps
(name . Andrew Tropin)(address . andrew@trop.in)
8735paz5hj.fsf@gnu.org
Hi Andrew,

Preamble: Guix Home is now committed and there are bug reports coming
in. To me, that means our discussion needs to be focused on addressing
specific issues; we’re not going to redesign Guix services in this
thread.

Andrew Tropin <andrew@trop.in> skribis:

[...]

Toggle quote (18 lines)
>> Then that’s fine: you can have special code that emits those “source”
>> lines in .zshrc while still allowing users to provide their own
>> file-like object for .zshrc lines they want to add. Again, see how
>> ‘torrc’ is generated in ‘tor-service-type’.
>
> From what I understand you want a separate bashrc-file,
> bash-profile-file and bash-logout-file fields to be present, but where
> the content of those files should be inserted? At the beginning/end or
> instead of the rest of configuration?
>
> We already can achieve the same result by providing gexp, which will
> read the content of the file-like object, a very small helper for that
> (slurp-file-gexp) makes it even easier to do. Such approach is more
> flexible and doesn't seem much harder.
>
> I remember that you had concerns about slurp-file-gexp, but still don't
> understand what exactly you are concerned about.

Let me restate my concerns:

1. Users are unlikely to fathom what this does, given the name. It
will end up in user configurations, yet: “slurp”? “gexp”?

2. ‘slurp-file-gexp’ returns code, as a gexp. Depending on the place
where that gexp is inserted, it may or may not work. Consider:

(define (foo x)
#~(frob '(#$x)))

(foo (slurp-file-gexp …)) ;d’oh!

3. Use of ‘slurp-file-gexp’ and gexps in configuration records is not
consistent with the rest of the service APIs (and I think we can
humbly recognize that those APIs have been doing the job for a
while already.)

Let’s just to the (call-with-input-file file get-string-all) dance in
places where it’s needed rather than let users call ‘slurp-file-gexp’.
This is roughly what the ‘tor-service-type’ example I gave does.

Toggle quote (4 lines)
> I'll write a few examples of service configurations and rationale behind
> the design descisions for that next week, to make the discussion more
> practically oriented.

People are starting to use the tool and to report bugs. So,
unfortunately, we have to sort out interface issues quickly now.

If some of the things being discussed turn out to be too complex to
address under those time constraints, we can consider taking them out
until we have a better idea on how to address them.

How does that sound?

Thanks,
Ludo’.
L
L
Ludovic Courtès wrote on 9 Oct 2021 16:34
Re: bug#50967: [PATCH 00/12] Move (gnu home-services XYZ) to (gnu services XYZ)
(name . Oleg Pykhalov)(address . go.wigust@gmail.com)
874k9qxo5j.fsf_-_@gnu.org
Oleg Pykhalov <go.wigust@gmail.com> skribis:

Toggle quote (17 lines)
> Ludovic Courtès <ludo@gnu.org> writes:
>
>>> From eec2ab5f514ec6e156244898f8a635baf323ab70 Mon Sep 17 00:00:00 2001
>>> From: Oleg Pykhalov <go.wigust@gmail.com>
>>> Date: Tue, 5 Oct 2021 02:10:25 +0300
>>> Subject: [PATCH] scripts: home: Make sure profile directory exists.
>
> […]
>
>> Also, wouldn’t it be easier to set HOME to a new directory?
>>
>>> + guix home reconfigure "${test_directory}/home.scm"
>
> We probably should clean temporary $HOME directory with 'rm -rf' or
> delete each file with 'rm' and then invoke 'rmdir' inside a Bash's
> 'trap'. I fill worry about removing operations on $HOME directories.

Like you wrote, the trap should “rm -rf $test_directory” rather than “rm
-rf $HOME”. It’s safer. :-)

Toggle quote (6 lines)
> Also returned Andrew's 'guix home search' tests.
>
> And 'home-bash-service-type' is replaced with 'simple-service' to not to
> block the guix-home.sh test from merging in master until completion of
> discussion about file-like objects.

OK.

Toggle quote (7 lines)
> From 4b29f7f1592f4256c7cd628624d2225e2d427a9d Mon Sep 17 00:00:00 2001
> From: Oleg Pykhalov <go.wigust@gmail.com>
> Date: Sat, 9 Oct 2021 14:52:10 +0300
> Subject: [PATCH 1/2] scripts: home: Make sure profile directory exists.
>
> * guix/scripts/home.scm (process-action): Make sure profile directory exists.

LGTM.

Toggle quote (8 lines)
> From 5cc0b064af3f4a6238722fbb451a98b499c8d6d2 Mon Sep 17 00:00:00 2001
> From: Oleg Pykhalov <go.wigust@gmail.com>
> Date: Sat, 9 Oct 2021 14:52:13 +0300
> Subject: [PATCH 2/2] tests: Add guix-home.sh.
>
> * tests/guix-home.sh: New file.
> * Makefile.am (SH_TESTS): Add this.

LGTM, thanks!

Ludo’.
O
O
Oleg Pykhalov wrote on 9 Oct 2021 21:39
(address . 50967-done@debbugs.gnu.org)
875yu66l8t.fsf_-_@gmail.com
Merged 2 patches from the current issue.

Also:
- Moved (gnu home-services) to (gnu services).
- Added two tests for home-bash-service-type.
- Fixed the documentation.

Oleg.
-----BEGIN PGP SIGNATURE-----

iQJIBAEBCgAyFiEEcjhxI46s62NFSFhXFn+OpQAa+pwFAmFh7/IUHGdvLndpZ3Vz
dEBnbWFpbC5jb20ACgkQFn+OpQAa+pz2rQ/6A1YnmtivFWAzKmdiQeNT6PM5TnoG
LHhgtOocRmBAQ5z8Y0lZycxdW+VKSOAjOwnbkxfTq8+i9vBw5pWTLB1T8QrUMfDO
OiX+BUxM/It635n5J9jhbuHeU8mabsTLcsV0/bw1Q0iKfnRiEIdyL4gmjMZUBIFj
lssP4GtvMKRuU7qU/lIJ8Z6DZHf07q6+1x+2HMr9oej3XR510pwPAKsTVJrYRpln
y8+NCRD87JbzlilJdfyBU7TrmH3ASYu3ys7hb40g1rqNRj/61B65fRwxVWTQM7zm
PoHwziNkP5BEJ0IdtGXHSv/6RY/5JqhikuN8PzXjazoU3E10d3oyu1ayGkcTLd58
ZMHJMc5wZkmNOxbtqIwoIT1beQhwJwAG173aQSDBjvfCeVE92WFJN0mX92bM324P
7wc+DaTxoTSWSksaLekgFzdA0lujTYcVGWkkwCv/DTYmLMQbnDOYy7dQXv1coKHw
1Uod6IJ2IsIJoEYQx96hjZjItBvg4NZxeR0+LMx332Y8ceX2wryj+SWXEAZ/62Rd
F56ax54jyUH3qnfAKKCsZM/4T6iHIxi18NEFSw579MwufzPggAh20drofCzRMSw1
AjPI1xwDNEb8492dGxw58Rmg7Z7aQPvC1C15/gHFFlDWwIru+G4C2cHy85PgkPoI
dKSe8YJjQXH/Cdg=
=7+Ln
-----END PGP SIGNATURE-----

Closed
A
A
Andrew Tropin wrote on 14 Oct 2021 10:32
Re: [bug#50967] file-like objects instead of gexps
(name . Ludovic Courtès)(address . ludo@gnu.org)
877degt39o.fsf@trop.in
On 2021-10-09 15:34, Ludovic Courtès wrote:

Toggle quote (34 lines)
> Hi Andrew,
>
> Preamble: Guix Home is now committed and there are bug reports coming
> in. To me, that means our discussion needs to be focused on addressing
> specific issues; we’re not going to redesign Guix services in this
> thread.
>
> Andrew Tropin <andrew@trop.in> skribis:
>
> [...]
>
>>> Then that’s fine: you can have special code that emits those “source”
>>> lines in .zshrc while still allowing users to provide their own
>>> file-like object for .zshrc lines they want to add. Again, see how
>>> ‘torrc’ is generated in ‘tor-service-type’.
>>
>> From what I understand you want a separate bashrc-file,
>> bash-profile-file and bash-logout-file fields to be present, but where
>> the content of those files should be inserted? At the beginning/end or
>> instead of the rest of configuration?
>>
>> We already can achieve the same result by providing gexp, which will
>> read the content of the file-like object, a very small helper for that
>> (slurp-file-gexp) makes it even easier to do. Such approach is more
>> flexible and doesn't seem much harder.
>>
>> I remember that you had concerns about slurp-file-gexp, but still don't
>> understand what exactly you are concerned about.
>
> Let me restate my concerns:
>
> 1. Users are unlikely to fathom what this does, given the name. It
> will end up in user configurations, yet: “slurp”? “gexp”?

Sounds like a naming conecrn, I brought "slurp" word from clojure lang,
but we can call it whatever sounds better for guile community
generate-read-whole-file-gexp or anything else. Actually, we don't even
need to have this wrapper to be present, just allow people to do
#~(call-with-input-file file-like-object get-string-all)

Toggle quote (9 lines)
>
> 2. ‘slurp-file-gexp’ returns code, as a gexp. Depending on the place
> where that gexp is inserted, it may or may not work. Consider:
>
> (define (foo x)
> #~(frob '(#$x)))
>
> (foo (slurp-file-gexp …)) ;d’oh!

Yep, users can make mistakes, but it's not a technical problem, also, I
see it quite unlikely to happen according to my experience supporting
Guix Home users.

Toggle quote (6 lines)
>
> 3. Use of ‘slurp-file-gexp’ and gexps in configuration records is not
> consistent with the rest of the service APIs (and I think we can
> humbly recognize that those APIs have been doing the job for a
> while already.)

It's not actually true, there are system services, which accept a list
of strings/gexps and state it in the documentation, some of them do it
in a less exlicit way, but still do, I found that trick looking at
system service and made it an explicit pattern for home services. I
tried to extract and follow patterns from system services, but found
them quite inconsistent, so I took a few of them and wrote a few on my
own.

To name a few:
extra-options @ alsa-configuration
extra-config @ nix-configuration
extra-config @ xorg-configuration
extra-content @ nginx-configuration
extra-config @ httpd-config-file
contents @ httpd-virtualhost

To make guix services configurations consistent (at least new ones) I
think it would be cool to have a `Writing Service Configuration
Guideline` section. I can share the design descisions I've made for
home services configurations and after a discussion it can end up in a
manual section giving a clean guideline, reducing subjective preferences
and increasing consistency. If you are interested.

Toggle quote (21 lines)
>
> Let’s just to the (call-with-input-file file get-string-all) dance in
> places where it’s needed rather than let users call ‘slurp-file-gexp’.
> This is roughly what the ‘tor-service-type’ example I gave does.
>
>> I'll write a few examples of service configurations and rationale behind
>> the design descisions for that next week, to make the discussion more
>> practically oriented.
>
> People are starting to use the tool and to report bugs. So,
> unfortunately, we have to sort out interface issues quickly now.
>
> If some of the things being discussed turn out to be too complex to
> address under those time constraints, we can consider taking them out
> until we have a better idea on how to address them.
>
> How does that sound?
>
> Thanks,
> Ludo’.

--
Best regards,
Andrew Tropin
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCgAdFiEEKEGaxlA4dEDH6S/6IgjSCVjB3rAFAmFn6zMACgkQIgjSCVjB
3rAFmxAAhWoc6Fs4B3yuXz6iCvSiZiYFd0+/MR4EW3rCwKzaSFTMiojRGu0C0U6D
yhvUFbzghc2g+HOdzLicLzFB5JPnCmOWnCtU6p1cKJVJfgSwIiKrYAoy7hXBpued
NnwIFZsfclCywgs5AQ/Tus4lrSX+wkw0dfbTUTDjTyKYxQlMXH0EchBX4G6X/qNW
CWqsBw0nnmWBfuPfS+Y2Y/o5x836eBIhlFfw5yBD9uH/7/ezD3XtxXmJASj0cDVK
ZMIHOJ5Q1oohWdxVGKLZA8fOn1G0W/wTUUVrJ6gFwt+cRtIPEk+KHoH6sDI2fpBb
+UZncqcd7s+cY4qAsPO2Vbn5WQen1mZZu/MpxDmwW+deU3STVCiD/bsOK27NTlnc
u5w1CTMrZoRT4wlgy3eul6I5rPpJ3XGSJ+DlGADluDeiOn94bK2pvpwBmL4VxGy8
LC1z4whF9nvKqTbRcVfx4JHS0jNiMmGQTpZUwQu6qc9vFMKbl4agHbwGy5KpkcCA
N6+P2MXXy/02H9rtG18xXHE2QzrEkDPY0PgdXBtGkXwNuYVEOM7wKj+7xnh22jVE
G3UGrwNlG5ToPavLnYiUzQmfMvtSALYQq4t504ndZJtKBF/KoHEnqc2ORTl8Wovh
VCF/FSg74jphE/2LZ6fgdx8L4j5OxBNdrKg+vhaJq3zzV81U+98=
=N8EQ
-----END PGP SIGNATURE-----

A
A
Andrew Tropin wrote on 14 Oct 2021 09:08
Re: [bug#50967] [PATCH 13/14] home: services: configuration: Support file-like objects.
(name . Oleg Pykhalov)(address . go.wigust@gmail.com)
87lf2wt770.fsf@trop.in
On 2021-10-02 19:38, Oleg Pykhalov wrote:

Toggle quote (27 lines)
> * gnu/home/services/configuration.scm (interpose): Include content of files.
> (string-or-gexp?): Rename to 'file-or-string-or-gexp?' and check for file-like
> object.
> (serialize-string-or-gexp): Rename to 'serialize-file-or-string-or-gexp'.
> (text-config?): Call 'file-or-string-or-gexp?' 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 | 14 ++++++++++----
> guix/scripts/home/import.scm | 8 +++-----
> 2 files changed, 13 insertions(+), 9 deletions(-)
>
> diff --git a/gnu/home/services/configuration.scm b/gnu/home/services/configuration.scm
> index 5e7743e7d6..39db7a5693 100644
> --- a/gnu/home/services/configuration.scm
> +++ b/gnu/home/services/configuration.scm
> @@ -59,7 +59,12 @@ DELIMITER interposed LS. Support 'infix and 'suffix GRAMMAR values."
> (G_ "The GRAMMAR value must be 'infix or 'suffix, but ~a provided.")
> grammar)))
> (fold-right (lambda (e acc)
> - (cons e
> + (cons (if (file-like? e)
> + #~(begin
> + (use-modules (ice-9 rdelim))
> + (with-fluids ((%default-port-encoding "UTF-8"))
> + (with-input-from-file #$e read-string)))

This transformation should not be a part of interpose function,
interpose does know nothing about elements type and doesn't have to
know. This addition is semantically incorrect and also contradictionary
to docstring. It also breaks downstream channels.

The version of change in master is different, it doesn't even check
element type.

I'm strongly against this change. If it necessary to make
transformation of elements of the list it should be done outside of
interpose.

Toggle quote (44 lines)
> + e)
> (if (and (null? acc) (eq? grammar 'infix))
> acc
> (cons delimiter acc))))
> @@ -79,11 +84,12 @@ the list result in @code{#t} when applying PRED? on them."
>
> (define alist? list?)
>
> -(define (string-or-gexp? sg) (or (string? sg) (gexp? sg)))
> -(define (serialize-string-or-gexp field-name val) "")
> +(define (file-or-string-or-gexp? fsg)
> + (or (string? fsg) (gexp? fsg) (file-like? fsg)))
> +(define (serialize-file-or-string-or-gexp field-name val) "")
>
> (define (text-config? config)
> - (and (list? config) (every string-or-gexp? config)))
> + (and (list? config) (every file-or-string-or-gexp? config)))
> (define (serialize-text-config field-name val)
> #~(string-append #$@(interpose val "\n" 'suffix)))
>
> 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))))
> '()))))))

--
Best regards,
Andrew Tropin
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCgAdFiEEKEGaxlA4dEDH6S/6IgjSCVjB3rAFAmFn11MACgkQIgjSCVjB
3rA3rA/+PmhNFEq+nSRe6Wi6emqP8ZZoCFFihnRtCzXAp3mMs+asZo5VL/JbMVWu
Yvq45rsKBokEzzln6q2qemP4TJRSv+1NIjnNQXaRPCvh37iLyp7KRthc/bEs5nC9
pdoor2W1cYRmoJAN7G2JTcRtiluStmrfwKdOsZ7ULGzFQgVghAfQyb6JZ4oMEEdr
gcS+ypoDLLVwLIDYQ1mxd87naAQFQYhWAS+KThEx7bh+HfoIRewnPSZHtjBlk0oM
dZ+QIDN2t2OWztNR42meJjKF+p0QFiRO9FEfnV3v10XbjLxwFukvt5VilmPb0W2b
jOrkGQfKWt/W0Q1Wfx5qiXz/lllcSOPZAeeZFexKO3zJZIbmsf9ygDBSWW3GgN1p
17SpkURXKTXld49/0tphEtzHhdmwOHZovk/gsFHWWxtvyG4rZ1V+vjhKcNzX8/tp
EUuRY/Usb0Hs3yo4NaoS180jw2dE6ghou3mDJ3wGkCPMuPXYEMgZx0M+xHUmOeIo
bai7hkjHjOv8jfwcCv5/XTTSN7ZsO8L9n2AADdYKxdPrSxtAsFAilPxkZ7qIPQ7r
256kURW7DncRtcvizL5INpee3igXycIjIh7YHVqvRzqJJbClz+a6ohMrC0U5pxJf
BIDuRh4/Shqlmv2c9Z7VB5G7fYMbGEK/4Gn6f04ygK+bsX00RR8=
=UjUv
-----END PGP SIGNATURE-----

?