all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Ludovic Courtès" <ludo@gnu.org>
To: 74860@debbugs.gnu.org
Cc: "Ludovic Courtès" <ludo@gnu.org>
Subject: [bug#74860] [PATCH 09/10] home: Define ‘%base-home-services’.
Date: Fri, 13 Dec 2024 23:58:29 +0100	[thread overview]
Message-ID: <2dc7577f5d1ea86b390b7dc48b82cf887f29020e.1734129908.git.ludo@gnu.org> (raw)
In-Reply-To: <cover.1734129908.git.ludo@gnu.org>

* gnu/home.scm (%base-home-services): New variable.
(<home-environment>)[services]: Change default to ‘%base-home-services’.
* guix/scripts/home/import.scm (manifest+configuration-files->code): Use
‘%base-home-services’ by default.
* tests/home-import.scm (match-home-environment-no-services)
(match-home-environment-transformations)
(match-home-environment-no-services-nor-packages)
(match-home-environment-bash-service)
(match-home-environment-bash-service-with-alias): Adjust accordingly.
* doc/he-config-bare-bones.scm: Use ‘%base-home-services’.
* doc/guix.texi (Declaring the Home Environment): Add index entry for
‘%base-home-services’.

Change-Id: Id95ede62b97a976aad138bfc4b63fc0bdf37c7de
---
 doc/guix.texi                |  1 +
 doc/he-config-bare-bones.scm | 27 ++++++++++++------------
 gnu/home.scm                 | 11 ++++++++--
 guix/scripts/home/import.scm |  8 +++++---
 tests/home-import.scm        | 40 +++++++++++++++++++-----------------
 5 files changed, 50 insertions(+), 37 deletions(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index 788a9b4957..adcae42523 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -45563,6 +45563,7 @@ Declaring the Home Environment
 @end quotation
 
 @findex home-environment
+@vindex %base-home-services
 @lisp
 @include he-config-bare-bones.scm
 @end lisp
diff --git a/doc/he-config-bare-bones.scm b/doc/he-config-bare-bones.scm
index f948d85277..844d666110 100644
--- a/doc/he-config-bare-bones.scm
+++ b/doc/he-config-bare-bones.scm
@@ -7,19 +7,20 @@
 
 
 (home-environment
- (packages (list htop))
- (services
-  (list
-   (service home-bash-service-type
-            (home-bash-configuration
-             (guix-defaults? #t)
-             (bash-profile (list (plain-file "bash-profile" "\
+  (packages (list htop))
+  (services
+   (append (list
+            (service home-bash-service-type
+                     (home-bash-configuration
+                      (guix-defaults? #t)
+                      (bash-profile (list (plain-file "bash-profile" "\
 export HISTFILE=$XDG_CACHE_HOME/.bash_history")))))
 
-   (simple-service 'test-config
-                   home-xdg-configuration-files-service-type
-                   (list `("test.conf"
-                           ,(plain-file "tmp-file.txt"
-                                        "the content of
-                                          ~/.config/test.conf")))))))
+            (simple-service 'test-config
+                            home-xdg-configuration-files-service-type
+                            (list `("test.conf"
+                                    ,(plain-file "tmp-file.txt"
+                                                 "the content of
+                                          ~/.config/test.conf")))))
+           %base-home-services)))
 
diff --git a/gnu/home.scm b/gnu/home.scm
index b390c8d534..042d2e67de 100644
--- a/gnu/home.scm
+++ b/gnu/home.scm
@@ -23,6 +23,7 @@ (define-module (gnu home)
   #:use-module (gnu home services shells)
   #:use-module (gnu home services xdg)
   #:use-module (gnu home services fontutils)
+  #:use-module (gnu home services admin)
   #:use-module (gnu services)
   #:use-module (guix records)
   #:use-module (guix diagnostics)
@@ -43,7 +44,9 @@ (define-module (gnu home)
 
             home-environment-with-provenance
 
-            home-generation-base))
+            home-generation-base
+
+            %base-home-services))
 
 ;;; Comment:
 ;;;
@@ -67,7 +70,7 @@ (define-record-type* <home-environment> home-environment
                                 this-home-environment)))
 
   (services           home-environment-user-services
-                      (default '())
+                      (default %base-home-services)
                       (sanitize validate-service-list))
 
   (location           home-environment-location            ; <location>
@@ -75,6 +78,10 @@ (define-record-type* <home-environment> home-environment
                                       source-properties->location))
                       (innate)))
 
+(define %base-home-services
+  ;; Non-essential but useful services to have by default.
+  '())
+
 (define (home-environment-default-essential-services he)
   "Return the list of essential services for home environment."
   (list
diff --git a/guix/scripts/home/import.scm b/guix/scripts/home/import.scm
index fd263c0699..15b4bc9798 100644
--- a/guix/scripts/home/import.scm
+++ b/guix/scripts/home/import.scm
@@ -1,7 +1,7 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2021 Xinglu Chen <public@yoctocell.xyz>
 ;;; Copyright © 2021 Andrew Tropin <andrew@trop.in>
-;;; Copyright © 2021-2022 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2021-2022, 2024 Ludovic Courtès <ludo@gnu.org>
 ;;; Copyright © 2022 Arjan Adriaanse <arjan@adriaan.se>
 ;;; Copyright © 2022 Antero Mejr <antero@mailbox.org>
 ;;;
@@ -160,7 +160,8 @@ (define (manifest+configuration-files->code manifest
 
            (home-environment
             (packages ,packages)
-            (services (list ,@services)))))))
+            (services (append (list ,@services)
+                              %base-home-services)))))))
     (('begin ('specifications->manifest packages))
      (match (configurations+modules configuration-directory)
        (((services . modules) ...)
@@ -183,7 +184,8 @@ (define (manifest+configuration-files->code manifest
             ,(comment (G_ "\
 ;; Below is the list of Home services.  To search for available
 ;; services, run 'guix home search KEYWORD' in a terminal.\n"))
-            (services (list ,@services)))))))))
+            (services (append (list ,@services)
+                              %base-home-services)))))))))
 
 (define* (import-manifest
           manifest destination-directory
diff --git a/tests/home-import.scm b/tests/home-import.scm
index 04b7b76156..57a3d62a72 100644
--- a/tests/home-import.scm
+++ b/tests/home-import.scm
@@ -115,7 +115,7 @@ (define-home-environment-matcher match-home-environment-no-services
       ('specifications->packages
        ('list "guile@2.0.9" "gcc:lib" "glibc@2.19")))
      ('services
-      ('list)))))
+      ('append ('list) '%base-home-services)))))
 
 (define-home-environment-matcher match-home-environment-transformations
   ('begin
@@ -131,7 +131,7 @@ (define-home-environment-matcher match-home-environment-transformations
       ('list (transform ('specification->package "guile@2.0.9"))
              ('list ('specification->package "gcc") "lib")
              ('specification->package "glibc@2.19")))
-     ('services ('list)))))
+     ('services ('append ('list) '%base-home-services)))))
 
 (define-home-environment-matcher match-home-environment-no-services-nor-packages
   ('begin
@@ -143,7 +143,7 @@ (define-home-environment-matcher match-home-environment-no-services-nor-packages
      ('packages
       ('specifications->packages ('list)))
      ('services
-      ('list)))))
+      ('append ('list) '%base-home-services)))))
 
 (define-home-environment-matcher match-home-environment-bash-service
   ('begin
@@ -157,13 +157,14 @@ (define-home-environment-matcher match-home-environment-bash-service
      ('packages
       ('specifications->packages ('list)))
      ('services
-      ('list ('service
-              'home-bash-service-type
-              ('home-bash-configuration
-               ('aliases ('quote ()))
-               ('bashrc
-                ('list ('local-file "/tmp/guix-config/.bashrc"
-                                    "bashrc"))))))))))
+      (append ('list ('service
+                      'home-bash-service-type
+                      ('home-bash-configuration
+                       ('aliases ('quote ()))
+                       ('bashrc
+                        ('list ('local-file "/tmp/guix-config/.bashrc"
+                                            "bashrc"))))))
+              '%base-home-services)))))
 
 (define-home-environment-matcher match-home-environment-bash-service-with-alias
   ('begin
@@ -177,15 +178,16 @@ (define-home-environment-matcher match-home-environment-bash-service-with-alias
      ('packages
       ('specifications->packages ('list)))
      ('services
-      ('list ('service
-              'home-bash-service-type
-              ('home-bash-configuration
-               ('aliases
-                ('quote (("grep" . "grep --exclude-from=\"$HOME/.grep-exclude\"")
-                         ("ls" . "ls -p"))))
-               ('bashrc
-                ('list ('local-file "/tmp/guix-config/.bashrc"
-                                    "bashrc"))))))))))
+      ('append ('list ('service
+                       'home-bash-service-type
+                       ('home-bash-configuration
+                        ('aliases
+                         ('quote (("grep" . "grep --exclude-from=\"$HOME/.grep-exclude\"")
+                                  ("ls" . "ls -p"))))
+                        ('bashrc
+                         ('list ('local-file "/tmp/guix-config/.bashrc"
+                                             "bashrc"))))))
+               '%base-home-services)))))
 
 
 (test-assert "manifest->code: No services"
-- 
2.46.0





  parent reply	other threads:[~2024-12-13 23:03 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-13 22:55 [bug#74860] [PATCH 00/10] Using the Shepherd's log rotation service Ludovic Courtès
2024-12-13 22:58 ` [bug#74860] [PATCH 01/10] gnu: shepherd@1.0: Add dependency on gzip and zstd Ludovic Courtès
2024-12-13 22:58 ` [bug#74860] [PATCH 02/10] services: Add ‘log-rotation-service-type’ Ludovic Courtès
2024-12-13 22:58 ` [bug#74860] [PATCH 03/10] services: log-cleanup: Rewrite as a Shepherd timer Ludovic Courtès
2024-12-13 22:58 ` [bug#74860] [PATCH 04/10] services: unattended-upgrade: " Ludovic Courtès
2024-12-13 22:58 ` [bug#74860] [PATCH 05/10] services: Switch from mcron + Rottlog to Shepherd’s log rotation Ludovic Courtès
2024-12-13 22:58 ` [bug#74860] [PATCH 06/10] services: rottlog: Deprecate Ludovic Courtès
2024-12-13 22:58 ` [bug#74860] [PATCH 07/10] DRAFT news: Add entry for ‘rottlog-service-type’ deprecation Ludovic Courtès
2024-12-13 22:58 ` [bug#74860] [PATCH 08/10] home: services: Add log rotation service Ludovic Courtès
2024-12-13 22:58 ` Ludovic Courtès [this message]
2024-12-13 22:58 ` [bug#74860] [PATCH 10/10] home: Add log rotation to ‘%base-home-services’ Ludovic Courtès
2024-12-13 23:20 ` [bug#74860] [PATCH 00/10] Using the Shepherd's log rotation service Ludovic Courtès

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2dc7577f5d1ea86b390b7dc48b82cf887f29020e.1734129908.git.ludo@gnu.org \
    --to=ludo@gnu.org \
    --cc=74860@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.