~abcdw/rde-discuss

7 2

Getting started with `guix home`

Details
Message ID
<878s7ho4bk.fsf@yoctocell.xyz>
DKIM signature
pass
Download raw message
Hi,

I recently watched your video on `guix home` for managing user
environments with Guix.  I found it very interesting and would like to
try it out on my machine.  Could you give some guidance on how I would
install/use it (I am on NixOS if that matters)?

--
Xinglu Chen
8B88 2502 31D7 03B1 68BC  2691 3851 020D 7E61 BBC2
Details
Message ID
<CABrWRW3Yo7TWVobCV4D1QtYoOMjx1877J4SW2Sj0fUvjw7rHXg@mail.gmail.com>
In-Reply-To
<878s7ho4bk.fsf@yoctocell.xyz> (view parent)
DKIM signature
missing
Download raw message
> Hi,
>
> I recently watched your video on `guix home` for managing user
> environments with Guix. \u00a0I found it very interesting and would like to
> try it out on my machine. \u00a0Could you give some guidance on how I would
> install/use it (I am on NixOS if that matters)?

Hello!

I know that at least few people waiting for getting started guide for
`guix home`, but I still not finished one important piece: state
management. I would like to spend on it some time to make it
carefully. Also, during this time I will battle test it on my own setup
and will be sure that it won't require any breaking changes.

After that I plan to work on upstreaming it to GNU Guix and writing
documentation for it. That's why I recommend you to wait for few weeks.


However, if you are very keen, you can play with it right now.

You can consult `home-gnupg-service-type` and create your own
service-types in gnu/home-services/ for different programs.

To build and setup home environment to ~/.guix-home-environment call the
following command inside rde repository:

GUILE_LOAD_PATH=./ guix home reconfigure ./examples/home-environment.scm.tmpl

You will also need to add following lines to your .bash_profile,
.profile or .zprofile (depending on what shell you use) to be able to
obtain environment variables provided by home-environment and start
Shepherd on first login:

source ~/.guix-home-environment/setup-environment
sh ~/.guix-home-environment/on-login


Tommorow will be a stream, where I will explain basic building blocks of
home environment and will give some ideas how to make your own
configurations using home-services.

The stream announce: https://fosstodon.org/web/statuses/105768420582217470

--
Best regards,
Andrew Tropin
Details
Message ID
<874ki5nk2r.fsf@yoctocell.xyz>
In-Reply-To
<CABrWRW3Yo7TWVobCV4D1QtYoOMjx1877J4SW2Sj0fUvjw7rHXg@mail.gmail.com> (view parent)
DKIM signature
pass
Download raw message
On Sun, Feb 21 2021, Andrew Tropin wrote:

> Hello!
>
> I know that at least few people waiting for getting started guide for
> `guix home`, but I still not finished one important piece: state
> management. I would like to spend on it some time to make it
> carefully. Also, during this time I will battle test it on my own setup
> and will be sure that it won't require any breaking changes.
>
> After that I plan to work on upstreaming it to GNU Guix and writing
> documentation for it. That's why I recommend you to wait for few weeks.

This sounds really exciting, I look forward to seeing it become part of
Guix proper as Nix home-manager feels a bit decoupled from NixOS right
now.

> However, if you are very keen, you can play with it right now.
>
> You can consult `home-gnupg-service-type` and create your own
> service-types in gnu/home-services/ for different programs.
>
> To build and setup home environment to ~/.guix-home-environment call the
> following command inside rde repository:
>
> GUILE_LOAD_PATH=./ guix home reconfigure ./examples/home-environment.scm.tmpl
>
> You will also need to add following lines to your .bash_profile,
> .profile or .zprofile (depending on what shell you use) to be able to
> obtain environment variables provided by home-environment and start
> Shepherd on first login:
>
> source ~/.guix-home-environment/setup-environment
> sh ~/.guix-home-environment/on-login

Thanks for the detailed instructions, I will try it out and report back,
and hopefully I will be able to contribute with some patches. :-)

> Tommorow will be a stream, where I will explain basic building blocks of
> home environment and will give some ideas how to make your own
> configurations using home-services.

Great, I will remember to watch it.

Thanks for the detailed response.
Details
Message ID
<87r1l8ftkf.fsf@yoctocell.xyz>
In-Reply-To
<874ki5nk2r.fsf@yoctocell.xyz> (view parent)
DKIM signature
pass
Download raw message
On Sun, Feb 21 2021, Xinglu Chen wrote:

>> However, if you are very keen, you can play with it right now.
>>
>> You can consult `home-gnupg-service-type` and create your own
>> service-types in gnu/home-services/ for different programs.
>>
>> To build and setup home environment to ~/.guix-home-environment call the
>> following command inside rde repository:
>>
>> GUILE_LOAD_PATH=./ guix home reconfigure ./examples/home-environment.scm.tmpl
>>
>> You will also need to add following lines to your .bash_profile,
>> .profile or .zprofile (depending on what shell you use) to be able to
>> obtain environment variables provided by home-environment and start
>> Shepherd on first login:
>>
>> source ~/.guix-home-environment/setup-environment
>> sh ~/.guix-home-environment/on-login
>
> Thanks for the detailed instructions, I will try it out and report back,
> and hopefully I will be able to contribute with some patches. :-)

So far, everything seems to be working.  Some thoughts so far:

- The name `~/.guix-home-environment` seems a bit long, maybe we could
  change it to `~/.guix-home` or `~/.guix-home-env`?

- It would be nice if the contents of the `on-login` `setup-environment`
  scripts could be placed in ~/.profile which would make it be run
  automatically on login.

The project looks very exciting so far.  Thanks for you work!
Details
Message ID
<CABrWRW3-tnJqK8K5GK=yS6v3cvZn=CAnuLwVudx69ywOxKQSXA@mail.gmail.com>
In-Reply-To
<87r1l8ftkf.fsf@yoctocell.xyz> (view parent)
DKIM signature
missing
Download raw message
> So far, everything seems to be working.

Very glad to know! There are not so much code, which can malfunction on
NixOS, but still cool that everything works smoothly.

> - The name `~/.guix-home-environment` seems a bit long, maybe we could
>   change it to `~/.guix-home` or `~/.guix-home-env`?

Nice idea, I also thought about several different options like
`~/.home-environment`, `~/.home` and few more proposed above.

- I prefer to have a guix prefix to make it explicit that this thing
came from guix and not the other tool.

- The `home-environment` part makes it clear that it is associated with
some home-environment record. In terms of implementation it is very
sound: (home-environment (...)) built with `guix home` results into
~/.guix-home-environment.

From esthetique point of view, shorter options look appealing to me,
but sacrificing clarity. I would like to get back to this question once
upstreaming process will be started.

Another option is to add the `home-environment-symlink-name` field to
home-environment, which will be used as a destination for
home-environment folder. Everyone will be able to change it according to
his taste)

> - It would be nice if the contents of the `on-login` `setup-environment`
>   scripts could be placed in ~/.profile which would make it be run
>   automatically on login.

Do you mean automatically added to ~/.profile on reconfigure?

As you probably already know I'm still not sure if it's a good idea to
modify anything inside the home directory on reconfigure, even symlinking
something to ~/.config. Creating or modifying ~/.profile on reconfigure
doesn't seem as a good option, even ~/.guix-home-environment just a
shorthand to make it easier to check and reference the content of
`/var/guix/profiles/per-user/bob/guix-home-environment` and I'm not sure
that it will be in the final release. Maybe it will migrate to `init`
action.

I thought about `guix home init`, which will be adding `on-login` and
`setup-environment` to specified in arguments file if they are not
present yet. Just an automated helper (for removing manual step of
editing ~/.bash_profile).

I still have not decided on implementation here. All the ideas are welcome.

> The project looks very exciting so far.  Thanks for your work!

You are very welcome, much appreciate your involvement too!)

-- 
Best regards,
Andrew Tropin
Details
Message ID
<87sg5nc34g.fsf@yoctocell.xyz>
In-Reply-To
<CABrWRW3-tnJqK8K5GK=yS6v3cvZn=CAnuLwVudx69ywOxKQSXA@mail.gmail.com> (view parent)
DKIM signature
pass
Download raw message
On Mon, Feb 22 2021, Andrew Tropin wrote:

>> - The name `~/.guix-home-environment` seems a bit long, maybe we could
>>   change it to `~/.guix-home` or `~/.guix-home-env`?
>
> Nice idea, I also thought about several different options like
> `~/.home-environment`, `~/.home` and few more proposed above.
>
> - I prefer to have a guix prefix to make it explicit that this thing
> came from guix and not the other tool.
>
> - The `home-environment` part makes it clear that it is associated with
> some home-environment record. In terms of implementation it is very
> sound: (home-environment (...)) built with `guix home` results into
> ~/.guix-home-environment.
>
> From esthetique point of view, shorter options look appealing to me,
> but sacrificing clarity. I would like to get back to this question once
> upstreaming process will be started.
>
> Another option is to add the `home-environment-symlink-name` field to
> home-environment, which will be used as a destination for
> home-environment folder. Everyone will be able to change it according to
> his taste)

This could also be a good option as it is just a directory name.

>
>> - It would be nice if the contents of the `on-login` `setup-environment`
>>   scripts could be placed in ~/.profile which would make it be run
>>   automatically on login.
>
> Do you mean automatically added to ~/.profile on reconfigure?
>
> As you probably already know I'm still not sure if it's a good idea to
> modify anything inside the home directory on reconfigure, even
> symlinking something to ~/.config. Creating or modifying ~/.profile on
> reconfigure doesn't seem as a good option, even
> ~/.guix-home-environment just a shorthand to make it easier to check
> and reference the content of
> `/var/guix/profiles/per-user/bob/guix-home-environment` and I'm not
> sure that it will be in the final release. Maybe it will migrate to
> `init` action.

Are you saying that `reconfigure` wouldn't create symlinks from files in
~/ and ~/.config to the store, but instead just symlink the ~/.config
directory to the store?  This would probably break a lot of programs
that just dump stuff in ~/.config, like Chromium.

There are still programs that don't respect the XDG directory
specification, they still only read from ~/.programrc.  How would they
be able to read the configs without creating symlinks in ~/?

> I thought about `guix home init`, which will be adding `on-login` and
> `setup-environment` to specified in arguments file if they are not
> present yet. Just an automated helper (for removing manual step of
> editing ~/.bash_profile).

This would be useful and would make it easier for newcomers to get started.
Details
Message ID
<CABrWRW2nsQZpWF7eMv_Kz5rmFi3mn0h6tLzAtxuipz3zMjwbcg@mail.gmail.com>
In-Reply-To
<87sg5nc34g.fsf@yoctocell.xyz> (view parent)
DKIM signature
missing
Download raw message
> Are you saying that `reconfigure` wouldn't create symlinks from files in
> ~/ and ~/.config to the store, but instead just symlink the ~/.config
> directory to the store?  This would probably break a lot of programs
> that just dump stuff in ~/.config, like Chromium.

> There are still programs that don't respect the XDG directory
> specification, they still only read from ~/.programrc.  How would they
> be able to read the configs without creating symlinks in ~/?

Ideally, I would like not to touch anything inside ~/.config and even
~/ itself. Many programs can read configuration from other places
specified by environment variables or cli arguments and we can utilize
it.

However, as you correctly mentioned some programs do not respect XDG and
some don't even have a mechanism to specify config directories, moreover
some of the programs write some state to config directories, which is
awful btw.

That said it would be cool to force upstream of the programs to separate
state and configuration dirs before including in home-services and
respect environment variables to configure such dirs, but being realist
I still think about some hacks for making tons of symlinks all over the
home directory and automatically cleaning it up before each reconfigure.
I would be able to provide more information on that, when I'll cover
enough different software with home-services.

-- 
Best regards,
Andrew Tropin
Details
Message ID
<87zgzukjll.fsf@yoctocell.xyz>
In-Reply-To
<CABrWRW2nsQZpWF7eMv_Kz5rmFi3mn0h6tLzAtxuipz3zMjwbcg@mail.gmail.com> (view parent)
DKIM signature
pass
Download raw message
On Tue, Feb 23 2021, Andrew Tropin wrote:

> That said it would be cool to force upstream of the programs to separate
> state and configuration dirs before including in home-services and
> respect environment variables to configure such dirs, but being realist
> I still think about some hacks for making tons of symlinks all over the
> home directory and automatically cleaning it up before each reconfigure.

Forcing upstream would be pretty hard, there has been a 17 year old
discussion on supporting XDG on Firefox[1], this also applies to IceCat.

There should probably also be some kind of mechanism to automatically
remove files that are in the way of creating a symlink.  When using Nix
HM I will sometimes get an error about some xdg-dirs file created by
some program being in the way of a symlink when I switch generation.

[1] https://bugzilla.mozilla.org/show_bug.cgi?id=259356
Reply to thread Export thread (mbox)