GNU bug report logs -
#68857
gnu: home: dotfiles: Avoid creating extra directory in $HOME.
Previous Next
Reported by: paul <goodoldpaul <at> autistici.org>
Date: Wed, 31 Jan 2024 22:17:02 UTC
Severity: normal
Done: Ludovic Courtès <ludo <at> gnu.org>
Bug is archived. No further changes may be made.
Full log
Message #32 received at 68857 <at> debbugs.gnu.org (full text, mbox):
Hi Ludo’ ,
On 2/20/24 10:37, Ludovic Courtès wrote:
> Hello Giacomo!
>
> Giacomo Leidi <goodoldpaul <at> autistici.org> skribis:
>
>> The current implementation of the home-dotfiles-service-type contradicts
>> the Guix manual (see https://issues.guix.gnu.org/68848 ). This patch
>> properly implements both the plain and Stow dotfiles directory layouts.
>>
>> It does so by creating a new record type for each directory layout. This
>> approach, compared to having a single field in
>> home-dotfiles-configuration,
>> allows for having different layouts for different directories and to
>> carry additional information that might be required for some layouts.
>>
>> Implementing a new layout should just be a matter of creating a new
>> record type, defining a strip-*-dotfile procedure and plugging them into
>> the home-dotfiles-service-type.
>>
>> * gnu/home/services/dotfiles (home-dotfiles-stow-directory): New
>> variable;
>> (home-dotfiles-plain-directory): new variable;
>> (home-dotfiles-configuration): migrate to (gnu services configuration);
>> (strip-stow-dotfile): new variable;
>> (strip-plain-dotfile): new variable;
>> (home-dotfiles-configuration->files): use the new record types;
>> [directory-contents]: allow for
>> selecting a subset of application dotfile directories;
>> * doc/guix.texi: document the new layouts.
>>
>> Change-Id: I2e96037608353e360828290f055ec5271cfdfd48
> Thanks for working on it!
>
>> +There are two supported dotfiles directory layouts, for now. The
>> +@code{home-dotfiles-plain-directory} layout, which is structured as follows:
>> +
>> +@example
>> +~$ tree -a ./dotfiles/
>> +dotfiles/
>> +├── .gitconfig
>> +├── .gnupg
>> +│ ├── gpg-agent.conf
>> +│ └── gpg.conf
>> +├── .guile
>> +├── .config
>> +│ ├── guix
>> +│ │ └── channels.scm
>> +│ └── nixpkgs
>> +│ └── config.nix
>> +├── .nix-channels
>> +├── .tmux.conf
>> +└── .vimrc
>> +@end example
> I’d add a sentence like: “This tree structure is installed as is to the
> home directory upon @command{guix home reconfigure}.”
I'm adding this to the manual, thanks!
>> +(define-configuration/no-serialization home-dotfiles-configuration
> I think we should keep ‘home-dotfiles-configuration’ for compatibility
> (this patch keeps the exports but removes the actual
> <home-dotfiles-configuration> definition IIUC).
We are keeping home-dotfiles-configuration , it's just now it is
implemented with validation from (gnu services configuration) . The only
thing changing is that home-dotfiles-configuration's directories field
is now a list of either home-dotfiles-plain-directory or
home-dotfiles-stow-directory records.
> Also, as a rule of thumb, the configuration of a given service type is
> usually monomorphic (always the same configuration record type), which I
> find clearer.
>
> Instead of having these two record types, would it be an option to add a
> ‘type’ field (or similar) to <home-dotfiles-configuration>, as discussed
> earlier?
As I tried explaining in the commit message, this approach, compared to
having a single field in home-dotfiles-configuration , allows for having
different layouts for different directories and to carry additional
information that might be needed for a given layout type. Such as the
application field required to support some Stow's users workflows. What
do you think about this approach? It should be general enough to support
any kind of layout.
Thank you for your time,
giacomo
This bug report was last modified 1 year and 78 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.