From 0cd37bbc724f9c793898c2655bdd1c335045c5f0 Mon Sep 17 00:00:00 2001 From: Andrew Tropin Date: Fri, 11 Feb 2022 10:55:01 +0300 Subject: [PATCH 1/5] home: Explicitly connect home-file and symlink-manager services. * gnu/home/services.scm (home-files-directory): New variable. * gnu/home/symlink-manager.scm (update-symlinks-script): Use home-files-directory variable from (gnu home services). --- gnu/home/services.scm | 23 ++++++++++++++--------- gnu/home/services/symlink-manager.scm | 17 +++++++++-------- 2 files changed, 23 insertions(+), 17 deletions(-) diff --git a/gnu/home/services.scm b/gnu/home/services.scm index 1cd19ce7f9..e4e3717b80 100644 --- a/gnu/home/services.scm +++ b/gnu/home/services.scm @@ -43,6 +43,8 @@ (define-module (gnu home services) home-run-on-change-service-type home-provenance-service-type + home-files-directory + fold-home-service-types home-provenance @@ -74,12 +76,11 @@ (define-module (gnu home services) ;;; 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 @@ -262,11 +263,14 @@ (define (assert-no-duplicates files) (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) @@ -276,8 +280,9 @@ (define home-files-service-type (compose concatenate) (extend append) (default-value '()) - (description "Configuration files for programs that -will be put in @file{~/.guix-home/files}."))) + (description (format #f "Files that will be put in +@file{~~/.guix-home/~a}, and further processed during activation." + home-files-directory)))) (define %initialize-gettext #~(begin diff --git a/gnu/home/services/symlink-manager.scm b/gnu/home/services/symlink-manager.scm index 314da3ba3e..747bb343d3 100644 --- a/gnu/home/services/symlink-manager.scm +++ b/gnu/home/services/symlink-manager.scm @@ -25,12 +25,11 @@ (define-module (gnu home services symlink-manager) ;;; Comment: ;;; -;;; symlink-manager cares about configuration files: it backs up files -;;; created by user, removes symlinks and directories created by a -;;; previous generation, and creates new directories and symlinks to -;;; configuration files according to the content of files/ directory -;;; (created by home-files-service) of the current home environment -;;; generation. +;;; symlink-manager cares about xdg configurations and other files: it backs +;;; up files created by user, removes symlinks and directories created by a +;;; previous generation, and creates new directories and symlinks to files +;;; according to the content of directories (created by home-files-service) of +;;; the current home environment generation. ;;; ;;; Code: @@ -94,7 +93,8 @@ (define ((file-tree-traverse preordering) node) (new-home (getenv "GUIX_NEW_HOME")) (old-home (getenv "GUIX_OLD_HOME")) - (new-files-path (string-append new-home "/files")) + (new-files-path (string-append + new-home "/" #$home-files-directory)) ;; Trailing dot is required, because files itself is symlink and ;; to make file-system-tree works it should be a directory. (new-files-dir-path (string-append new-files-path "/.")) @@ -107,7 +107,8 @@ (define ((file-tree-traverse preordering) node) (old-tree (if old-home ((simplify-file-tree "") (file-system-tree - (string-append old-home "/files/."))) + (string-append + old-home "/" #$home-files-directory "/."))) #f)) (new-tree ((simplify-file-tree "") (file-system-tree new-files-dir-path))) -- 2.34.0