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

From: "Philip McGrath" <[email-masked]>
Date: Thu, 15 Jun 2023 14:09:22 -0400

Hi,

On Thu, Jun 15, 2023, at 5:35 AM, Andrew Tropin wrote:
>
> WDYT about adding (home-log-dir) function to (guix build utils)?
> So we can prevent copypasting the same code all over home modules.
>
> Something like:
> --8<---------------cut here---------------start------------->8---
> (define (home-log-dir)
>   "Returns a directory for user applications logs."
>   (string-append
>    (or (getenv "XDG_STATE_HOME")
>        (format #f "~a/.local/state"
>                (getenv "HOME")))
>    "/log"))
> --8<---------------cut here---------------end--------------->8---
>

I still think idiomatic XDG structure is NOT to have a "/log" subdirectory like this, as I explained in <https://issues.guix.gnu.org/61982#7>.

Aside from that, though, I thought the conclusion from <https://issues.guix.gnu.org/56050#3> was that it is the responsibility of Guix System or the installation mechanism for Guix on a foreign distribution (e.g. "/etc/profile.d/zzz-guix.sh") to initialize all of the XDG variables, so code like this can use `(getenv "XDG_STATE_HOME")` unconditionally (or indeed with a checked assertion). Maybe there's some context I'm forgetting, though. I've been looking into these things again as I attempt to solve <https://lists.gnu.org/archive/html/help-guix/2023-06/msg00031.html>: I noticed in the attached environment variables that entries under /home/philip/.guix-home/profile/ are duplicated in many search paths.

-Philip