[Nix-dev] Managing /home during system activation

Peter Jones mlists at pmade.com
Mon Apr 17 18:13:02 CEST 2017


David Izquierdo <thecofee at gmail.com> writes:
> That's stupid genius in my eyes. What I'd been doing is to find a way
> to make software look in /etc/xdg before ~/.config, with... varying
> degrees of success. Is there anywhere we could read your
> implementation?


I haven't actually written any code yet.  I wanted to make sure there
weren't any obvious problems with my idea first.

The biggest obstacle I see right now is that I'm going to have to
override home directories for users.  If I use overlayfs then I need to
have two source directories and a destination directory.  I was thinking
of creating fake home directories in /var/lib/home.  So, for example,
the following directories would be overlaid on /var/lib/home/pjones:

  /nix/store/xxx-home-pjones # Symlinks to config files
  /home/pjones               # Real home directory

And then I would override the home directory for pjones to be
/var/lib/home/pjones where the overlay is.

If you have any other suggestions I'd love to hear them.

>
> On 15/04/17 19:36, Peter Jones wrote:
>> I'd like to manage files in my home directory during system activation.
>> Sort of like nix-home[1] but during activation so NixOps can also deploy
>> things such as my shell configuration.  I have an idea, and I'm
>> wondering how terrible it is.
>>
>> Based on the way etc activation works, I would build a directory in the
>> nix store and fill it with symlinks to other parts of the store:
>>
>> /nix/store/xxx-home-pjones/.zshrc -> /nix/store/xxx-zshrc/zshrc
>>
>> Then, set up a UnionFS mount so that /nix/store/xxx-home-pjones gets
>> overlaid on top of /home/pjones.  This means I don't have to search
>> through /home looking for links to an old generation to deactivate it,
>> and rolling back just mounts a previous generation on top of /home.
>>
>> So, how bad is this idea?
>>
>> Thanks!
>>
>>
>> [1]: https://github.com/sheenobu/nix-home>
>

-- 
Peter Jones, Founder, Devalot.com
Defending the honor of good code



More information about the nix-dev mailing list