summaryrefslogtreecommitdiff
path: root/gnu/home/services.scm
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/home/services.scm')
-rw-r--r--gnu/home/services.scm60
1 files changed, 45 insertions, 15 deletions
diff --git a/gnu/home/services.scm b/gnu/home/services.scm
index 2a3cb44952..254663c6bb 100644
--- a/gnu/home/services.scm
+++ b/gnu/home/services.scm
@@ -30,6 +30,7 @@
#:use-module (guix discovery)
#:use-module (guix diagnostics)
#:use-module (guix i18n)
+ #:use-module (guix modules)
#:use-module (srfi srfi-1)
#:use-module (ice-9 match)
@@ -37,12 +38,17 @@
home-profile-service-type
home-environment-variables-service-type
home-files-service-type
+ home-xdg-configuration-files-service-type
home-run-on-first-login-service-type
home-activation-service-type
home-run-on-change-service-type
home-provenance-service-type
+ home-files-directory
+ xdg-configuration-files-directory
+
fold-home-service-types
+ home-provenance
%initialize-gettext)
@@ -72,12 +78,11 @@
;;; file (details described in the manual).
;;;
;;; home-files-service-type is similar to etc-service-type, but doesn't extend
-;;; home-activation, because deploy mechanism for config files is pluggable and
-;;; can be different for different home environments: The default one is called
-;;; symlink-manager (will be introudced in a separate patch series), which creates
-;;; links for various dotfiles (like $XDG_CONFIG_HOME/$APP/...) to store, but is
-;;; possible to implement alternative approaches like read-only home from Julien's
-;;; guix-home-manager.
+;;; home-activation, because deploy mechanism for config files is pluggable
+;;; and can be different for different home environments: The default one is
+;;; called symlink-manager, which creates links for various dotfiles and xdg
+;;; configuration files to store, but is possible to implement alternative
+;;; approaches like read-only home from Julien's guix-home-manager.
;;;
;;; home-run-on-first-login-service-type provides an @file{on-first-login} guile
;;; script, which runs provided gexps once, when user makes first login. It can
@@ -260,11 +265,14 @@ esac
(file-union "files" files))
+;; Used by symlink-manager
+(define home-files-directory "files")
+
(define (files-entry files)
"Return an entry for the @file{~/.guix-home/files}
directory containing FILES."
(with-monad %store-monad
- (return `(("files" ,(files->files-directory files))))))
+ (return `((,home-files-directory ,(files->files-directory files))))))
(define home-files-service-type
(service-type (name 'home-files)
@@ -274,20 +282,41 @@ directory containing FILES."
(compose concatenate)
(extend append)
(default-value '())
- (description "Configuration files for programs that
-will be put in @file{~/.guix-home/files}.")))
+ (description "Files that will be put in
+@file{~~/.guix-home/files}, and further processed during activation.")))
+
+(define xdg-configuration-files-directory "config")
+
+(define (xdg-configuration-files files)
+ "Add config/ prefix to each file-path in FILES."
+ (map (match-lambda
+ ((file-path . rest)
+ (cons (string-append xdg-configuration-files-directory "/" file-path)
+ rest)))
+ files))
+
+(define home-xdg-configuration-files-service-type
+ (service-type (name 'home-files)
+ (extensions
+ (list (service-extension home-files-service-type
+ xdg-configuration-files)))
+ (compose concatenate)
+ (extend append)
+ (default-value '())
+ (description "Files that will be put in
+@file{~~/.guix-home/files/config}, and further processed during activation.")))
(define %initialize-gettext
#~(begin
(bindtextdomain %gettext-domain
(string-append #$guix "/share/locale"))
- (textdomain %gettext-domain)
- (setlocale LC_ALL "")))
+ (textdomain %gettext-domain)))
(define (compute-on-first-login-script _ gexps)
(program-file
"on-first-login"
- #~(begin
+ (with-imported-modules (source-module-closure '((guix i18n)))
+ #~(begin
(use-modules (guix i18n))
#$%initialize-gettext
@@ -308,7 +337,7 @@ will be put in @file{~/.guix-home/files}.")))
(display (G_ "XDG_RUNTIME_DIR doesn't exists, on-first-login script
won't execute anything. You can check if xdg runtime directory exists,
XDG_RUNTIME_DIR variable is set to appropriate value and manually execute the
-script by running '$HOME/.guix-home/on-first-login'")))))))
+script by running '$HOME/.guix-home/on-first-login'"))))))))
(define (on-first-login-script-entry on-first-login)
"Return, as a monadic value, an entry for the on-first-login script
@@ -400,7 +429,8 @@ with one gexp, but many times, and all gexps must be idempotent.")))
;;;
(define (compute-on-change-gexp eval-gexps? pattern-gexp-tuples)
- #~(begin
+ (with-imported-modules (source-module-closure '((guix i18n)))
+ #~(begin
(use-modules (guix i18n))
#$%initialize-gettext
@@ -485,7 +515,7 @@ with one gexp, but many times, and all gexps must be idempotent.")))
(display (G_ "On-change gexps evaluation finished.\n\n")))
(display "\
On-change gexps won't be evaluated; evaluation has been disabled in the
-service configuration"))))
+service configuration")))))
(define home-run-on-change-service-type
(service-type (name 'home-run-on-change)