GNU bug report logs - #53603
[PATCH] doc: Add files and symlink-manager home services.

Previous Next

Package: guix-patches;

Reported by: Andrew Tropin <andrew <at> trop.in>

Date: Fri, 28 Jan 2022 11:56:02 UTC

Severity: normal

Tags: patch

Done: Andrew Tropin <andrew <at> trop.in>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 53603 in the body.
You can then email your comments to 53603 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to guix-patches <at> gnu.org:
bug#53603; Package guix-patches. (Fri, 28 Jan 2022 11:56:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Andrew Tropin <andrew <at> trop.in>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Fri, 28 Jan 2022 11:56:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Andrew Tropin <andrew <at> trop.in>
To: guix-patches <at> gnu.org
Cc: nick <at> const.fun
Subject: [PATCH] doc: Add files and symlink-manager home services.
Date: Fri, 28 Jan 2022 14:52:12 +0300
[Message part 1 (text/plain, inline)]
* doc/guix.texi (Essential Home Services): Add files and symlink-manager home
services.
---
 doc/guix.texi | 65 +++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 65 insertions(+)

diff --git a/doc/guix.texi b/doc/guix.texi
index c94f85589f..2edea2c943 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -37500,12 +37500,77 @@ users @emph{should not} use this service, in most cases it's better to extend
 the required command using the appropriate service type.
 @end defvr
 
+@defvr {Scheme Variable} home-files-service-type
+The service of this type allows to specify a list of files, which will
+go to @file{~/.guix-home/files}, usually it contains configuration files
+(to be more precise it contains symlinks to files in @file{/gnu/store}),
+which should be placed in @file{$XDG_CONFIG_DIR} or in rare cases in
+@file{$HOME}.  It accepts extension values in the following format:
+
+@lisp
+`(("config/sway/config" ,sway-file-like-object)
+  ("config/tmux/tmux.conf" ,(local-file "./tmux.conf")))
+@end lisp
+
+Each nested list contains two values: a subdirectory and file-like
+object.  After building a home environment @file{~/.guix-home/files}
+will be populated with apropiate content and all nested directories will
+be created accordingly, however, those files won't go any further until
+some other service will do it.  By default a
+@code{home-symlink-manager-service-type}, which creates necessary
+symlinks to files from @file{~/.guix-home/files} in home folder, backs
+up already existing, but clashing configs and other things, is a part of
+essential home services (enabled by default), but it's possible to use
+alternative services to implement more advanced use cases like read-only
+home.  Feel free to experiment and share your results.
+@end defvr
+
 @defvr {Scheme Variable} home-activation-service-type
 The service of this type generates a guile script, which runs on every
 @command{guix home reconfigure} invocation or any other action, which
 leads to the activation of the home environment.
 @end defvr
 
+@defvr {Scheme Variable} home-symlink-manager-service-type
+The service of this type generates a guile script, which will be
+executed during activation of home environment, and do a few following
+steps:
+
+@enumerate
+@item
+Reads the content of @file{files/} directory of current and pending home
+environments.
+
+@item
+Cleans up all symlinks created by symlink-manager on previous
+activation.  Also, sub-directories, which will become empty also will be
+cleaned up.
+
+@item
+Creates new symlinks the following way: It looks @file{files/} directory
+(usually generated with @code{home-files-service-type}), takes the files
+from @file{files/config/} subdirectory and put respective links in
+@env{XDG_CONFIG_DIR}.  For example symlink for
+@file{files/config/sway/config} will end up in
+@file{$XDG_CONFIG_DIR/sway/config}.  The rest files in @file{files/}
+outside of @file{files/config/} subdirectory will be treated slightly
+different: symlink will go to @file{$HOME} and the dot will be appended.
+@file{files/some-program/config} will end up in
+@file{$HOME/.some-program/config}.
+
+@item
+If some sub-directories are missing, they will be created.
+
+@item
+If there is a clashing files on the way, they will be backed up.
+
+@end enumerate
+
+symlink-manager is a part of essential home services and is enabled and
+used by default.
+@end defvr
+
+
 @node Shells Home Services
 @subsection Shells
 
-- 
2.34.0

[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#53603; Package guix-patches. (Wed, 22 Jun 2022 10:44:02 GMT) Full text and rfc822 format available.

Message #8 received at 53603 <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: Andrew Tropin <andrew <at> trop.in>
Cc: 53603 <at> debbugs.gnu.org, nick <at> const.fun
Subject: Re: bug#53603: [PATCH] doc: Add files and symlink-manager home
 services.
Date: Wed, 22 Jun 2022 12:43:26 +0200
Hi Andrew,

Andrew Tropin <andrew <at> trop.in> skribis:

> * doc/guix.texi (Essential Home Services): Add files and symlink-manager home
> services.
> ---
>  doc/guix.texi | 65 +++++++++++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 65 insertions(+)
>
> diff --git a/doc/guix.texi b/doc/guix.texi
> index c94f85589f..2edea2c943 100644
> --- a/doc/guix.texi
> +++ b/doc/guix.texi
> @@ -37500,12 +37500,77 @@ users @emph{should not} use this service, in most cases it's better to extend
>  the required command using the appropriate service type.
>  @end defvr
>  
> +@defvr {Scheme Variable} home-files-service-type
> +The service of this type allows to specify a list of files, which will
> +go to @file{~/.guix-home/files}, usually it contains configuration files
> +(to be more precise it contains symlinks to files in @file{/gnu/store}),
> +which should be placed in @file{$XDG_CONFIG_DIR} or in rare cases in
> +@file{$HOME}.  It accepts extension values in the following format:
> +
> +@lisp
> +`(("config/sway/config" ,sway-file-like-object)
> +  ("config/tmux/tmux.conf" ,(local-file "./tmux.conf")))
> +@end lisp

I think you wrote it shortly before ‘home-files-service-type’ was
changed to not prepend a dot to file names.

Would you like to update it and resubmit?  That’d be a welcome addition.

Thanks,
Ludo’.




Information forwarded to guix-patches <at> gnu.org:
bug#53603; Package guix-patches. (Fri, 24 Jun 2022 10:27:02 GMT) Full text and rfc822 format available.

Message #11 received at 53603 <at> debbugs.gnu.org (full text, mbox):

From: Andrew Tropin <andrew <at> trop.in>
To: Ludovic Courtès <ludo <at> gnu.org>
Cc: 53603 <at> debbugs.gnu.org, nick <at> const.fun
Subject: [PATCH v2] doc: Add files, xdg-configuration and symlink-manager
 home services.
Date: Fri, 24 Jun 2022 13:26:21 +0300
[Message part 1 (text/plain, inline)]
On 2022-06-22 12:43, Ludovic Courtès wrote:

> Hi Andrew,
>
> Andrew Tropin <andrew <at> trop.in> skribis:
>
>> * doc/guix.texi (Essential Home Services): Add files and symlink-manager home
>> services.
>> ---
>>  doc/guix.texi | 65 +++++++++++++++++++++++++++++++++++++++++++++++++++
>>  1 file changed, 65 insertions(+)
>>
>> diff --git a/doc/guix.texi b/doc/guix.texi
>> index c94f85589f..2edea2c943 100644
>> --- a/doc/guix.texi
>> +++ b/doc/guix.texi
>> @@ -37500,12 +37500,77 @@ users @emph{should not} use this service, in most cases it's better to extend
>>  the required command using the appropriate service type.
>>  @end defvr
>>  
>> +@defvr {Scheme Variable} home-files-service-type
>> +The service of this type allows to specify a list of files, which will
>> +go to @file{~/.guix-home/files}, usually it contains configuration files
>> +(to be more precise it contains symlinks to files in @file{/gnu/store}),
>> +which should be placed in @file{$XDG_CONFIG_DIR} or in rare cases in
>> +@file{$HOME}.  It accepts extension values in the following format:
>> +
>> +@lisp
>> +`(("config/sway/config" ,sway-file-like-object)
>> +  ("config/tmux/tmux.conf" ,(local-file "./tmux.conf")))
>> +@end lisp
>
> I think you wrote it shortly before ‘home-files-service-type’ was
> changed to not prepend a dot to file names.
>
> Would you like to update it and resubmit?  That’d be a welcome addition.

Sure.

Here we go:
[v2-0001-doc-Add-files-xdg-configuration-and-symlink-manag.patch (text/x-patch, inline)]
From 7190711d98687973c6b75d6e3b75dbc466282801 Mon Sep 17 00:00:00 2001
From: Andrew Tropin <andrew <at> trop.in>
Date: Fri, 28 Jan 2022 14:52:12 +0300
Subject: [PATCH v2] doc: Add files, xdg-configuration and symlink-manager home
 services.

* doc/guix.texi (Essential Home Services): Add files, xdg-configuration-files
and symlink-manager home services.
---
 doc/guix.texi | 83 +++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 83 insertions(+)

diff --git a/doc/guix.texi b/doc/guix.texi
index 43a5fc85bd..d099e6bf61 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -39411,12 +39411,95 @@ users @emph{should not} use this service, in most cases it's better to extend
 the required command using the appropriate service type.
 @end defvr
 
+@defvr {Scheme Variable} home-files-service-type
+The service of this type allows to specify a list of files, which will
+go to @file{~/.guix-home/files}, usually this directory contains
+configuration files (to be more precise it contains symlinks to files in
+@file{/gnu/store}), which should be placed in @file{$XDG_CONFIG_DIR} or
+in rare cases in @file{$HOME}.  It accepts extension values in the
+following format:
+
+@lisp
+`((".sway/config" ,sway-file-like-object)
+  (".tmux.conf" ,(local-file "./tmux.conf")))
+@end lisp
+
+Each nested list contains two values: a subdirectory and file-like
+object.  After building a home environment @file{~/.guix-home/files}
+will be populated with apropiate content and all nested directories will
+be created accordingly, however, those files won't go any further until
+some other service will do it.  By default a
+@code{home-symlink-manager-service-type}, which creates necessary
+symlinks in home folder to files from @file{~/.guix-home/files} and
+backs up already existing, but clashing configs and other things, is a
+part of essential home services (enabled by default), but it's possible
+to use alternative services to implement more advanced use cases like
+read-only home.  Feel free to experiment and share your results.
+@end defvr
+
+@defvr {Scheme Variable} home-xdg-configuration-files-service-type
+The service is very similiar to @code{home-files-service-type} (and
+actually extends it), but used for defining files, which will go to
+@file{~/.guix-home/files/.config}, which will be symlinked to
+@file{$XDG_CONFIG_DIR} by @code{home-symlink-manager-service-type} (for
+example) during activation.  It accepts extension values in the
+following format:
+
+@lisp
+`(("sway/config" ,sway-file-like-object)
+  ;; -> ~/.guix-home/files/.config/sway/config
+  ;; -> $XDG_CONFIG_DIR/sway/config (by symlink-manager)
+  ("tmux/tmux.conf" ,(local-file "./tmux.conf")))
+@end lisp
+@end defvr
+
 @defvr {Scheme Variable} home-activation-service-type
 The service of this type generates a guile script, which runs on every
 @command{guix home reconfigure} invocation or any other action, which
 leads to the activation of the home environment.
 @end defvr
 
+@defvr {Scheme Variable} home-symlink-manager-service-type
+The service of this type generates a guile script, which will be
+executed during activation of home environment, and do a few following
+steps:
+
+@enumerate
+@item
+Reads the content of @file{files/} directory of current and pending home
+environments.
+
+@item
+Cleans up all symlinks created by symlink-manager on previous
+activation.  Also, sub-directories, which become empty also will be
+cleaned up.
+
+@item
+Creates new symlinks the following way: It looks @file{files/} directory
+(usually defined with @code{home-files-service-type},
+@code{home-xdg-configuration-files-service-type} and maybe some others),
+takes the files from @file{files/.config/} subdirectory and put
+respective links in @env{XDG_CONFIG_DIR}.  For example symlink for
+@file{files/.config/sway/config} will end up in
+@file{$XDG_CONFIG_DIR/sway/config}.  The rest files in @file{files/}
+outside of @file{files/.config/} subdirectory will be treated slightly
+different: symlink will just go to @file{$HOME}.
+@file{files/.some-program/config} will end up in
+@file{$HOME/.some-program/config}.
+
+@item
+If some sub-directories are missing, they will be created.
+
+@item
+If there is a clashing files on the way, they will be backed up.
+
+@end enumerate
+
+symlink-manager is a part of essential home services and is enabled and
+used by default.
+@end defvr
+
+
 @node Shells Home Services
 @subsection Shells
 
-- 
2.36.1

[Message part 3 (text/plain, inline)]
-- 
Best regards,
Andrew Tropin
[signature.asc (application/pgp-signature, inline)]

bug closed, send any further explanations to 53603 <at> debbugs.gnu.org and Andrew Tropin <andrew <at> trop.in> Request was from Andrew Tropin <andrew <at> trop.in> to control <at> debbugs.gnu.org. (Fri, 26 Aug 2022 04:23:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Fri, 23 Sep 2022 11:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 1 year and 215 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.