guix_mirror_bot pushed a commit to branch misc-world-rebuild in repository guix.
commit ff2931e77ac646de49bbfc70edb73b0886813d17 Author: Brice Waegeneire <[email protected]> AuthorDate: Mon Jun 23 21:39:41 2025 +0200 gnu: home: dotfiles: Exclude directories. home-dotfiles-configuration-excluded now behaves the same as stow, by excluding both files and directories matching a pattern. * gnu/home/services/dotfiles (home-dotfiles-configuration->files)[excluded-file?]: New procedure. [directory-contents]<find-files>: Add #:enter? parameter and use that new procedure. * doc/guix.texi (home-dotfiles-configuration): Be explicit that both files and directories are excluded. Change-Id: Idc7e54f8d648fddbccdd6065c281ce0608d8c53f Reviewed-by: Hilton Chain <[email protected]> Reviewed-by: Florian Pelz <[email protected]> Signed-off-by: Nguyễn Gia Phong <[email protected]> --- doc/guix.texi | 5 +++-- gnu/home/services/dotfiles.scm | 10 +++++++--- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index 0cb9b513ca..8859888113 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -77,7 +77,7 @@ Copyright @copyright{} 2020 Damien Cassou@* Copyright @copyright{} 2020 Jakub Kądziołka@* Copyright @copyright{} 2020 Jack Hill@* Copyright @copyright{} 2020 Naga Malleswari@* -Copyright @copyright{} 2020, 2021 Brice Waegeneire@* +Copyright @copyright{} 2020, 2021, 2025 Brice Waegeneire@* Copyright @copyright{} 2020 R Veera Kumar@* Copyright @copyright{} 2020, 2021, 2022 Pierre Langlois@* Copyright @copyright{} 2020 pinoaffe@* @@ -52914,7 +52914,8 @@ subset of applications. This field will be ignored if @code{layout} is set to @code{'plain}. @item @code{excluded} (default: @code{'(".*~" ".*\\.swp" "/\\.git/.*" "\\.gitignore")}) (type: list-of-strings) -The list of file patterns @code{home-dotfiles-service-type} will exclude +The list of file patterns (including directories) +@code{home-dotfiles-service-type} will exclude while visiting each one of the @code{directories}. @end table diff --git a/gnu/home/services/dotfiles.scm b/gnu/home/services/dotfiles.scm index 692b96f487..7ca5aa5f73 100644 --- a/gnu/home/services/dotfiles.scm +++ b/gnu/home/services/dotfiles.scm @@ -1,6 +1,7 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2024 Ludovic Courtès <[email protected]> ;;; Copyright © 2024, 2026 Giacomo Leidi <[email protected]> +;;; Copyright © 2025 Brice Waegeneire <[email protected]> ;;; ;;; This file is part of GNU Guix. ;;; @@ -126,18 +127,21 @@ user's home directory, excluding files that match any of the patterns in EXCLUDE (define (home-dotfiles-configuration->files config) "Return a list of objects compatible with @code{home-files-service-type}'s -value, excluding files that match any of the patterns configured." +value, excluding files and directories that match any of the patterns configured." (define stow? (eq? (home-dotfiles-configuration-layout config) 'stow)) (define excluded (home-dotfiles-configuration-excluded config)) (define exclusion-rx (make-regexp (string-append "^.*(" (string-join excluded "|") ")$"))) + (define* (excluded-file? file stat #:optional result) + (not (regexp-exec exclusion-rx file))) (define* (directory-contents directory #:key (packages #f)) (define (filter-files directory) (find-files directory - (lambda (file stat) - (not (regexp-exec exclusion-rx file))))) + excluded-file? + #:enter? + excluded-file?)) (if (and stow? packages (maybe-value-set? packages)) (append-map filter-files (map (lambda (pkg)
