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

From: Andrew Tropin <[email-masked]>
Date: Fri, 16 Jun 2023 07:28:32 +0400

On 2023-06-15 14:09, Philip McGrath wrote:

> 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>.

With a brief look I didn't find information about this idiom in
specification, but you can highlight it with quote or link.

Anyway, I'm ok with storing logs in app subdirectory or "/log", not so
ok with storing them in the root of state home.

>
> 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.

home-state-dir function can also be useful, which can later become just
(getenv ("XDG_STATE_HOME")).

-- 
Best regards,
Andrew Tropin