guix-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug#61982] [PATCH 2/2] home: services: xdg-base-directories: Deprecate


From: (
Subject: [bug#61982] [PATCH 2/2] home: services: xdg-base-directories: Deprecate XDG_LOG_HOME.
Date: Sun, 09 Apr 2023 20:57:54 +0100

On Sun Apr 9, 2023 at 8:09 PM BST, Philip McGrath wrote:
> > I meant introducing something like this
> > (define (get-log-dir)
> >  (string-append
> >   (getenv "XDG_STATE_HOME") "/log"))
> >
>
> Within the XDG directories, I think (unless perhaps you only use a single 
> file) you are supposed to keep everything in a subdirectory named for your 
> application (or with a well-known name for things shared among multiple 
> applications). For example, on my system, I can find log files in 
> "$XDG_DATA_HOME/akonadi/Akonadi.error", 
> "$XDG_DATA_HOME/akonadi/Akonadi.error.old", 
> "$XDG_DATA_HOME/sddm/wayland-session.log", and 
> "$XDG_DATA_HOME/sddm/xorg-session.log". (Apparently SDDM and Akonadi haven't 
> been updated to use $XDG_STATE_HOME.) I think Guix Home services should 
> follow that convention, rather than putting all logs together in 
> "$XDG_STATE_HOME/log/".

So it turns out Shepherd provides these gems squirreled away inside its
(shepherd support) module:

```
(define %user-config-dir
  ;; Default config directory if shepherd is run as a normal user.
  (string-append (or (getenv "XDG_CONFIG_HOME")
                     (string-append user-homedir "/.config"))
                 "/shepherd"))

(define %user-log-dir
  ;; Default log directory if shepherd is run as a normal user.
  (string-append (or (getenv "XDG_STATE_HOME")
                     (string-append user-homedir "/.local/state"))
                 "/shepherd"))

(define %user-runtime-dir
  ;; Default runtime directory if shepherd is run as a normal user.
  (string-append (or (getenv "XDG_RUNTIME_DIR")
                     (format #f "/run/user/~s" (getuid)))))
```

Shepherd already provides us with a %USER-LOG-DIR variable :D

    -- (

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]