GNU bug report logs - #60521
[PATCH] home: Add home-stow-migration-service.

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: guix-patches; Reported by: goodoldpaul@HIDDEN; Keywords: moreinfo patch; dated Tue, 3 Jan 2023 16:53:02 UTC; Maintainer for guix-patches is guix-patches@HIDDEN.
Added tag(s) moreinfo. Request was from Ludovic Courtès <ludo@HIDDEN> to control <at> debbugs.gnu.org. Full text available.

Message received at 60521 <at> debbugs.gnu.org:


Received: (at 60521) by debbugs.gnu.org; 25 Jan 2023 06:32:43 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Jan 25 01:32:43 2023
Received: from localhost ([127.0.0.1]:58111 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1pKZKs-0005u1-VI
	for submit <at> debbugs.gnu.org; Wed, 25 Jan 2023 01:32:43 -0500
Received: from relay1-d.mail.gandi.net ([217.70.183.193]:34409)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <andrew@HIDDEN>) id 1pKZKq-0005tm-26
 for 60521 <at> debbugs.gnu.org; Wed, 25 Jan 2023 01:32:40 -0500
Received: (Authenticated sender: andrew@HIDDEN)
 by mail.gandi.net (Postfix) with ESMTPSA id A4C1F240004;
 Wed, 25 Jan 2023 06:32:33 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=trop.in; s=gm1;
 t=1674628354;
 h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
 to:to:cc:cc:mime-version:mime-version:content-type:content-type:
 in-reply-to:in-reply-to:references:references;
 bh=Ldlz+onYxrGIuwdV6KynHYdVCBTh3EgZsq9wDX0tAuw=;
 b=JNBRTxDeR+omAV37jqKB3+odw+lVvl0XHOicHrC5wa5yMGz+vG3Lrbb8eeXXER5gnR6a5P
 XcaC1tTNkrffzj2AKdVhKVuyS36Bzr7FVWy0OwwtfIfV+ZMcmAHD1NfwGTMbRCENwbHovN
 COftjjmsYabMWeQDfP+Tr7qTiqsNwfMXwUWg7XMuUFvg9Q5pk/bmuHmN5a/rfRdUeX0b6R
 Rg9/Vlx+2ARpd+o1T3VINrfmuxZwcKj0i40Vs1ShMOnigs+vMVGa8qDiChzu+IbERWZrDY
 O9UB9hMS290qAA1KTvLqI/4CVPJgdwg62lUpiJshm3N6mVv4CV0aQ3Bi7Hz4Nw==
From: Andrew Tropin <andrew@HIDDEN>
To: Ludovic =?utf-8?Q?Court=C3=A8s?= <ludo@HIDDEN>
Subject: Re: [bug#60521] [PATCH] home: Add home-stow-migration-service.
In-Reply-To: <87edrl4kio.fsf@HIDDEN>
References: <0a8d7bce31856292baa06a08260494c0@HIDDEN>
 <20230103165534.25644-1-goodoldpaul@HIDDEN>
 <87o7qxi9ym.fsf_-_@HIDDEN> <87tu0p89wf.fsf@HIDDEN>
 <87edrl4kio.fsf@HIDDEN>
Date: Wed, 25 Jan 2023 10:32:29 +0400
Message-ID: <874jsft98i.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: multipart/signed; boundary="=-=-=";
 micalg=pgp-sha512; protocol="application/pgp-signature"
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 60521
Cc: Giacomo Leidi <goodoldpaul@HIDDEN>, 60521 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

--=-=-=
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable

On 2023-01-23 11:23, Ludovic Court=C3=A8s wrote:

> Hi,
>
> Andrew Tropin <andrew@HIDDEN> skribis:
>
>>>> +A suitable configuration would then be:
>>>> +
>>>> +@lisp
>>>> +  (home-stow-migration-service
>>>> +   (string-append (getenv "HOME")
>>>> +                  "/.dotfiles"))
>>>> +@end lisp
>>
>> The service looks neat!  Thank you, Giacomo.
>>
>> Ludo, wouldn't it be better and safer to use (local-file "./dotfiles"
>> #:recursive? #t) here?  I find it kinda dangerous for reproducibility to
>> reference local files and make logic inside the service to depend on it.
>
> Currently I don=E2=80=99t think that=E2=80=99s possible because the servi=
ce imports
> those files at configuration time, but the end result is the same: those
> dot files are copied to the store and that=E2=80=99s what=E2=80=99s refer=
enced.
>
> I think it=E2=80=99s okay like this, but I don=E2=80=99t have a strong op=
inion.
>
> That said, from a usability viewpoint, it does mean that users would
> typically have to version-controlled directories (one with the Home
> config file, and one with the Stow-style dot file tree), which is not
> great.  Perhaps the manual could say something about it.
>

The long-term idea I have is to provide a hermetic evaluation mode (not
only for home environments, but for guix in general), which allows to
make sure programmatically that all files referenced comes from either
origins with hash explicitly specified or commited in the current vcs
repository.  This way by changing things like

(local-file "./dotfiles" #:recursive? #t) to something like
(file-append (current-repo) "/dotfiles") or
(vcs-file "dotfiles" #:recursive? #t)

we will be able to guarantee that one didn't forget to copy all needed
dependencies for the configuration and to keep API "future compatible"
looks like a good idea.

Just thinking out loud, someday will make a separate
thread/note/prototype on this topic.=20=20

Anyway, this service looks good enough to me with the current
implementation and seems potentially helpful.

=2D-=20
Best regards,
Andrew Tropin

--=-=-=
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----

iQIzBAEBCgAdFiEEKEGaxlA4dEDH6S/6IgjSCVjB3rAFAmPQzP0ACgkQIgjSCVjB
3rAy0g//fVupV4O+bUINCEZFcfV8sPddnl89rEdJ9nISb/XlcHEiMMqRZ9x8d2mk
tLGU/SlW9ZydZn5UQCGt5WsXFR0O9Pc1lpJCcBhOVudbNpR7c+FDBMd5KhfeSEae
paYeT1w6UtD+rhKU2n6Y8cNDa8YmYwWvz1XQBU56nsRZlVRN76n4522fLAw4QgeQ
QspAdPhY91V13+cAGrbc6ksNfzCM/n9M+sCnN9kH+scpawBIkLR5UboFvtGOSWGY
MPVWzLVA7EXcGX8mZb+bIyEDSRfLAPFYhOG1HZ3cCjbnPaZ1nnEDfy/uJuJLqYKj
nh6ryD66ErdL3r4O52ycqSg9DAT+3MEBPvRzwp8kBJW2ynKbMjNNtsGf22g/C+tN
KyR22U3V1I9Jgh8uzLRzMxAcwuhLYLVM8nDVjU3bfxwbm384+AjAjm7kb4nJXZWH
S4f18MvZ8lqvJr/zDdscgxomlNKXe7pnnoDpcqkYF7RiEbFCu+62iTuL7t4B1Y6j
o8DO60BMGnx3pHCb3sMljimIcMpeGGH4ooDIEHSkPURy9ocmS2VjEikwRP2E09Zc
1x8yEpK8i3GgIwv1XBoaoNc5Rs/rYpwHo87KWTShSpYzZwZXnzI/keDddzg0Jb+Q
iRnjRA7oR9m+AW0A3jDwufAZkd/Hcf6bhzcUf8Fd01Cfz50cYoE=
=jT1l
-----END PGP SIGNATURE-----
--=-=-=--




Information forwarded to guix-patches@HIDDEN:
bug#60521; Package guix-patches. Full text available.

Message received at 60521 <at> debbugs.gnu.org:


Received: (at 60521) by debbugs.gnu.org; 23 Jan 2023 10:23:42 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Jan 23 05:23:42 2023
Received: from localhost ([127.0.0.1]:53440 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1pJtzK-0007cw-CR
	for submit <at> debbugs.gnu.org; Mon, 23 Jan 2023 05:23:42 -0500
Received: from eggs.gnu.org ([209.51.188.92]:46780)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <ludo@HIDDEN>) id 1pJtzH-0007ci-TT
 for 60521 <at> debbugs.gnu.org; Mon, 23 Jan 2023 05:23:40 -0500
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <ludo@HIDDEN>)
 id 1pJtz8-0000bG-MC; Mon, 23 Jan 2023 05:23:31 -0500
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=MIME-Version:In-Reply-To:Date:References:Subject:To:
 From; bh=ypPABqRnNsE6LOFoCn/ZyDPxViZpvho2tiPGmCmMZY8=; b=rbOrJePtse9kE2Ps0JIp
 ggYkeTMyXIqFxI6swKJnMb99h9zWJJiDlcEJRD7SM5mKmuGZtZYfJmxwWZFEkQHV0jEi2b1J0utnE
 OeW93O5EK+E7Yg651QlIYA5AWF+OBK/kHYpJs0FawoX5Mo5XAiV1MkJ/Baz1f9spZkbzEjeuVwje5
 kcePeIbCrzaEk5MRIvviRx64JRZYZ1NZU9S9OeIJDW3S/1mNnaesTr4J+HpsDEsYXQD2a711WDBTK
 julWG5X+PAlkheVe4NLnTPjmBnxTS5ikuyihdecaWmlIyOoHN+pognyIpkhs6K2p6u3z/ksgyH6uv
 rBfEUxzLNTdh2A==;
Received: from [2001:660:6102:320:e120:2c8f:8909:cdfe] (helo=ribbon)
 by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <ludo@HIDDEN>)
 id 1pJtz7-0002bW-1L; Mon, 23 Jan 2023 05:23:29 -0500
From: =?utf-8?Q?Ludovic_Court=C3=A8s?= <ludo@HIDDEN>
To: Andrew Tropin <andrew@HIDDEN>
Subject: Re: [bug#60521] [PATCH] home: Add home-stow-migration-service.
References: <0a8d7bce31856292baa06a08260494c0@HIDDEN>
 <20230103165534.25644-1-goodoldpaul@HIDDEN>
 <87o7qxi9ym.fsf_-_@HIDDEN> <87tu0p89wf.fsf@HIDDEN>
X-URL: http://www.fdn.fr/~lcourtes/
X-Revolutionary-Date: Quartidi 4 =?utf-8?Q?Pluvi=C3=B4se?= an 231 de la
 =?utf-8?Q?R=C3=A9volution=2C?= jour du Perce-neige
X-PGP-Key-ID: 0x090B11993D9AEBB5
X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc
X-PGP-Fingerprint: 3CE4 6455 8A84 FDC6 9DB4  0CFB 090B 1199 3D9A EBB5
X-OS: x86_64-pc-linux-gnu
Date: Mon, 23 Jan 2023 11:23:27 +0100
In-Reply-To: <87tu0p89wf.fsf@HIDDEN> (Andrew Tropin's message of "Tue, 17 Jan
 2023 19:21:04 +0400")
Message-ID: <87edrl4kio.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 60521
Cc: Giacomo Leidi <goodoldpaul@HIDDEN>, 60521 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

Hi,

Andrew Tropin <andrew@HIDDEN> skribis:

>>> +A suitable configuration would then be:
>>> +
>>> +@lisp
>>> +  (home-stow-migration-service
>>> +   (string-append (getenv "HOME")
>>> +                  "/.dotfiles"))
>>> +@end lisp
>
> The service looks neat!  Thank you, Giacomo.
>
> Ludo, wouldn't it be better and safer to use (local-file "./dotfiles"
> #:recursive? #t) here?  I find it kinda dangerous for reproducibility to
> reference local files and make logic inside the service to depend on it.

Currently I don=E2=80=99t think that=E2=80=99s possible because the service=
 imports
those files at configuration time, but the end result is the same: those
dot files are copied to the store and that=E2=80=99s what=E2=80=99s referen=
ced.

I think it=E2=80=99s okay like this, but I don=E2=80=99t have a strong opin=
ion.

That said, from a usability viewpoint, it does mean that users would
typically have to version-controlled directories (one with the Home
config file, and one with the Stow-style dot file tree), which is not
great.  Perhaps the manual could say something about it.

Thanks,
Ludo=E2=80=99.




Information forwarded to guix-patches@HIDDEN:
bug#60521; Package guix-patches. Full text available.

Message received at 60521 <at> debbugs.gnu.org:


Received: (at 60521) by debbugs.gnu.org; 17 Jan 2023 17:09:51 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Jan 17 12:09:51 2023
Received: from localhost ([127.0.0.1]:38102 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1pHpT2-0001so-04
	for submit <at> debbugs.gnu.org; Tue, 17 Jan 2023 12:09:51 -0500
Received: from smtpm5.myservices.hosting ([185.26.105.236]:43322)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <mirai@HIDDEN>) id 1pHpSx-0001sc-I3
 for 60521 <at> debbugs.gnu.org; Tue, 17 Jan 2023 12:09:47 -0500
Received: from mail1.netim.hosting (unknown [185.26.106.172])
 by smtpm5.myservices.hosting (Postfix) with ESMTP id D09B620CB0;
 Tue, 17 Jan 2023 18:09:36 +0100 (CET)
Received: from localhost (localhost [127.0.0.1])
 by mail1.netim.hosting (Postfix) with ESMTP id 7DBE780096;
 Tue, 17 Jan 2023 18:09:36 +0100 (CET)
X-Virus-Scanned: Debian amavisd-new at mail1.netim.hosting
Received: from mail1.netim.hosting ([127.0.0.1])
 by localhost (mail1-1.netim.hosting [127.0.0.1]) (amavisd-new, port 10026)
 with ESMTP id QAXOCNCFw8bL; Tue, 17 Jan 2023 18:09:35 +0100 (CET)
Received: from [192.168.1.239] (unknown [10.192.1.83])
 (Authenticated sender: lumen@HIDDEN)
 by mail1.netim.hosting (Postfix) with ESMTPSA id 2913180093;
 Tue, 17 Jan 2023 18:09:34 +0100 (CET)
Message-ID: <c8c49872-37f1-a0e0-46a1-91942023f00b@HIDDEN>
Date: Tue, 17 Jan 2023 17:09:34 +0000
MIME-Version: 1.0
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
 Thunderbird/102.6.1
Subject: Re: [bug#60521] [PATCH] home: Add home-stow-migration-service.
Content-Language: en-US
To: Giacomo Leidi <goodoldpaul@HIDDEN>
References: <0a8d7bce31856292baa06a08260494c0@HIDDEN>
 <20230103165534.25644-1-goodoldpaul@HIDDEN>
From: Bruno Victal <mirai@HIDDEN>
In-Reply-To: <20230103165534.25644-1-goodoldpaul@HIDDEN>
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Spam-Score: -1.1 (-)
X-Debbugs-Envelope-To: 60521
Cc: 60521 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.1 (--)

On 2023-01-03 16:55, Giacomo Leidi via Guix-patches via wrote:
> * gnu/home/services.scm (dotfiles-for-app): New variable;
> (home-stow-migration-configuration): new variable;
> (home-stow-migration-service): new variable.
> * doc/guix.texi: Document it.
> ---
>  doc/guix.texi         | 50 +++++++++++++++++++++++++++++++++++++++++++
>  gnu/home/services.scm | 49 ++++++++++++++++++++++++++++++++++++++++++
>  2 files changed, 99 insertions(+)
> 
> diff --git a/doc/guix.texi b/doc/guix.texi
> index 5c85680831..40c36f65c4 100644
> --- a/doc/guix.texi
> +++ b/doc/guix.texi
> @@ -109,6 +109,7 @@ Copyright @copyright{} 2022 Reily Siegel@*
>  Copyright @copyright{} 2022 Simon Streit@*
>  Copyright @copyright{} 2022 (@*
>  Copyright @copyright{} 2022 John Kehayias@*
> +Copyright @copyright{} 2023 Giacomo Leidi@*
>  
>  Permission is granted to copy, distribute and/or modify this document
>  under the terms of the GNU Free Documentation License, Version 1.3 or
> @@ -41119,6 +41120,55 @@ to use alternative services to implement more advanced use cases like
>  read-only home.  Feel free to experiment and share your results.
>  @end defvr
>  
> +@deffn {Scheme Procedure} home-stow-migration-service
> +Return a service which is very similiar to @code{home-files-service-type}
> +(and actually extends it), but designed to ease the way into using Guix

Procedures in Guix are almost always Scheme functions, perhaps you could write this as:
    @defun home-stow-migration-service

> +Home for GNU Stow users.  This service allows users to point Guix Home to
> +their Stow directory and have their file automatically deployed to their home
> +directory just like Stow would, without migrating all of their dotfiles to Guix
> +native configurations.
> +
> +A typical Stow setup consists of a source directory and a target directory.
> +The source directory must be structured as follows:
> +
> +@example
> +~$ tree -a .dotfiles/
> +.dotfiles/
> +├── git
> +│   └── .gitconfig
> +├── gpg
> +│   └── .gnupg
> +│       ├── gpg-agent.conf
> +│       └── gpg.conf
> +├── guile
> +│   └── .guile
> +├── guix
> +│   └── .config
> +│       └── guix
> +│           ├── channels.scm
> +│           └── .gitignore
> +├── nix
> +│   ├── .config
> +│   │   └── nixpkgs
> +│   │       └── config.nix
> +│   └── .nix-channels
> +├── tmux
> +│   └── .tmux.conf
> +└── vim
> +    └── .vimrc
> +
> +13 directories, 10 files
> +@end example
> +
> +A suitable configuration would then be:
> +
> +@lisp
> +  (home-stow-migration-service
> +   (string-append (getenv "HOME")
> +                  "/.dotfiles"))
> +@end lisp
> +@end deffn
> +
>  @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

In a similar vein, this could be written as:
    @defvar home-xdg-configuration-files-service-type

> diff --git a/gnu/home/services.scm b/gnu/home/services.scm
> index 99035686f1..996647c592 100644
> --- a/gnu/home/services.scm
> +++ b/gnu/home/services.scm
> @@ -1,6 +1,7 @@
>  ;;; GNU Guix --- Functional package management for GNU
>  ;;; Copyright © 2021 Andrew Tropin <andrew@HIDDEN>
>  ;;; Copyright © 2021 Xinglu Chen <public@HIDDEN>
> +;;; Copyright © 2023 Giacomo Leidi <goodoldpaul@HIDDEN>
>  ;;;
>  ;;; This file is part of GNU Guix.
>  ;;;
> @@ -21,6 +22,7 @@ (define-module (gnu home services)
>    #:use-module (gnu services)
>    #:use-module ((gnu packages package-management) #:select (guix))
>    #:use-module ((gnu packages base) #:select (coreutils))
> +  #:use-module (guix build utils)
>    #:use-module (guix channels)
>    #:use-module (guix monads)
>    #:use-module (guix store)
> @@ -33,13 +35,16 @@ (define-module (gnu home services)
>    #:use-module (guix i18n)
>    #:use-module (guix modules)
>    #:use-module (srfi srfi-1)
> +  #:use-module (ice-9 ftw)
>    #:use-module (ice-9 match)
> +  #:use-module (ice-9 string-fun)
>    #:use-module (ice-9 vlist)
>  
>    #:export (home-service-type
>              home-profile-service-type
>              home-environment-variables-service-type
>              home-files-service-type
> +            home-stow-migration-service
>              home-xdg-configuration-files-service-type
>              home-xdg-data-files-service-type
>              home-run-on-first-login-service-type
> @@ -49,6 +54,7 @@ (define-module (gnu home services)
>  
>              environment-variable-shell-definitions
>              home-files-directory
> +            home-stow-migration-configuration
>              xdg-configuration-files-directory
>              xdg-data-files-directory
>  
> @@ -315,6 +321,49 @@ (define home-files-service-type
>                  (description "Files that will be put in
>  @file{~~/.guix-home/files}, and further processed during activation.")))
>  
> +(define (dotfiles-for-app app-dir)
> +  "Return a list of objects compatible with @{home-files-service-type}'s
> +value.  Each object is a pair where the first element is the relative path
> +of a file and the second is a gexp representing the file content.  Objects are
> +generated by recursively visiting APP-DIR and mapping its contents to the

Instead of `APP-DIR', you can use the @var command:
    @var{app-dir}

> +user's home directory."
> +  (let ((app-absolute-path (canonicalize-path app-dir)))
> +    (map (lambda (path)
> +           (let ((app-file-relative-path
> +                  (string-replace-substring path
> +                                           (string-append app-absolute-path "/")
> +                                           "")))
> +             (list app-file-relative-path
> +                   (local-file path
> +                               (string-append "home-stow-migration-"
> +                                              (string-replace-substring
> +                                               app-file-relative-path
> +                                               "/" "-"))))))
> +         (find-files app-absolute-path))))
> +
> +(define (home-stow-migration-configuration stow-dir)
> +  "Return a list of objects compatible with @{home-files-service-type}'s
> +value, generated following GNU Stow's algorithm using STOW-DIR as input
> +directory."

Same as above.

> +  (define (dir-contents dir)
> +    (scandir dir
> +             (lambda (name)
> +               (not (member name '("." ".."))))))
> +  (fold append
> +        '()
> +        (map (lambda (app-dir)
> +               (dotfiles-for-app
> +                (string-append stow-dir "/" app-dir)))
> +             (dir-contents stow-dir))))
> +
> +(define-public (home-stow-migration-service stow-dir)
> +  "Return a service extending @{home-files-service-type} with files from
> +STOW-DIR.  Files will be put in the user's home directory following GNU

Same as above.

> +Stow's algorithm, and further processed during activation."
> +  (simple-service 'home-stow-migration-service
> +                  home-files-service-type
> +                  (home-stow-migration-configuration stow-dir)))
> +
>  (define xdg-configuration-files-directory ".config")
>  
>  (define (xdg-configuration-files files)
> 
> base-commit: 473692b812b4ab4267d9bddad0fb27787d2112ff


Cheers,
Bruno




Information forwarded to guix-patches@HIDDEN:
bug#60521; Package guix-patches. Full text available.

Message received at 60521 <at> debbugs.gnu.org:


Received: (at 60521) by debbugs.gnu.org; 17 Jan 2023 15:21:18 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Jan 17 10:21:18 2023
Received: from localhost ([127.0.0.1]:37966 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1pHnm2-0002s7-5t
	for submit <at> debbugs.gnu.org; Tue, 17 Jan 2023 10:21:18 -0500
Received: from relay1-d.mail.gandi.net ([217.70.183.193]:50863)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <andrew@HIDDEN>) id 1pHnlz-0002rg-Iz
 for 60521 <at> debbugs.gnu.org; Tue, 17 Jan 2023 10:21:17 -0500
Received: (Authenticated sender: andrew@HIDDEN)
 by mail.gandi.net (Postfix) with ESMTPSA id D4A6C240009;
 Tue, 17 Jan 2023 15:21:07 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=trop.in; s=gm1;
 t=1673968869;
 h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
 to:to:cc:cc:mime-version:mime-version:content-type:content-type:
 in-reply-to:in-reply-to:references:references;
 bh=c6+ywVxtgkuhPp9R4Omjs5CrnZL64H60upoX7gizUbE=;
 b=RzzwnMke+g7CINLM5AwnG7Fa1GrEFLxnlRSzAvPuz9URFt7MW8z26sPL21Ex1iemBPAKOX
 bKFgrEfZ7mLapxeLkyIdbb0fPLbCkgAyRYm/6zGHyrBI/quqoqgWF4qZuD9M9Obv4NU1GY
 JmAZ/0+GrBNx9h9s/algU5IQKVOVOMk5JjyX24aoJAyMhL2NsZMSIRsRwCil0yISJRJpiY
 1u36F50FTYURV2/SJc3wRtYu7uaK9DhJECjGS+l6VZmLfJBErNmsSlQtJgi//SoQHGVtIV
 Eh4xk00TyGJH5qDR6NOb1kZAYVyC5uzvcGRMQVE0R7Xbb9FswQyM6VZA9GxyvQ==
From: Andrew Tropin <andrew@HIDDEN>
To: Ludovic =?utf-8?Q?Court=C3=A8s?= <ludo@HIDDEN>, Giacomo Leidi
 <goodoldpaul@HIDDEN>
Subject: Re: [bug#60521] [PATCH] home: Add home-stow-migration-service.
In-Reply-To: <87o7qxi9ym.fsf_-_@HIDDEN>
References: <0a8d7bce31856292baa06a08260494c0@HIDDEN>
 <20230103165534.25644-1-goodoldpaul@HIDDEN>
 <87o7qxi9ym.fsf_-_@HIDDEN>
Date: Tue, 17 Jan 2023 19:21:04 +0400
Message-ID: <87tu0p89wf.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: multipart/signed; boundary="=-=-=";
 micalg=pgp-sha512; protocol="application/pgp-signature"
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 60521
Cc: 60521 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

--=-=-=
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable

On 2023-01-17 14:09, Ludovic Court=C3=A8s wrote:

> Hi!
>
> Giacomo Leidi <goodoldpaul@HIDDEN> skribis:
>
>> * gnu/home/services.scm (dotfiles-for-app): New variable;
>> (home-stow-migration-configuration): new variable;
>> (home-stow-migration-service): new variable.
>> * doc/guix.texi: Document it.
>
> That looks very useful!
>
>> @@ -41119,6 +41120,55 @@ to use alternative services to implement more a=
dvanced use cases like
>>  read-only home.  Feel free to experiment and share your results.
>>  @end defvr
>>=20=20
>> +@deffn {Scheme Procedure} home-stow-migration-service
>
> Perhaps write a short intro (one or two sentences) above?
>
>> +Return a service which is very similiar to @code{home-files-service-typ=
e}
>> +(and actually extends it), but designed to ease the way into using Guix
>> +Home for GNU Stow users.  This service allows users to point Guix Home =
to
>> +their Stow directory and have their file automatically deployed to thei=
r home
>> +directory just like Stow would, without migrating all of their dotfiles=
 to Guix
>> +native configurations.
>> +
>> +A typical Stow setup consists of a source directory and a target direct=
ory.
>> +The source directory must be structured as follows:
>> +
>> +@example
>> +~$ tree -a .dotfiles/
>> +.dotfiles/
>> +=E2=94=9C=E2=94=80=E2=94=80 git
>> +=E2=94=82   =E2=94=94=E2=94=80=E2=94=80 .gitconfig
>> +=E2=94=9C=E2=94=80=E2=94=80 gpg
>> +=E2=94=82   =E2=94=94=E2=94=80=E2=94=80 .gnupg
>> +=E2=94=82       =E2=94=9C=E2=94=80=E2=94=80 gpg-agent.conf
>> +=E2=94=82       =E2=94=94=E2=94=80=E2=94=80 gpg.conf
>> +=E2=94=9C=E2=94=80=E2=94=80 guile
>> +=E2=94=82   =E2=94=94=E2=94=80=E2=94=80 .guile
>> +=E2=94=9C=E2=94=80=E2=94=80 guix
>> +=E2=94=82   =E2=94=94=E2=94=80=E2=94=80 .config
>> +=E2=94=82       =E2=94=94=E2=94=80=E2=94=80 guix
>> +=E2=94=82           =E2=94=9C=E2=94=80=E2=94=80 channels.scm
>> +=E2=94=82           =E2=94=94=E2=94=80=E2=94=80 .gitignore
>> +=E2=94=9C=E2=94=80=E2=94=80 nix
>> +=E2=94=82   =E2=94=9C=E2=94=80=E2=94=80 .config
>> +=E2=94=82   =E2=94=82   =E2=94=94=E2=94=80=E2=94=80 nixpkgs
>> +=E2=94=82   =E2=94=82       =E2=94=94=E2=94=80=E2=94=80 config.nix
>> +=E2=94=82   =E2=94=94=E2=94=80=E2=94=80 .nix-channels
>> +=E2=94=9C=E2=94=80=E2=94=80 tmux
>> +=E2=94=82   =E2=94=94=E2=94=80=E2=94=80 .tmux.conf
>> +=E2=94=94=E2=94=80=E2=94=80 vim
>> +    =E2=94=94=E2=94=80=E2=94=80 .vimrc
>> +
>> +13 directories, 10 files
>> +@end example
>> +
>> +A suitable configuration would then be:
>> +
>> +@lisp
>> +  (home-stow-migration-service
>> +   (string-append (getenv "HOME")
>> +                  "/.dotfiles"))
>> +@end lisp

The service looks neat!  Thank you, Giacomo.

Ludo, wouldn't it be better and safer to use (local-file "./dotfiles"
#:recursive? #t) here?  I find it kinda dangerous for reproducibility to
reference local files and make logic inside the service to depend on it.

>
> Maybe add a description of what it=E2=80=99s going to do with those files=
?  It=E2=80=99s
> kinda implicit but better be clear.
>
> Also, I feel like there=E2=80=99s nothing really Stow-specific here; it j=
ust
> happens to be a file layout convention that=E2=80=99s used by Stow, right=
?  So I
> wonder if could frame it differently, by describing the expected file
> tree structure first, and mentioning Stow only then?
>
> Last, I suggest adding a cross-reference to the Stow manual, as in:
>
>   @pxref{Top,,, stow, GNU Stow Manual}
>
>> +(define (dotfiles-for-app app-dir)
>> +  "Return a list of objects compatible with @{home-files-service-type}'s
>                                                ^
> Typo, should be @code.
>
>> +value.  Each object is a pair where the first element is the relative p=
ath
>> +of a file and the second is a gexp representing the file content.  Obje=
cts are
>> +generated by recursively visiting APP-DIR and mapping its contents to t=
he
>> +user's home directory."
>> +  (let ((app-absolute-path (canonicalize-path app-dir)))
>> +    (map (lambda (path)
>> +           (let ((app-file-relative-path
>> +                  (string-replace-substring path
>> +                                           (string-append app-absolute-=
path "/")
>> +                                           "")))
>
> Or just (string-drop path (string-length app-absolute-path)).
>
>> +             (list app-file-relative-path
>> +                   (local-file path
>> +                               (string-append "home-stow-migration-"
>> +                                              (string-replace-substring
>> +                                               app-file-relative-path
>> +                                               "/" "-"))))))
>> +         (find-files app-absolute-path))))
>
> Nitpick: by convention, the term =E2=80=9Cpath=E2=80=9D refers to =E2=80=
=9Csearch paths=E2=80=9D; here
> we=E2=80=99d instead use =E2=80=9Cfile name=E2=80=9D, but you can also ca=
ll the variable just
> =E2=80=98file=E2=80=99.
>
> The other convention is to avoid abbreviations in identifiers, and to
> avoid long identifiers for local variables.
>
> So s/app-dir/directory/ etc.
>
>> +(define (home-stow-migration-configuration stow-dir)
>> +  "Return a list of objects compatible with @{home-files-service-type}'s
>> +value, generated following GNU Stow's algorithm using STOW-DIR as input
>> +directory."
>> +  (define (dir-contents dir)
>> +    (scandir dir
>> +             (lambda (name)
>> +               (not (member name '("." ".."))))))
>> +  (fold append
>> +        '()
>> +        (map (lambda (app-dir)
>> +               (dotfiles-for-app
>> +                (string-append stow-dir "/" app-dir)))
>> +             (dir-contents stow-dir))))
>
> You can replace (fold append =E2=80=A6) with (append-map =E2=80=A6).
>
>> +(define-public (home-stow-migration-service stow-dir)
>
> You can drop this procedure.  Users are expected to write:
>
>   (service home-stow-migration-service)
>
> Could you send an updated patch?
>
> Thanks!
>
> Ludo=E2=80=99.
>
>
>

=2D-=20
Best regards,
Andrew Tropin

--=-=-=
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----

iQIzBAEBCgAdFiEEKEGaxlA4dEDH6S/6IgjSCVjB3rAFAmPGvOAACgkQIgjSCVjB
3rD4BA//fWFIt2fMw42Pd/Fag7aiHJL6QDvgo0fSNRvbrf7mySUlGfbDrJBX6mn7
DvQ6GnuiNr6y/PPswA3kIUaODwxlAeB1bHX1QU3S7Kjk3GCdi/h53rLFhlO4hXxj
g+PJ5pJ/ATr5+zd9XdekhT6a1aIPZYGqJHfNM7nMFQeoH+qptgvlkEUqqqdILyxi
1NJJgQUIxyuCGDqqW9RmjKN6b7kN9dIag0F8mRFcReIkBwknwTf9ohGeDcBU5i8T
GUVbp/5NGDs7cErsz8Lu9uS0GQpKVbcpnoLnMrnlxAGVJU6Caexen06LR1wUDXnS
WJ7MeOaeuJ3BRcODZJqMlOSf6kI68KeSmjHQIwZ80j7ui6EhtEsbjjx3bf93wxe8
arUGJo/mXLaJj7w7W2Xv8Ke+1EXY0WBr0x89ZEoQf5LZWVeCrz255+mXDsQDleFa
0REDqiXvoHGAbGfW3D7A6B157it1J4BUzeghp9irSFBZD2RYhgMExChAbvMD3ZU8
VfUe0rOi2Y1yofqS/eFNme4SiE4BxhjlNhSEuut2Ljb05fiXIYe4iwfBzCm/Ly+x
qMT+/6AA5cyZGdzcZLA4CjNFduoVmG0XRrqFW8NKNb19KncQrWpwVxjszdB8Cisq
B/fqVUMxg0W1kUPHiJKxgZj/nyaxiozoWL6mTpcsr0yPtPPxjZk=
=Zozo
-----END PGP SIGNATURE-----
--=-=-=--




Information forwarded to guix-patches@HIDDEN:
bug#60521; Package guix-patches. Full text available.

Message received at 60521 <at> debbugs.gnu.org:


Received: (at 60521) by debbugs.gnu.org; 17 Jan 2023 13:09:49 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Jan 17 08:09:49 2023
Received: from localhost ([127.0.0.1]:36090 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1pHlim-00054G-TM
	for submit <at> debbugs.gnu.org; Tue, 17 Jan 2023 08:09:49 -0500
Received: from eggs.gnu.org ([209.51.188.92]:50962)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <ludo@HIDDEN>) id 1pHlik-00053y-Jz
 for 60521 <at> debbugs.gnu.org; Tue, 17 Jan 2023 08:09:47 -0500
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <ludo@HIDDEN>)
 id 1pHlid-00061V-TO; Tue, 17 Jan 2023 08:09:39 -0500
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=MIME-Version:In-Reply-To:Date:References:Subject:To:
 From; bh=xJCQOpG71vR4rQqb4cciTF7It16fwjz+ekL+WlglYFM=; b=U8spHIw+djMcWYLQQ/RK
 VuxesR9rEeqZt+VVVh054REnc0569EcXwozC9Vns6UcXe+TaTbmyZi7qFO1C4BiyRZwlpJNGC+3sx
 Ag1CYPkxYe3S5rA3rI83kZx5PXsWerZB8nqblehUaUkWWcwsgjfhOZZBobY/rj7qokjKw/PoX6mNr
 03gGUF95M9mzZ648avd01Bx+dXVcjcq4XhdoNvi11f3C/eFN0440aijIWrxev2/LTYOw36QQln0Xr
 9bCj3XHcxPElByV8ZH7F4gy42YtiN4NOXrecyqd3LAac+hDVCt2uTOBoDQhoPR3XOZepeDIYVOklb
 3OI/dBSPeAuLZg==;
Received: from [193.50.110.246] (helo=ribbon)
 by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <ludo@HIDDEN>)
 id 1pHlid-0000lD-8K; Tue, 17 Jan 2023 08:09:39 -0500
From: =?utf-8?Q?Ludovic_Court=C3=A8s?= <ludo@HIDDEN>
To: Giacomo Leidi <goodoldpaul@HIDDEN>
Subject: Re: bug#60521: [PATCH] home: Add home-stow-migration-service.
References: <0a8d7bce31856292baa06a08260494c0@HIDDEN>
 <20230103165534.25644-1-goodoldpaul@HIDDEN>
Date: Tue, 17 Jan 2023 14:09:37 +0100
In-Reply-To: <20230103165534.25644-1-goodoldpaul@HIDDEN> (Giacomo
 Leidi's message of "Tue, 3 Jan 2023 17:55:34 +0100")
Message-ID: <87o7qxi9ym.fsf_-_@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 60521
Cc: 60521 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

Hi!

Giacomo Leidi <goodoldpaul@HIDDEN> skribis:

> * gnu/home/services.scm (dotfiles-for-app): New variable;
> (home-stow-migration-configuration): new variable;
> (home-stow-migration-service): new variable.
> * doc/guix.texi: Document it.

That looks very useful!

> @@ -41119,6 +41120,55 @@ to use alternative services to implement more ad=
vanced use cases like
>  read-only home.  Feel free to experiment and share your results.
>  @end defvr
>=20=20
> +@deffn {Scheme Procedure} home-stow-migration-service

Perhaps write a short intro (one or two sentences) above?

> +Return a service which is very similiar to @code{home-files-service-type}
> +(and actually extends it), but designed to ease the way into using Guix
> +Home for GNU Stow users.  This service allows users to point Guix Home to
> +their Stow directory and have their file automatically deployed to their=
 home
> +directory just like Stow would, without migrating all of their dotfiles =
to Guix
> +native configurations.
> +
> +A typical Stow setup consists of a source directory and a target directo=
ry.
> +The source directory must be structured as follows:
> +
> +@example
> +~$ tree -a .dotfiles/
> +.dotfiles/
> +=E2=94=9C=E2=94=80=E2=94=80 git
> +=E2=94=82   =E2=94=94=E2=94=80=E2=94=80 .gitconfig
> +=E2=94=9C=E2=94=80=E2=94=80 gpg
> +=E2=94=82   =E2=94=94=E2=94=80=E2=94=80 .gnupg
> +=E2=94=82       =E2=94=9C=E2=94=80=E2=94=80 gpg-agent.conf
> +=E2=94=82       =E2=94=94=E2=94=80=E2=94=80 gpg.conf
> +=E2=94=9C=E2=94=80=E2=94=80 guile
> +=E2=94=82   =E2=94=94=E2=94=80=E2=94=80 .guile
> +=E2=94=9C=E2=94=80=E2=94=80 guix
> +=E2=94=82   =E2=94=94=E2=94=80=E2=94=80 .config
> +=E2=94=82       =E2=94=94=E2=94=80=E2=94=80 guix
> +=E2=94=82           =E2=94=9C=E2=94=80=E2=94=80 channels.scm
> +=E2=94=82           =E2=94=94=E2=94=80=E2=94=80 .gitignore
> +=E2=94=9C=E2=94=80=E2=94=80 nix
> +=E2=94=82   =E2=94=9C=E2=94=80=E2=94=80 .config
> +=E2=94=82   =E2=94=82   =E2=94=94=E2=94=80=E2=94=80 nixpkgs
> +=E2=94=82   =E2=94=82       =E2=94=94=E2=94=80=E2=94=80 config.nix
> +=E2=94=82   =E2=94=94=E2=94=80=E2=94=80 .nix-channels
> +=E2=94=9C=E2=94=80=E2=94=80 tmux
> +=E2=94=82   =E2=94=94=E2=94=80=E2=94=80 .tmux.conf
> +=E2=94=94=E2=94=80=E2=94=80 vim
> +    =E2=94=94=E2=94=80=E2=94=80 .vimrc
> +
> +13 directories, 10 files
> +@end example
> +
> +A suitable configuration would then be:
> +
> +@lisp
> +  (home-stow-migration-service
> +   (string-append (getenv "HOME")
> +                  "/.dotfiles"))
> +@end lisp

Maybe add a description of what it=E2=80=99s going to do with those files? =
 It=E2=80=99s
kinda implicit but better be clear.

Also, I feel like there=E2=80=99s nothing really Stow-specific here; it just
happens to be a file layout convention that=E2=80=99s used by Stow, right? =
 So I
wonder if could frame it differently, by describing the expected file
tree structure first, and mentioning Stow only then?

Last, I suggest adding a cross-reference to the Stow manual, as in:

  @pxref{Top,,, stow, GNU Stow Manual}

> +(define (dotfiles-for-app app-dir)
> +  "Return a list of objects compatible with @{home-files-service-type}'s
                                               ^
Typo, should be @code.

> +value.  Each object is a pair where the first element is the relative pa=
th
> +of a file and the second is a gexp representing the file content.  Objec=
ts are
> +generated by recursively visiting APP-DIR and mapping its contents to the
> +user's home directory."
> +  (let ((app-absolute-path (canonicalize-path app-dir)))
> +    (map (lambda (path)
> +           (let ((app-file-relative-path
> +                  (string-replace-substring path
> +                                           (string-append app-absolute-p=
ath "/")
> +                                           "")))

Or just (string-drop path (string-length app-absolute-path)).

> +             (list app-file-relative-path
> +                   (local-file path
> +                               (string-append "home-stow-migration-"
> +                                              (string-replace-substring
> +                                               app-file-relative-path
> +                                               "/" "-"))))))
> +         (find-files app-absolute-path))))

Nitpick: by convention, the term =E2=80=9Cpath=E2=80=9D refers to =E2=80=9C=
search paths=E2=80=9D; here
we=E2=80=99d instead use =E2=80=9Cfile name=E2=80=9D, but you can also call=
 the variable just
=E2=80=98file=E2=80=99.

The other convention is to avoid abbreviations in identifiers, and to
avoid long identifiers for local variables.

So s/app-dir/directory/ etc.

> +(define (home-stow-migration-configuration stow-dir)
> +  "Return a list of objects compatible with @{home-files-service-type}'s
> +value, generated following GNU Stow's algorithm using STOW-DIR as input
> +directory."
> +  (define (dir-contents dir)
> +    (scandir dir
> +             (lambda (name)
> +               (not (member name '("." ".."))))))
> +  (fold append
> +        '()
> +        (map (lambda (app-dir)
> +               (dotfiles-for-app
> +                (string-append stow-dir "/" app-dir)))
> +             (dir-contents stow-dir))))

You can replace (fold append =E2=80=A6) with (append-map =E2=80=A6).

> +(define-public (home-stow-migration-service stow-dir)

You can drop this procedure.  Users are expected to write:

  (service home-stow-migration-service)

Could you send an updated patch?

Thanks!

Ludo=E2=80=99.




Information forwarded to guix-patches@HIDDEN:
bug#60521; Package guix-patches. Full text available.

Message received at 60521 <at> debbugs.gnu.org:


Received: (at 60521) by debbugs.gnu.org; 3 Jan 2023 16:55:55 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Jan 03 11:55:55 2023
Received: from localhost ([127.0.0.1]:46579 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1pCkZs-00030N-6a
	for submit <at> debbugs.gnu.org; Tue, 03 Jan 2023 11:55:55 -0500
Received: from confino.investici.org ([93.190.126.19]:54129)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <goodoldpaul@HIDDEN>) id 1pCkZm-000307-Uw
 for 60521 <at> debbugs.gnu.org; Tue, 03 Jan 2023 11:55:50 -0500
Received: from mx1.investici.org (unknown [127.0.0.1])
 by confino.investici.org (Postfix) with ESMTP id 4Nmf4c3rbnz10yL;
 Tue,  3 Jan 2023 16:55:44 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=autistici.org;
 s=stigmate; t=1672764944;
 bh=HHRTYOzSXHLJC7/hgUx0v90tti1vOShXOSOCdg+wPAo=;
 h=From:To:Cc:Subject:Date:From;
 b=rxxufMmBGAuU1OujTDcGZtP0IQ17dTgqkKuCOfWVVCAXOJg0NbnEWAisDb+I2cSOr
 M66p4wTE/RjRh3ZvBiMTOICG/RkFBcacCPsg21To2AsYPnzISi/vQQeMwhEKIqd7lR
 3/7wSntKej7V6YBykQhGzNG2V8RGthNLYL5AkUY4=
Received: from [93.190.126.19] (mx1.investici.org [93.190.126.19])
 (Authenticated sender: goodoldpaul@HIDDEN) by localhost (Postfix) with
 ESMTPSA id 4Nmf4c3HDQz10nn; Tue,  3 Jan 2023 16:55:44 +0000 (UTC)
From: Giacomo Leidi <goodoldpaul@HIDDEN>
To: 60521 <at> debbugs.gnu.org
Subject: [PATCH] home: Add home-stow-migration-service.
Date: Tue,  3 Jan 2023 17:55:34 +0100
Message-Id: <20230103165534.25644-1-goodoldpaul@HIDDEN>
X-Mailer: git-send-email 2.38.1
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 60521
Cc: Giacomo Leidi <goodoldpaul@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

* gnu/home/services.scm (dotfiles-for-app): New variable;
(home-stow-migration-configuration): new variable;
(home-stow-migration-service): new variable.
* doc/guix.texi: Document it.
---
 doc/guix.texi         | 50 +++++++++++++++++++++++++++++++++++++++++++
 gnu/home/services.scm | 49 ++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 99 insertions(+)

diff --git a/doc/guix.texi b/doc/guix.texi
index 5c85680831..40c36f65c4 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -109,6 +109,7 @@ Copyright @copyright{} 2022 Reily Siegel@*
 Copyright @copyright{} 2022 Simon Streit@*
 Copyright @copyright{} 2022 (@*
 Copyright @copyright{} 2022 John Kehayias@*
+Copyright @copyright{} 2023 Giacomo Leidi@*
 
 Permission is granted to copy, distribute and/or modify this document
 under the terms of the GNU Free Documentation License, Version 1.3 or
@@ -41119,6 +41120,55 @@ to use alternative services to implement more advanced use cases like
 read-only home.  Feel free to experiment and share your results.
 @end defvr
 
+@deffn {Scheme Procedure} home-stow-migration-service
+Return a service which is very similiar to @code{home-files-service-type}
+(and actually extends it), but designed to ease the way into using Guix
+Home for GNU Stow users.  This service allows users to point Guix Home to
+their Stow directory and have their file automatically deployed to their home
+directory just like Stow would, without migrating all of their dotfiles to Guix
+native configurations.
+
+A typical Stow setup consists of a source directory and a target directory.
+The source directory must be structured as follows:
+
+@example
+~$ tree -a .dotfiles/
+.dotfiles/
+├── git
+│   └── .gitconfig
+├── gpg
+│   └── .gnupg
+│       ├── gpg-agent.conf
+│       └── gpg.conf
+├── guile
+│   └── .guile
+├── guix
+│   └── .config
+│       └── guix
+│           ├── channels.scm
+│           └── .gitignore
+├── nix
+│   ├── .config
+│   │   └── nixpkgs
+│   │       └── config.nix
+│   └── .nix-channels
+├── tmux
+│   └── .tmux.conf
+└── vim
+    └── .vimrc
+
+13 directories, 10 files
+@end example
+
+A suitable configuration would then be:
+
+@lisp
+  (home-stow-migration-service
+   (string-append (getenv "HOME")
+                  "/.dotfiles"))
+@end lisp
+@end deffn
+
 @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
diff --git a/gnu/home/services.scm b/gnu/home/services.scm
index 99035686f1..996647c592 100644
--- a/gnu/home/services.scm
+++ b/gnu/home/services.scm
@@ -1,6 +1,7 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2021 Andrew Tropin <andrew@HIDDEN>
 ;;; Copyright © 2021 Xinglu Chen <public@HIDDEN>
+;;; Copyright © 2023 Giacomo Leidi <goodoldpaul@HIDDEN>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -21,6 +22,7 @@ (define-module (gnu home services)
   #:use-module (gnu services)
   #:use-module ((gnu packages package-management) #:select (guix))
   #:use-module ((gnu packages base) #:select (coreutils))
+  #:use-module (guix build utils)
   #:use-module (guix channels)
   #:use-module (guix monads)
   #:use-module (guix store)
@@ -33,13 +35,16 @@ (define-module (gnu home services)
   #:use-module (guix i18n)
   #:use-module (guix modules)
   #:use-module (srfi srfi-1)
+  #:use-module (ice-9 ftw)
   #:use-module (ice-9 match)
+  #:use-module (ice-9 string-fun)
   #:use-module (ice-9 vlist)
 
   #:export (home-service-type
             home-profile-service-type
             home-environment-variables-service-type
             home-files-service-type
+            home-stow-migration-service
             home-xdg-configuration-files-service-type
             home-xdg-data-files-service-type
             home-run-on-first-login-service-type
@@ -49,6 +54,7 @@ (define-module (gnu home services)
 
             environment-variable-shell-definitions
             home-files-directory
+            home-stow-migration-configuration
             xdg-configuration-files-directory
             xdg-data-files-directory
 
@@ -315,6 +321,49 @@ (define home-files-service-type
                 (description "Files that will be put in
 @file{~~/.guix-home/files}, and further processed during activation.")))
 
+(define (dotfiles-for-app app-dir)
+  "Return a list of objects compatible with @{home-files-service-type}'s
+value.  Each object is a pair where the first element is the relative path
+of a file and the second is a gexp representing the file content.  Objects are
+generated by recursively visiting APP-DIR and mapping its contents to the
+user's home directory."
+  (let ((app-absolute-path (canonicalize-path app-dir)))
+    (map (lambda (path)
+           (let ((app-file-relative-path
+                  (string-replace-substring path
+                                           (string-append app-absolute-path "/")
+                                           "")))
+             (list app-file-relative-path
+                   (local-file path
+                               (string-append "home-stow-migration-"
+                                              (string-replace-substring
+                                               app-file-relative-path
+                                               "/" "-"))))))
+         (find-files app-absolute-path))))
+
+(define (home-stow-migration-configuration stow-dir)
+  "Return a list of objects compatible with @{home-files-service-type}'s
+value, generated following GNU Stow's algorithm using STOW-DIR as input
+directory."
+  (define (dir-contents dir)
+    (scandir dir
+             (lambda (name)
+               (not (member name '("." ".."))))))
+  (fold append
+        '()
+        (map (lambda (app-dir)
+               (dotfiles-for-app
+                (string-append stow-dir "/" app-dir)))
+             (dir-contents stow-dir))))
+
+(define-public (home-stow-migration-service stow-dir)
+  "Return a service extending @{home-files-service-type} with files from
+STOW-DIR.  Files will be put in the user's home directory following GNU
+Stow's algorithm, and further processed during activation."
+  (simple-service 'home-stow-migration-service
+                  home-files-service-type
+                  (home-stow-migration-configuration stow-dir)))
+
 (define xdg-configuration-files-directory ".config")
 
 (define (xdg-configuration-files files)

base-commit: 473692b812b4ab4267d9bddad0fb27787d2112ff
-- 
2.38.1





Information forwarded to guix-patches@HIDDEN:
bug#60521; Package guix-patches. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 3 Jan 2023 16:52:19 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Jan 03 11:52:18 2023
Received: from localhost ([127.0.0.1]:46574 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1pCkWQ-0002uI-Hn
	for submit <at> debbugs.gnu.org; Tue, 03 Jan 2023 11:52:18 -0500
Received: from lists.gnu.org ([209.51.188.17]:58360)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <goodoldpaul@HIDDEN>) id 1pCkWO-0002uA-JR
 for submit <at> debbugs.gnu.org; Tue, 03 Jan 2023 11:52:17 -0500
Received: from eggs.gnu.org ([2001:470:142:3::10])
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <goodoldpaul@HIDDEN>)
 id 1pCkWO-0006Jd-Eu
 for guix-patches@HIDDEN; Tue, 03 Jan 2023 11:52:16 -0500
Received: from confino.investici.org ([2a11:7980:1::2:0])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <goodoldpaul@HIDDEN>)
 id 1pCkWL-0007c9-5h
 for guix-patches@HIDDEN; Tue, 03 Jan 2023 11:52:15 -0500
Received: from 1.mail-backend.investici.org (unknown [10.0.0.11])
 by confino.investici.org (Postfix) with ESMTP id 4Nmf0H2XCyz10yH
 for <guix-patches@HIDDEN>; Tue,  3 Jan 2023 16:51:59 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=autistici.org;
 s=stigmate; t=1672764719;
 bh=QAIQtEsp0aTSjyQrInoyLFMRgzyOvZDMZp2fL/2gfk8=;
 h=Date:From:To:Subject:From;
 b=JHZO7A9/id2y1pDqqOpCSqb+KR/AzTQfenVC4eJ/nr+SklDmonDxWbQ8lrXHU3yPe
 mw9Ub7qyv5c9HvZNB+EHjdXA4VHLmHQRQMU+GXQnlW+NITU4ec83WZosnVrRpR+181
 l6BGGgtgOJDEp0buTiNTlywZNLepL6IHkZcmx+qw=
Received: from 1.webmail.investici.org (localhost [127.0.0.1])
 (Authenticated sender: goodoldpaul@HIDDEN)
 by 1.mail-backend.investici.org (Postfix) with ESMTPA id 4Nmf0H1JK5z5sxK
 for <guix-patches@HIDDEN>; Tue,  3 Jan 2023 16:51:59 +0000 (UTC)
MIME-Version: 1.0
Date: Tue, 03 Jan 2023 16:51:59 +0000
From: goodoldpaul@HIDDEN
To: guix-patches@HIDDEN
Subject: [PATCH] home: Add home-stow-migration-service.
User-Agent: Roundcube Webmail
Message-ID: <0a8d7bce31856292baa06a08260494c0@HIDDEN>
X-Sender: goodoldpaul@HIDDEN
Content-Type: text/plain; charset=US-ASCII;
 format=flowed
Content-Transfer-Encoding: 7bit
Received-SPF: pass client-ip=2a11:7980:1::2:0;
 envelope-from=goodoldpaul@HIDDEN; helo=confino.investici.org
X-Spam_score_int: -20
X-Spam_score: -2.1
X-Spam_bar: --
X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_PASS=-0.001,
 SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: -1.4 (-)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.4 (--)

Dear Guixers,

I'm upstreaming a Guix Home service I've been using for quite some time 
in my personal channel ( 
https://gitlab.com/orang3/small-guix/-/blob/master/small-guix/home/services/dotfiles.scm 
) with some small improvements to make it suitable for Guix mainline.

The point of this service is to allow GNU Stow users to switch to Guix 
Home without any change to their Stow directory structure, in the hope 
of easing the way into Guix Home allowing users to avoid convert all of 
their dotfiles to Guix native configurations.

Thank you for your time and efforts,

giacomo




Acknowledgement sent to goodoldpaul@HIDDEN:
New bug report received and forwarded. Copy sent to guix-patches@HIDDEN. Full text available.
Report forwarded to guix-patches@HIDDEN:
bug#60521; Package guix-patches. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Tue, 31 Jan 2023 22:00:02 UTC

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