mirror of
https://git.savannah.gnu.org/git/guix.git
synced 2025-01-30 14:26:48 +01:00
home: Define ‘%base-home-services’.
* 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
This commit is contained in:
parent
f68060a101
commit
0aa45f1854
5 changed files with 50 additions and 37 deletions
|
@ -46272,6 +46272,7 @@ it manually. (@pxref{Configuring the Shell}).
|
||||||
@end quotation
|
@end quotation
|
||||||
|
|
||||||
@findex home-environment
|
@findex home-environment
|
||||||
|
@vindex %base-home-services
|
||||||
@lisp
|
@lisp
|
||||||
@include he-config-bare-bones.scm
|
@include he-config-bare-bones.scm
|
||||||
@end lisp
|
@end lisp
|
||||||
|
|
|
@ -7,19 +7,20 @@
|
||||||
|
|
||||||
|
|
||||||
(home-environment
|
(home-environment
|
||||||
(packages (list htop))
|
(packages (list htop))
|
||||||
(services
|
(services
|
||||||
(list
|
(append (list
|
||||||
(service home-bash-service-type
|
(service home-bash-service-type
|
||||||
(home-bash-configuration
|
(home-bash-configuration
|
||||||
(guix-defaults? #t)
|
(guix-defaults? #t)
|
||||||
(bash-profile (list (plain-file "bash-profile" "\
|
(bash-profile (list (plain-file "bash-profile" "\
|
||||||
export HISTFILE=$XDG_CACHE_HOME/.bash_history")))))
|
export HISTFILE=$XDG_CACHE_HOME/.bash_history")))))
|
||||||
|
|
||||||
(simple-service 'test-config
|
(simple-service 'test-config
|
||||||
home-xdg-configuration-files-service-type
|
home-xdg-configuration-files-service-type
|
||||||
(list `("test.conf"
|
(list `("test.conf"
|
||||||
,(plain-file "tmp-file.txt"
|
,(plain-file "tmp-file.txt"
|
||||||
"the content of
|
"the content of
|
||||||
~/.config/test.conf")))))))
|
~/.config/test.conf")))))
|
||||||
|
%base-home-services)))
|
||||||
|
|
||||||
|
|
11
gnu/home.scm
11
gnu/home.scm
|
@ -23,6 +23,7 @@ (define-module (gnu home)
|
||||||
#:use-module (gnu home services shells)
|
#: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 home services fontutils)
|
||||||
|
#:use-module (gnu home services admin)
|
||||||
#:use-module (gnu services)
|
#:use-module (gnu services)
|
||||||
#:use-module (guix records)
|
#:use-module (guix records)
|
||||||
#:use-module (guix diagnostics)
|
#:use-module (guix diagnostics)
|
||||||
|
@ -43,7 +44,9 @@ (define-module (gnu home)
|
||||||
|
|
||||||
home-environment-with-provenance
|
home-environment-with-provenance
|
||||||
|
|
||||||
home-generation-base))
|
home-generation-base
|
||||||
|
|
||||||
|
%base-home-services))
|
||||||
|
|
||||||
;;; Comment:
|
;;; Comment:
|
||||||
;;;
|
;;;
|
||||||
|
@ -67,7 +70,7 @@ (define-record-type* <home-environment> home-environment
|
||||||
this-home-environment)))
|
this-home-environment)))
|
||||||
|
|
||||||
(services home-environment-user-services
|
(services home-environment-user-services
|
||||||
(default '())
|
(default %base-home-services)
|
||||||
(sanitize validate-service-list))
|
(sanitize validate-service-list))
|
||||||
|
|
||||||
(location home-environment-location ; <location>
|
(location home-environment-location ; <location>
|
||||||
|
@ -75,6 +78,10 @@ (define-record-type* <home-environment> home-environment
|
||||||
source-properties->location))
|
source-properties->location))
|
||||||
(innate)))
|
(innate)))
|
||||||
|
|
||||||
|
(define %base-home-services
|
||||||
|
;; Non-essential but useful services to have by default.
|
||||||
|
'())
|
||||||
|
|
||||||
(define (home-environment-default-essential-services he)
|
(define (home-environment-default-essential-services he)
|
||||||
"Return the list of essential services for home environment."
|
"Return the list of essential services for home environment."
|
||||||
(list
|
(list
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
;;; GNU Guix --- Functional package management for GNU
|
;;; GNU Guix --- Functional package management for GNU
|
||||||
;;; Copyright © 2021 Xinglu Chen <public@yoctocell.xyz>
|
;;; Copyright © 2021 Xinglu Chen <public@yoctocell.xyz>
|
||||||
;;; Copyright © 2021 Andrew Tropin <andrew@trop.in>
|
;;; 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 Arjan Adriaanse <arjan@adriaan.se>
|
||||||
;;; Copyright © 2022 Antero Mejr <antero@mailbox.org>
|
;;; Copyright © 2022 Antero Mejr <antero@mailbox.org>
|
||||||
;;;
|
;;;
|
||||||
|
@ -160,7 +160,8 @@ (define (manifest+configuration-files->code manifest
|
||||||
|
|
||||||
(home-environment
|
(home-environment
|
||||||
(packages ,packages)
|
(packages ,packages)
|
||||||
(services (list ,@services)))))))
|
(services (append (list ,@services)
|
||||||
|
%base-home-services)))))))
|
||||||
(('begin ('specifications->manifest packages))
|
(('begin ('specifications->manifest packages))
|
||||||
(match (configurations+modules configuration-directory)
|
(match (configurations+modules configuration-directory)
|
||||||
(((services . modules) ...)
|
(((services . modules) ...)
|
||||||
|
@ -183,7 +184,8 @@ (define (manifest+configuration-files->code manifest
|
||||||
,(comment (G_ "\
|
,(comment (G_ "\
|
||||||
;; Below is the list of Home services. To search for available
|
;; Below is the list of Home services. To search for available
|
||||||
;; services, run 'guix home search KEYWORD' in a terminal.\n"))
|
;; services, run 'guix home search KEYWORD' in a terminal.\n"))
|
||||||
(services (list ,@services)))))))))
|
(services (append (list ,@services)
|
||||||
|
%base-home-services)))))))))
|
||||||
|
|
||||||
(define* (import-manifest
|
(define* (import-manifest
|
||||||
manifest destination-directory
|
manifest destination-directory
|
||||||
|
|
|
@ -115,7 +115,7 @@ (define-home-environment-matcher match-home-environment-no-services
|
||||||
('specifications->packages
|
('specifications->packages
|
||||||
('list "guile@2.0.9" "gcc:lib" "glibc@2.19")))
|
('list "guile@2.0.9" "gcc:lib" "glibc@2.19")))
|
||||||
('services
|
('services
|
||||||
('list)))))
|
('append ('list) '%base-home-services)))))
|
||||||
|
|
||||||
(define-home-environment-matcher match-home-environment-transformations
|
(define-home-environment-matcher match-home-environment-transformations
|
||||||
('begin
|
('begin
|
||||||
|
@ -131,7 +131,7 @@ (define-home-environment-matcher match-home-environment-transformations
|
||||||
('list (transform ('specification->package "guile@2.0.9"))
|
('list (transform ('specification->package "guile@2.0.9"))
|
||||||
('list ('specification->package "gcc") "lib")
|
('list ('specification->package "gcc") "lib")
|
||||||
('specification->package "glibc@2.19")))
|
('specification->package "glibc@2.19")))
|
||||||
('services ('list)))))
|
('services ('append ('list) '%base-home-services)))))
|
||||||
|
|
||||||
(define-home-environment-matcher match-home-environment-no-services-nor-packages
|
(define-home-environment-matcher match-home-environment-no-services-nor-packages
|
||||||
('begin
|
('begin
|
||||||
|
@ -143,7 +143,7 @@ (define-home-environment-matcher match-home-environment-no-services-nor-packages
|
||||||
('packages
|
('packages
|
||||||
('specifications->packages ('list)))
|
('specifications->packages ('list)))
|
||||||
('services
|
('services
|
||||||
('list)))))
|
('append ('list) '%base-home-services)))))
|
||||||
|
|
||||||
(define-home-environment-matcher match-home-environment-bash-service
|
(define-home-environment-matcher match-home-environment-bash-service
|
||||||
('begin
|
('begin
|
||||||
|
@ -157,13 +157,14 @@ (define-home-environment-matcher match-home-environment-bash-service
|
||||||
('packages
|
('packages
|
||||||
('specifications->packages ('list)))
|
('specifications->packages ('list)))
|
||||||
('services
|
('services
|
||||||
('list ('service
|
(append ('list ('service
|
||||||
'home-bash-service-type
|
'home-bash-service-type
|
||||||
('home-bash-configuration
|
('home-bash-configuration
|
||||||
('aliases ('quote ()))
|
('aliases ('quote ()))
|
||||||
('bashrc
|
('bashrc
|
||||||
('list ('local-file "/tmp/guix-config/.bashrc"
|
('list ('local-file "/tmp/guix-config/.bashrc"
|
||||||
"bashrc"))))))))))
|
"bashrc"))))))
|
||||||
|
'%base-home-services)))))
|
||||||
|
|
||||||
(define-home-environment-matcher match-home-environment-bash-service-with-alias
|
(define-home-environment-matcher match-home-environment-bash-service-with-alias
|
||||||
('begin
|
('begin
|
||||||
|
@ -177,15 +178,16 @@ (define-home-environment-matcher match-home-environment-bash-service-with-alias
|
||||||
('packages
|
('packages
|
||||||
('specifications->packages ('list)))
|
('specifications->packages ('list)))
|
||||||
('services
|
('services
|
||||||
('list ('service
|
('append ('list ('service
|
||||||
'home-bash-service-type
|
'home-bash-service-type
|
||||||
('home-bash-configuration
|
('home-bash-configuration
|
||||||
('aliases
|
('aliases
|
||||||
('quote (("grep" . "grep --exclude-from=\"$HOME/.grep-exclude\"")
|
('quote (("grep" . "grep --exclude-from=\"$HOME/.grep-exclude\"")
|
||||||
("ls" . "ls -p"))))
|
("ls" . "ls -p"))))
|
||||||
('bashrc
|
('bashrc
|
||||||
('list ('local-file "/tmp/guix-config/.bashrc"
|
('list ('local-file "/tmp/guix-config/.bashrc"
|
||||||
"bashrc"))))))))))
|
"bashrc"))))))
|
||||||
|
'%base-home-services)))))
|
||||||
|
|
||||||
|
|
||||||
(test-assert "manifest->code: No services"
|
(test-assert "manifest->code: No services"
|
||||||
|
|
Loading…
Reference in a new issue