[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
07/09: home: symlink-manager: Respect XDG_CONFIG_HOME during activation.
From: |
guix-commits |
Subject: |
07/09: home: symlink-manager: Respect XDG_CONFIG_HOME during activation. |
Date: |
Sun, 20 Mar 2022 14:06:51 -0400 (EDT) |
civodul pushed a commit to branch master
in repository guix.
commit 92c23970709bc58c33b99ab9449eaf67ac5a0694
Author: Andrew Tropin <andrew@trop.in>
AuthorDate: Fri Mar 11 10:12:30 2022 +0300
home: symlink-manager: Respect XDG_CONFIG_HOME during activation.
* gnu/home/services/symlink-manager.scm (update-symlinks-script): Respect
XDG_CONFIG_HOME during activation.
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
---
gnu/home/services/symlink-manager.scm | 19 +++++++++++++++++--
1 file changed, 17 insertions(+), 2 deletions(-)
diff --git a/gnu/home/services/symlink-manager.scm
b/gnu/home/services/symlink-manager.scm
index 16031ea5d3..3b851229f3 100644
--- a/gnu/home/services/symlink-manager.scm
+++ b/gnu/home/services/symlink-manager.scm
@@ -50,14 +50,29 @@
(define home-directory
(getenv "HOME"))
+ (define xdg-config-home
+ (or (getenv "XDG_CONFIG_HOME")
+ (string-append (getenv "HOME") "/.config")))
+
(define backup-directory
(string-append home-directory "/" (number->string (current-time))
"-guix-home-legacy-configs-backup"))
+ (define (preprocess-file file)
+ "If file is in XDG-CONFIGURATION-FILES-DIRECTORY use
+subdirectory from XDG_CONFIG_HOME to generate a target path."
+ (if (string-prefix? #$xdg-configuration-files-directory file)
+ (string-append
+ (substring xdg-config-home
+ (1+ (string-length home-directory)))
+ (substring file
+ (string-length
#$xdg-configuration-files-directory)))
+ (string-append "." file)))
+
(define (target-file file)
;; Return the target of FILE, a config file name sans leading dot
;; such as "config/fontconfig/fonts.conf" or "bashrc".
- (string-append home-directory "/." file))
+ (string-append home-directory "/" (preprocess-file file)))
(define (symlink-to-store? file)
(catch 'system-error
@@ -70,7 +85,7 @@
(define (backup-file file)
(define backup
- (string-append backup-directory "/." file))
+ (string-append backup-directory "/" (preprocess-file file)))
(mkdir-p backup-directory)
(format #t (G_ "Backing up ~a...") (target-file file))
- branch master updated (10d865aa92 -> 3748c32b13), guix-commits, 2022/03/20
- 01/09: home: symlink-manager: Use existing home-directory symbol., guix-commits, 2022/03/20
- 09/09: home: import: Clarify alias parsing code., guix-commits, 2022/03/20
- 03/09: home: Explicitly connect home-file and symlink-manager services., guix-commits, 2022/03/20
- 06/09: home: Migrate fountutils and xdg modules to xdg-configuration-files., guix-commits, 2022/03/20
- 08/09: home: import: Properly parse aliases that contain quotes., guix-commits, 2022/03/20
- 04/09: home: Add home-xdg-configuration-files service., guix-commits, 2022/03/20
- 07/09: home: symlink-manager: Respect XDG_CONFIG_HOME during activation.,
guix-commits <=
- 02/09: home: symlink-manager: Add missing 'done' word in message., guix-commits, 2022/03/20
- 05/09: home: shells: Migrate zsh to xdg-configuration-files., guix-commits, 2022/03/20