Subject: [bug#59983] [PATCH] home: Let user configure XDG base directories.

From: Andrew Tropin <[email-masked]>
Date: Mon, 07 Aug 2023 10:57:37 +0400

On 2022-12-13 15:53, Antero Mejr wrote:

> Andrew Tropin <[email-masked]> writes:
>> There is no way to understand upfront if directory containing
>> XDG_RUNTIME_DIR is writable and this is why it's a good idea to delegate
>> initialization of it to external thing and never try to create it here,
>> even if it has non-default value.
>
> Thank you for the snippet, that's a much better way of fixing my issue.
>
> I still think guix home should (by default) be able to use all its
> features without the requirement of having external programs installed.
>
> For example, suppose you have a server that you want to set up your home
> environment on, for when you login to do sysadmin tasks. That server
> wouldn't have %desktop-services (elogind), nor would it have a custom
> greeter like greetd. So XDG_RUNTIME_DIR will be unset.
>
> If XDG_RUNTIME_DIR does not exist, can we make a fallback path to have
> guix home put the shepherd socket and on-first-login-executed flag file
> in ~/.local/var/run (or somewhere else writable) instead?

Without automatic cleanup (which is the case for elogind, pam_rundir and
other options providing XDG_RUNTIME_DIR) it will likely missbehave.

It's much trickier than it seems on the first sight.  Theoretically it's
possible, but requires a lot of additional work to do it right.

In fact on-first-login script is a kinda hack to make shepherd started
somehow, but running user's shepherd is tricky on its own.  Shutting it
down correctly (and all the processes managed by it) is even more
challenging.  AFAIK, there is no easy and straightforward solution (even
in other init systems that we can quickly borrow), so it will require
time and effort to carefully design and implement it.

If you want to work on it - send you ideas, research and patches for the
possible solutions, I'll share my input :)

-- 
Best regards,
Andrew Tropin