all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Antero Mejr via Guix-patches via <guix-patches@gnu.org>
To: 59983@debbugs.gnu.org
Cc: Antero Mejr <antero@mailbox.org>, ludo@gnu.org
Subject: [bug#59983] [PATCH] home: Let user configure XDG base directories.
Date: Mon, 12 Dec 2022 03:00:49 +0000	[thread overview]
Message-ID: <20221212030049.4725-1-antero@mailbox.org> (raw)

* gnu/home.scm (home-environment)[base-xdg-configuration]: New field.
* gnu/home/services/xdg.scm (ensure-xdg-base-dirs-on-activation): Make
XDG_RUNTIME_DIR directory if the configuration changes it from the default.
---
Allows making a runtime dir at ~/.local/runtime (or any other dir),
so users don't have to set up elogind or other greeters/PAM modules.

 gnu/home.scm              | 9 +++++++--
 gnu/home/services/xdg.scm | 7 ++++++-
 2 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/gnu/home.scm b/gnu/home.scm
index c95d1e0818..f100b575e3 100644
--- a/gnu/home.scm
+++ b/gnu/home.scm
@@ -39,6 +39,7 @@ (define-module (gnu home)
             home-environment-essential-services
             home-environment-services
             home-environment-location
+            home-environment-base-xdg-configuration
 
             home-environment-with-provenance
 
@@ -71,7 +72,10 @@ (define-record-type* <home-environment> home-environment
   (location           home-environment-location            ; <location>
                       (default (and=> (current-source-location)
                                       source-properties->location))
-                      (innate)))
+                      (innate))
+
+  (base-xdg-configuration home-environment-base-xdg-configuration
+                          (default (home-xdg-base-directories-configuration))))
 
 (define (home-environment-default-essential-services he)
   "Return the list of essential services for home environment."
@@ -83,7 +87,8 @@ (define (home-environment-default-essential-services he)
    (service home-symlink-manager-service-type)
 
    (service home-fontconfig-service-type)
-   (service home-xdg-base-directories-service-type)
+   (service home-xdg-base-directories-service-type
+            (home-environment-base-xdg-configuration he))
    (service home-shell-profile-service-type)
 
    (service home-service-type)
diff --git a/gnu/home/services/xdg.scm b/gnu/home/services/xdg.scm
index 865f8b81d7..b62580461e 100644
--- a/gnu/home/services/xdg.scm
+++ b/gnu/home/services/xdg.scm
@@ -133,7 +133,12 @@ (define (ensure-xdg-base-dirs-on-activation config)
                         (configuration-field-name field) 'upper))))
                  ;; XDG_RUNTIME_DIR shouldn't be created during activation
                  ;; and will be provided by elogind or other service.
-                 (and (not (string=? "XDG_RUNTIME_DIR" variable))
+                 ;; But if the user changes the value from the default,
+                 ;; then we can make XDG_RUNTIME_DIR.
+                 (and (or (not (string=? "XDG_RUNTIME_DIR" variable))
+                          (not (string=? ((configuration-field-getter field)
+                                          config)
+                                         "${XDG_RUNTIME_DIR:-/run/user/$UID}")))
                       variable)))
              home-xdg-base-directories-configuration-fields)))
 
-- 
2.38.1





             reply	other threads:[~2022-12-12  3:02 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-12  3:00 Antero Mejr via Guix-patches via [this message]
2022-12-13  4:25 ` [bug#59983] [PATCH] home: Let user configure XDG base directories Andrew Tropin
2022-12-13 15:53   ` Antero Mejr via Guix-patches via
2023-08-07  6:57     ` Andrew Tropin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221212030049.4725-1-antero@mailbox.org \
    --to=guix-patches@gnu.org \
    --cc=59983@debbugs.gnu.org \
    --cc=antero@mailbox.org \
    --cc=ludo@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.