[PATCH] doc: Add files and symlink-manager home services.

  • Done
  • quality assurance status badge
Details
2 participants
  • Andrew Tropin
  • Ludovic Courtès
Owner
unassigned
Submitted by
Andrew Tropin
Severity
normal
A
A
Andrew Tropin wrote on 28 Jan 2022 12:52
(address . guix-patches@gnu.org)(address . nick@const.fun)
87zgngm5wm.fsf@trop.in
* doc/guix.texi (Essential Home Services): Add files and symlink-manager home
services.
---
doc/guix.texi | 65 +++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 65 insertions(+)

Toggle diff (84 lines)
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
-----BEGIN PGP SIGNATURE-----

iQJCBAEBCgAtFiEEKEGaxlA4dEDH6S/6IgjSCVjB3rAFAmHz2ZkPHGFuZHJld0B0
cm9wLmluAAoJECII0glYwd6wkNYP9jTc32kjMOtAq3xcP6LE8ZfmaFAb77YERSR9
62jeNGOFEaXWLXV09jzl432ZeyFdGFGLin4wLUqDpJC8GRlmGyBCsD91ov1d97Vt
czQpyoyCBqEyfI4WywxvmxzD8qsZxxM7u0/L3Xz3/lXWKleAbfaGPZShRa0sR2Np
pQTJuIrGXPNOQnrUGUk2U6RiHI+WOBg7bJRmVnU/mUfOC601QJbZVNPkfotaP2YD
Uu/cNiPIhVsgBlNdVBtjTdyBs7+QIUDZmxwFID9wOdxHs99mYr/YsF9UU3doH8L6
o6S8TopQk9TrZdt5u+19Wq5kkaH3BSgmu6Nnk4ttiCoUun+bjJ5ZLfFemp3uFUAY
SfiQH3mB/7r+Wh4uXbOyqd6Drc77oJYFe5APeplm/JAAQrL0TWoDutotiUDE+WEo
tjeCw/O865PCA+jvsSFqdr94zYbRWCsIIy1K09MhmZXNSdtwtPicKxMbh/1fprve
sZbXvk05S+fSP8Vi5zuE15LqWMm562ODlXn7aXE1IbuLYeEH+r1rrwgbMbfuUfuv
3iOrn8t3TzAXKKoBEvDOV/2pz0eLcLMKZJKLjqAcmyY/vAdOOf1UhONRvVpJlf/d
MoS/FvdVgyaM1PuqGrrivZYVbn2MqQWlDsvA8778PNDb7gxMDxQyc4dIDpc3sX26
69Dc9Ig=
=7wKP
-----END PGP SIGNATURE-----

L
L
Ludovic Courtès wrote on 22 Jun 2022 12:43
(name . Andrew Tropin)(address . andrew@trop.in)
87a6a53rn5.fsf@gnu.org
Hi Andrew,

Andrew Tropin <andrew@trop.in> skribis:

Toggle quote (26 lines)
> * 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’.
A
A
Andrew Tropin wrote on 24 Jun 2022 12:26
[PATCH v2] doc: Add files, xdg-configuration and symlink-manager home services.
(name . Ludovic Courtès)(address . ludo@gnu.org)
87h74abbn6.fsf@trop.in
On 2022-06-22 12:43, Ludovic Courtès wrote:

Toggle quote (35 lines)
> Hi Andrew,
>
> Andrew Tropin <andrew@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:
From 7190711d98687973c6b75d6e3b75dbc466282801 Mon Sep 17 00:00:00 2001
From: Andrew Tropin <andrew@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(+)

Toggle diff (102 lines)
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
--
Best regards,
Andrew Tropin
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCgAdFiEEKEGaxlA4dEDH6S/6IgjSCVjB3rAFAmK1kU0ACgkQIgjSCVjB
3rDIkxAAgaypM3Kb03BA0xxsULkSSxja14HYvm/s9NIQUydVe/o/4Z/2Jkfx+o9A
QOC2AI+h/545HdLdaofQKonU7RHlcdGa4cirBxSZD1oTU5BWLy9gvRutecxLz1n5
ndFikDBh3zs4SAF1AHOKYp77YTxk5w4plivqpY90QPMEWMvplqkhg8/e8wqWtov5
C/ayvXr52oX7ozpHuW4JaHz1qcf8ji75Mbn0giVfDkbcN0xEN0F6kR9RtwPnXE6p
D/LXzZDtS0yxyYjTF0p8sKXlTZ5RjbFLjJBMOueI3dWGIArXaA3GhWpm+v6g8iCq
dFk3nz9qD9y0iP96YJY7lpSPjAP5t1VS0pjpWYbJWS0HJTIrWoUHpKOUspGuwRJ1
0i0+7r00h4bTnDMbCsfxdmzWR8QXyFkoStaDFC5tbYu2VDXErEnqhfYjaltNcw8W
ZPLspEXh74G2ubMBC0AMnd4z3NcolmiJeCxrLRDO7pKdZPdPKl9tfbausqiv0m84
Nt0LM4Oh6+sf1C3CmED7NUe42ZA27d6wsKL9N0YV65+dvRlxlZxKBVxt6RdAAdsR
08Ta62exnaOYhRjWIqHqXeF9NqMuoHZepTy1cRiHVZNE4C2i0ot2Rt3Go/2idStH
zBxpLXEmrANEeBpppgWzAXsDzCLYdBuLXwwjuY1GlRl7ca0dFbk=
=1sqT
-----END PGP SIGNATURE-----

A
A
Andrew Tropin wrote on 26 Aug 2022 06:21
Applied
(address . control@debbugs.gnu.org)
8735djr5wq.fsf@trop.in
close 53603
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCgAdFiEEKEGaxlA4dEDH6S/6IgjSCVjB3rAFAmMISlUACgkQIgjSCVjB
3rAthA//dnHEuvIKYIohM12HCpLCBtbc9Pj+GSYJoPtKjPMcN5X7n21UMRgn3SBr
/e4JEzkWDTZ1L81KGPvXJIJ/hJp+NVHw0a2fais9yLj3iaI89E3ddqEZ360idvol
vWetiq5Xp5BlpxKopfDSpi5roF5fS/pL0ykwao3GBTXLY4QhJHsVWCDgSrPhc6hT
cja25R6igUkLlslF8DS0UBqiUYA0MK7OliACA6rH8T9y19RL4+O4GyxEX/DBBpH6
5jmzLzZd0fow+UaoALdTcJXPo1MJqSqw6cuQJrfDScJlJnozIIBqJ8e2KZegI/M+
zKBQwFyQF5RLlukgRBsfK9evNAj3HG9ZDil0eZs3/rzTT2WY5Mau4KnM6qqs8Lzo
XxKzx3YtvUgqISfr1hJQyHXaAtBA8iAX5FBOdmuLiedl/c8H2gLNvzfZNYLEmGlK
a+7Ek12Oo5jyy4j/SaICWXFldYlDOGrcIC+5m7z99mf6qpCC+Ls2nBKIXqpIU+iT
X2/LeZkUf+0hGfQ9CQmXgzCKxASAFcwO3TQ/ifa4DWLHWsuGCvQ8obFjx5mXBOkK
wmgPnZXXG+LGam7/qLuJZc899BetHzq9xSjSuS1OI/MPRKTaRkebcMy8VXWkE9+K
9ABowMtT5ZS0tv4nC8tEuFVj8hWW2lpZ99SrZdbL/RYc26yX9po=
=JY2a
-----END PGP SIGNATURE-----

?