home-xdg-user-directories-service-type: Extend it with home-environment-variables service

  • Open
  • quality assurance status badge
Details
One participant
  • lgcoelho
Owner
unassigned
Submitted by
lgcoelho
Severity
normal

Debbugs page

lgcoelho wrote 1 years ago
(name . Guix Patches)(address . guix-patches@gnu.org)
1dff17d3ef7bbc11c17b7e614cc96f16@disroot.org
Current home-xdg-user-directories-service-type creates a
~/.config/user-dirs.dirs which some non posix-compliant shells like fish
aren't able to read, this makes necessary to use some external tool like
fish-foreign-env, but this solution makes fish startup times really
slower in the case fish sources it in a non-login shell.
After thinking about it for a bit, I guess it would be proper if guix
itself was responsible for setting these environment variables. This
could avoid the need for users of other non-posix shells to make their
own custom workarounds for this problem.
Attachment: file
From f915f08c166ffdeaadfdd2438a66d8d0d3401629 Mon Sep 17 00:00:00 2001
From: Luis Guilherme Coelho <lgcoelho@disroot.org>
Date: Sun, 24 Dec 2023 14:43:38 -0300
Subject: [PATCH] home-xdg-user-directories-service-type: Extend it with
home-environment-service-type

---
gnu/home/services/xdg.scm | 16 ++++++++++++++++
1 file changed, 16 insertions(+)

Toggle diff (42 lines)
diff --git a/gnu/home/services/xdg.scm b/gnu/home/services/xdg.scm
index 958772696b..e14870df05 100644
--- a/gnu/home/services/xdg.scm
+++ b/gnu/home/services/xdg.scm
@@ -2,6 +2,7 @@
;;; Copyright © 2021, 2022 Andrew Tropin <andrew@trop.in>
;;; Copyright © 2021 Xinglu Chen <public@yoctocell.xyz>
;;; Copyright © 2023 Bruno Victal <mirai@makinata.eu>
+;;; Copyright © 2023 Luis Guilherme Coelho <lgcoelho@disroot.org>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -256,12 +257,27 @@ (define (home-xdg-user-directories-activation-service config)
(map ensure-dir '#$dirs)
(display " done\n"))))
+(define (home-xdg-user-directories-environment-variables-service config)
+ (match-record config <home-xdg-user-directories-configuration>
+ (desktop documents music pictures videos publicshare download templates)
+ `(("XDG_DESKTOP_DIR" . ,desktop)
+ ("XDG_DOCUMENTS_DIR" . ,documents)
+ ("XDG_DOWNLOAD_DIR" . ,download)
+ ("XDG_MUSIC_DIR" . ,music)
+ ("XDG_PICTURES_DIR" . ,pictures)
+ ("XDG_PUBLICSHARE_DIR" . ,publicshare)
+ ("XDG_TEMPLATES_DIR" . ,templates)
+ ("XDG_VIDEOS_DIR" . ,videos))))
+
(define home-xdg-user-directories-service-type
(service-type (name 'home-xdg-user-directories)
(extensions
(list (service-extension
home-xdg-configuration-files-service-type
home-xdg-user-directories-files-service)
+ (service-extension
+ home-environment-variables-service-type
+ home-xdg-user-directories-environment-variables-service)
(service-extension
home-activation-service-type
home-xdg-user-directories-activation-service)))
--
2.41.0
?
Your comment

Commenting via the web interface is currently disabled.

To comment on this conversation send an email to 68009@debbugs.gnu.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 68009
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch
You may also tag this issue. See list of standard tags. For example, to set the confirmed and easy tags
mumi command -t +confirmed -t +easy
Or, remove the moreinfo tag and set the help tag
mumi command -t -moreinfo -t +help