From debbugs-submit-bounces@debbugs.gnu.org Tue Jan 03 11:52:18 2023 Received: (at submit) by debbugs.gnu.org; 3 Jan 2023 16:52:19 +0000 Received: from localhost ([127.0.0.1]:46574 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pCkWQ-0002uI-Hn for submit@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 ) id 1pCkWO-0002uA-JR for submit@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 ) id 1pCkWO-0006Jd-Eu for guix-patches@gnu.org; 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 ) id 1pCkWL-0007c9-5h for guix-patches@gnu.org; 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 ; 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@autistici.org) by 1.mail-backend.investici.org (Postfix) with ESMTPA id 4Nmf0H1JK5z5sxK for ; Tue, 3 Jan 2023 16:51:59 +0000 (UTC) MIME-Version: 1.0 Date: Tue, 03 Jan 2023 16:51:59 +0000 From: goodoldpaul@autistici.org To: guix-patches@gnu.org Subject: [PATCH] home: Add home-stow-migration-service. User-Agent: Roundcube Webmail Message-ID: <0a8d7bce31856292baa06a08260494c0@autistici.org> X-Sender: goodoldpaul@autistici.org 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@autistici.org; 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@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" 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 From debbugs-submit-bounces@debbugs.gnu.org Tue Jan 03 11:55:55 2023 Received: (at 60521) by debbugs.gnu.org; 3 Jan 2023 16:55:55 +0000 Received: from localhost ([127.0.0.1]:46579 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pCkZs-00030N-6a for submit@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 ) id 1pCkZm-000307-Uw for 60521@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@autistici.org) by localhost (Postfix) with ESMTPSA id 4Nmf4c3HDQz10nn; Tue, 3 Jan 2023 16:55:44 +0000 (UTC) From: Giacomo Leidi To: 60521@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@autistici.org> 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 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" 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 ;;; Copyright © 2021 Xinglu Chen +;;; Copyright © 2023 Giacomo Leidi ;;; ;;; 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 From debbugs-submit-bounces@debbugs.gnu.org Tue Jan 17 08:09:49 2023 Received: (at 60521) by debbugs.gnu.org; 17 Jan 2023 13:09:49 +0000 Received: from localhost ([127.0.0.1]:36090 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pHlim-00054G-TM for submit@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 ) id 1pHlik-00053y-Jz for 60521@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 ) 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 ) id 1pHlid-0000lD-8K; Tue, 17 Jan 2023 08:09:39 -0500 From: =?utf-8?Q?Ludovic_Court=C3=A8s?= To: Giacomo Leidi Subject: Re: bug#60521: [PATCH] home: Add home-stow-migration-service. References: <0a8d7bce31856292baa06a08260494c0@autistici.org> <20230103165534.25644-1-goodoldpaul@autistici.org> Date: Tue, 17 Jan 2023 14:09:37 +0100 In-Reply-To: <20230103165534.25644-1-goodoldpaul@autistici.org> (Giacomo Leidi's message of "Tue, 3 Jan 2023 17:55:34 +0100") Message-ID: <87o7qxi9ym.fsf_-_@gnu.org> 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@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Hi! Giacomo Leidi 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. From debbugs-submit-bounces@debbugs.gnu.org Tue Jan 17 10:21:18 2023 Received: (at 60521) by debbugs.gnu.org; 17 Jan 2023 15:21:18 +0000 Received: from localhost ([127.0.0.1]:37966 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pHnm2-0002s7-5t for submit@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 ) id 1pHnlz-0002rg-Iz for 60521@debbugs.gnu.org; Tue, 17 Jan 2023 10:21:17 -0500 Received: (Authenticated sender: andrew@trop.in) 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 To: Ludovic =?utf-8?Q?Court=C3=A8s?= , Giacomo Leidi Subject: Re: [bug#60521] [PATCH] home: Add home-stow-migration-service. In-Reply-To: <87o7qxi9ym.fsf_-_@gnu.org> References: <0a8d7bce31856292baa06a08260494c0@autistici.org> <20230103165534.25644-1-goodoldpaul@autistici.org> <87o7qxi9ym.fsf_-_@gnu.org> Date: Tue, 17 Jan 2023 19:21:04 +0400 Message-ID: <87tu0p89wf.fsf@trop.in> 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@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" 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 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----- --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Tue Jan 17 12:09:51 2023 Received: (at 60521) by debbugs.gnu.org; 17 Jan 2023 17:09:51 +0000 Received: from localhost ([127.0.0.1]:38102 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pHpT2-0001so-04 for submit@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 ) id 1pHpSx-0001sc-I3 for 60521@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@makinata.eu) by mail1.netim.hosting (Postfix) with ESMTPSA id 2913180093; Tue, 17 Jan 2023 18:09:34 +0100 (CET) Message-ID: 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 References: <0a8d7bce31856292baa06a08260494c0@autistici.org> <20230103165534.25644-1-goodoldpaul@autistici.org> From: Bruno Victal In-Reply-To: <20230103165534.25644-1-goodoldpaul@autistici.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -1.1 (-) X-Debbugs-Envelope-To: 60521 Cc: 60521@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" 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 > ;;; Copyright © 2021 Xinglu Chen > +;;; Copyright © 2023 Giacomo Leidi > ;;; > ;;; 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 From debbugs-submit-bounces@debbugs.gnu.org Mon Jan 23 05:23:42 2023 Received: (at 60521) by debbugs.gnu.org; 23 Jan 2023 10:23:42 +0000 Received: from localhost ([127.0.0.1]:53440 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pJtzK-0007cw-CR for submit@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 ) id 1pJtzH-0007ci-TT for 60521@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 ) 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 ) id 1pJtz7-0002bW-1L; Mon, 23 Jan 2023 05:23:29 -0500 From: =?utf-8?Q?Ludovic_Court=C3=A8s?= To: Andrew Tropin Subject: Re: [bug#60521] [PATCH] home: Add home-stow-migration-service. References: <0a8d7bce31856292baa06a08260494c0@autistici.org> <20230103165534.25644-1-goodoldpaul@autistici.org> <87o7qxi9ym.fsf_-_@gnu.org> <87tu0p89wf.fsf@trop.in> 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@trop.in> (Andrew Tropin's message of "Tue, 17 Jan 2023 19:21:04 +0400") Message-ID: <87edrl4kio.fsf@gnu.org> 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 , 60521@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Hi, Andrew Tropin 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. From debbugs-submit-bounces@debbugs.gnu.org Wed Jan 25 01:32:43 2023 Received: (at 60521) by debbugs.gnu.org; 25 Jan 2023 06:32:43 +0000 Received: from localhost ([127.0.0.1]:58111 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pKZKs-0005u1-VI for submit@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 ) id 1pKZKq-0005tm-26 for 60521@debbugs.gnu.org; Wed, 25 Jan 2023 01:32:40 -0500 Received: (Authenticated sender: andrew@trop.in) 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 To: Ludovic =?utf-8?Q?Court=C3=A8s?= Subject: Re: [bug#60521] [PATCH] home: Add home-stow-migration-service. In-Reply-To: <87edrl4kio.fsf@gnu.org> References: <0a8d7bce31856292baa06a08260494c0@autistici.org> <20230103165534.25644-1-goodoldpaul@autistici.org> <87o7qxi9ym.fsf_-_@gnu.org> <87tu0p89wf.fsf@trop.in> <87edrl4kio.fsf@gnu.org> Date: Wed, 25 Jan 2023 10:32:29 +0400 Message-ID: <874jsft98i.fsf@trop.in> 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 , 60521@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" 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 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----- --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Tue Jan 31 16:54:42 2023 Received: (at control) by debbugs.gnu.org; 31 Jan 2023 21:54:42 +0000 Received: from localhost ([127.0.0.1]:55185 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pMyaQ-0004cz-BI for submit@debbugs.gnu.org; Tue, 31 Jan 2023 16:54:42 -0500 Received: from mail2-relais-roc.national.inria.fr ([192.134.164.83]:35891) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pMyaK-0004ca-SZ for control@debbugs.gnu.org; Tue, 31 Jan 2023 16:54:40 -0500 Authentication-Results: mail2-relais-roc.national.inria.fr; dkim=none (message not signed) header.i=none; spf=SoftFail smtp.mailfrom=ludo@gnu.org; dmarc=fail (p=none dis=none) d=gnu.org X-IronPort-AV: E=Sophos;i="5.97,261,1669071600"; d="scan'208";a="90388212" Received: from 91-160-117-201.subs.proxad.net (HELO ribbon) ([91.160.117.201]) by mail2-relais-roc.national.inria.fr with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 Jan 2023 22:54:29 +0100 Date: Tue, 31 Jan 2023 22:54:28 +0100 Message-Id: <87cz6utlnv.fsf@gnu.org> To: control@debbugs.gnu.org From: =?utf-8?Q?Ludovic_Court=C3=A8s?= Subject: control message for bug #60521 MIME-version: 1.0 Content-type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Spam-Score: 0.3 (/) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) tags 60521 + moreinfo quit From debbugs-submit-bounces@debbugs.gnu.org Sun Feb 12 12:36:14 2023 Received: (at 60521) by debbugs.gnu.org; 12 Feb 2023 17:36:14 +0000 Received: from localhost ([127.0.0.1]:46576 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pRGGs-0002jO-Dg for submit@debbugs.gnu.org; Sun, 12 Feb 2023 12:36:14 -0500 Received: from latitanza.investici.org ([82.94.249.234]:21799) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pRGGp-0002jE-Kv for 60521@debbugs.gnu.org; Sun, 12 Feb 2023 12:36:13 -0500 Received: from 1.mail-backend.investici.org (unknown [10.0.0.11]) by latitanza.investici.org (Postfix) with ESMTP id 4PFF4m5nrYzGpFq for <60521@debbugs.gnu.org>; Sun, 12 Feb 2023 17:36:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=autistici.org; s=stigmate; t=1676223368; bh=pXZy9VchZceCOIMrd/bF08Sog41WOnUhcvs4dt/q9+8=; h=Date:From:To:Subject:From; b=qJ1R9kzOskeSuCH6jNh4jts1OAFD9pcQboD5DXgKqc5maM048Bmar1RFExLfydBJY VLViMVGxlIK/QXJ4pKlIWBUAMeFurU1h9qWm72Qg1X7+/BxA63LvWUhmJLbgUSm63C GtcKqCWORayXEaxKwXHnIoNaQDGflIrNTI/xRDMk= Received: from 1.webmail.investici.org (localhost [127.0.0.1]) (Authenticated sender: goodoldpaul@autistici.org) by 1.mail-backend.investici.org (Postfix) with ESMTPA id 4PFF4m4fCQz5tFP for <60521@debbugs.gnu.org>; Sun, 12 Feb 2023 17:36:08 +0000 (UTC) MIME-Version: 1.0 Date: Sun, 12 Feb 2023 17:36:08 +0000 From: goodoldpaul@autistici.org To: 60521 <60521@debbugs.gnu.org> Subject: Re: [PATCH] home: Add home-stow-migration-service. User-Agent: Roundcube Webmail Message-ID: X-Sender: goodoldpaul@autistici.org Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 60521 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Dear Ludo, Andy and Bruno, I apologize for the delay. I'm sending a v2, I should have addressed all of your concerns: - I agree with you that this is not really Stow specific, so I renamed the service to home-dotfiles-service-type. - I didn't think about this last time, but the way I use this service is by having an etc/ directory in my Guix Home git repository. I specified this in the manual to address reproducibility concerns. - In general i gave some polish to everything. - a nice future improvement could be adding an optional flag to guix home import to have your Stow directory automatically configured in your home-environment definition. I hope everything is okay, thank you for your time. giacomo From debbugs-submit-bounces@debbugs.gnu.org Sun Feb 12 12:36:57 2023 Received: (at 60521) by debbugs.gnu.org; 12 Feb 2023 17:36:57 +0000 Received: from localhost ([127.0.0.1]:46579 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pRGHY-0002kJ-P5 for submit@debbugs.gnu.org; Sun, 12 Feb 2023 12:36:57 -0500 Received: from confino.investici.org ([93.190.126.19]:30931) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pRGHW-0002k9-N2 for 60521@debbugs.gnu.org; Sun, 12 Feb 2023 12:36:55 -0500 Received: from mx1.investici.org (unknown [127.0.0.1]) by confino.investici.org (Postfix) with ESMTP id 4PFF5c6Rz3z113v; Sun, 12 Feb 2023 17:36:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=autistici.org; s=stigmate; t=1676223412; bh=pjFLRUJxeST84XDtguyufI547qrQWVMshaZR6ULOKN0=; h=From:To:Cc:Subject:Date:From; b=g5WmcbgJ7SRZOrele3Sb/80IRcdF2CG3HG7Kox6/aFLEUYRml6f0/W4OWSbXQzHKr Gz6rfJCUUsQH8fOdXA7o3ldof+ew0g46x8ikgsafwNPm/mWup2mVICJvOBcwj23E14 ZDRzDJaERjRCNYSrx9ZUX5Gkf7agvj6AHXcV0Mqo= Received: from [93.190.126.19] (mx1.investici.org [93.190.126.19]) (Authenticated sender: goodoldpaul@autistici.org) by localhost (Postfix) with ESMTPSA id 4PFF5c5vfHz113q; Sun, 12 Feb 2023 17:36:52 +0000 (UTC) From: Giacomo Leidi To: 60521@debbugs.gnu.org Subject: [v2] home: Add home-dotfiles-service. Date: Sun, 12 Feb 2023 18:36:40 +0100 Message-Id: <20230212173640.12008-1-goodoldpaul@autistici.org> X-Mailer: git-send-email 2.39.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 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) * gnu/home/services.scm (dotfiles-for-app): New variable; (home-dotfiles-configuration): new variable; (home-dotfiles-service-type): new variable. * doc/guix.texi: Document it. --- doc/guix.texi | 85 ++++++++++++++++++++++++++++++++++++++++++- gnu/home/services.scm | 54 +++++++++++++++++++++++++++ 2 files changed, 138 insertions(+), 1 deletion(-) diff --git a/doc/guix.texi b/doc/guix.texi index 44e2165a82..a6223d69eb 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -111,9 +111,9 @@ Copyright @copyright{} 2022 (@* Copyright @copyright{} 2022 John Kehayias@* Copyright @copyright{} 2022 Bruno Victal@* Copyright @copyright{} 2022 Ivan Vilata-i-Balaguer@* -Copyright @copyright{} 2023 Giacomo Leidi@* Copyright @copyright{} 2022 Antero Mejr@* Copyright @copyright{} 2023 Bruno Victal@* +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 @@ -41620,6 +41620,89 @@ to use alternative services to implement more advanced use cases like read-only home. Feel free to experiment and share your results. @end defvar +It is often the case that Guix Home users already have a setup for versioning +their user configuration files (also known as @emph{dotfiles}) in a single +directory, and some way of automatically deploy changes to their user home. + +The @code{home-dotfiles-service-type} is designed to ease the way into using +Guix Home for this kind of users, allowing them to point the service to their +dotfiles directory (which must follow +@uref{https://www.gnu.org/software/stow/, GNU Stow}'s layout) and have their +dotfiles automatically deployed to their user home, without migrating them to +Guix native configurations. + +The dotfiles directory layout is expected to 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 +├── nix +│ ├── .config +│ │ └── nixpkgs +│ │ └── config.nix +│ └── .nix-channels +├── tmux +│ └── .tmux.conf +└── vim + └── .vimrc + +13 directories, 10 files +@end example + +For a more formal specification please refer to the +@pxref{Top,,, stow, GNU Stow Manual}. It is advisable to keep your dotfiles +directories under version control, for example in the same repository where +you'd track your Guix Home configuration. A suitable configuration would then +be: + +@lisp + (simple-service 'home-dotfiles + home-dotfiles-service-type + (list (string-append (getcwd) + "/.dotfiles"))) +@end lisp + +The expected home directory state would be: + +@example +. +├── .config +│ ├── guix +│ │ └── channels.scm +│ └── nixpkgs +│ └── config.nix +├── .gitconfig +├── .gnupg +│ ├── gpg-agent.conf +│ └── gpg.conf +├── .guile +├── .nix-channels +├── .tmux.conf +└── .vimrc +@end example + +@defvar home-dotfiles-service-type +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 users that already track their dotfiles under some kind of version +control. This service allows users to point Guix Home to their dotfiles +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. +@end defvar + @defvar 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 b17a34d19d..c45b8cbe24 100644 --- a/gnu/home/services.scm +++ b/gnu/home/services.scm @@ -2,6 +2,7 @@ ;;; Copyright © 2021-2023 Andrew Tropin ;;; Copyright © 2021 Xinglu Chen ;;; Copyright © 2022-2023 Ludovic Courtès +;;; Copyright © 2023 Giacomo Leidi ;;; ;;; This file is part of GNU Guix. ;;; @@ -22,6 +23,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) @@ -35,13 +37,17 @@ (define-module (gnu home services) #:use-module (guix modules) #:use-module (srfi srfi-1) #:use-module (srfi srfi-9) + #: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-dotfiles-service-type + home-dotfiles-configuration home-xdg-configuration-files-service-type home-xdg-data-files-service-type home-run-on-first-login-service-type @@ -341,6 +347,54 @@ (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 directory) + "Return a list of objects compatible with @code{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 DIRECTORY and mapping its contents to the +user's home directory." + (map (lambda (file) + (let ((file-relative-path + (string-drop file (1+ (string-length directory))))) + (list file-relative-path + (local-file file + (string-append "home-dotfiles-" + (string-replace-substring + file-relative-path + "/" "-")))))) + (find-files directory))) + +(define-public (home-dotfiles-configuration dotfiles-directories) + "Return a list of objects compatible with @code{home-files-service-type}'s +value, generated following GNU Stow's algorithm for each of the +DOTFILES-DIRECTORIES." + (define (directory-contents directories) + (append-map + (lambda (directory) + (map + (lambda (content) + (with-directory-excursion directory + (canonicalize-path content))) + (scandir directory + (lambda (name) + (not (member name '("." ".."))))))) + directories)) + (append-map + dotfiles-for-app + (directory-contents dotfiles-directories))) + +(define-public home-dotfiles-service-type + (service-type (name 'home-dotfiles) + (extensions + (list (service-extension home-files-service-type + home-dotfiles-configuration))) + (default-value '()) + (extend append) + (compose concatenate) + (description "Files contained is these directories will be put +in the user's home directory according to GNU Stow's algorithm, and further +processed during activation."))) + (define xdg-configuration-files-directory ".config") (define (xdg-configuration-files files) base-commit: 2b1383c0a2f79117103b142440c64f6a751d545d -- 2.39.1 From debbugs-submit-bounces@debbugs.gnu.org Wed Apr 12 16:31:17 2023 Received: (at 60521) by debbugs.gnu.org; 12 Apr 2023 20:31:17 +0000 Received: from localhost ([127.0.0.1]:41885 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pmh7d-00087c-3I for submit@debbugs.gnu.org; Wed, 12 Apr 2023 16:31:17 -0400 Received: from confino.investici.org ([93.190.126.19]:35107) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pmh7a-00087S-OF for 60521@debbugs.gnu.org; Wed, 12 Apr 2023 16:31:15 -0400 Received: from 1.mail-backend.investici.org (unknown [10.0.0.11]) by confino.investici.org (Postfix) with ESMTP id 4PxZ9Y1V6Pz110h; Wed, 12 Apr 2023 20:31:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=autistici.org; s=stigmate; t=1681331473; bh=th6DFlqPSpzwEiPy/kx+071CXEATXFoxgzAl6dqPMN0=; h=Date:From:To:Subject:In-Reply-To:References:From; b=N1SfBH8aGJkzFLa3nvcY7EA+i6sd7cc2uZGYEo87RZcUVPUoS9R84Xkeo8aAgOPU3 rCCLRAFhiNrJO3hhbZRVbEr0ArWEY/AIHGwwVjCkPb8yuagBTBgJyp7/mFpjf67VWR aODcaDZmklqEnBoQX+/UYaKJCIBpvgP/RaYO+L5g= Received: from 1.webmail.investici.org (localhost [127.0.0.1]) (Authenticated sender: goodoldpaul@autistici.org) by 1.mail-backend.investici.org (Postfix) with ESMTPA id 4PxZ9X6Lk8z8sm6; Wed, 12 Apr 2023 20:31:12 +0000 (UTC) MIME-Version: 1.0 Date: Wed, 12 Apr 2023 20:31:12 +0000 From: goodoldpaul@autistici.org To: 60521 <60521@debbugs.gnu.org>, paren@disroot.org, andrew@trop.in, ludo@gnu.org Subject: Re: [PATCH] home: Add home-stow-migration-service. In-Reply-To: References: User-Agent: Roundcube Webmail Message-ID: <13cf3fe05ad572d3385b7e8a16317478@autistici.org> X-Sender: goodoldpaul@autistici.org Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 60521 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Dear Guixers, this is a friendly ping :) . I'm sending an updated patchset. Thank you for your time and efforts, giacomo From debbugs-submit-bounces@debbugs.gnu.org Wed Apr 12 16:32:38 2023 Received: (at 60521) by debbugs.gnu.org; 12 Apr 2023 20:32:38 +0000 Received: from localhost ([127.0.0.1]:41889 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pmh8v-00089b-EC for submit@debbugs.gnu.org; Wed, 12 Apr 2023 16:32:38 -0400 Received: from confino.investici.org ([93.190.126.19]:31285) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pmh8t-00089T-U5 for 60521@debbugs.gnu.org; Wed, 12 Apr 2023 16:32:36 -0400 Received: from mx1.investici.org (unknown [127.0.0.1]) by confino.investici.org (Postfix) with ESMTP id 4PxZC73KV2z110k; Wed, 12 Apr 2023 20:32:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=autistici.org; s=stigmate; t=1681331555; bh=WU7i1lQyZdlYbnvAvN4FOwUL11zxbLn2Z0mWAPpoTLo=; h=From:To:Cc:Subject:Date:From; b=HVYjafy/JxrTDTj1Dd2KuStCLNdRivHWFYhlkUY06ZwkP8GuQThksZ/I0WCdibkDH sBj9H91aBKv3KgosK8Pi1w6ipHlZa8lNdBR6sIHytjVi3hq/NtMfiNJXJe0oUrHOxN um5/H7v9svUhpCC3X4kDl3rD0Z2wLTPYhJuhZJY4= Received: from [93.190.126.19] (mx1.investici.org [93.190.126.19]) (Authenticated sender: goodoldpaul@autistici.org) by localhost (Postfix) with ESMTPSA id 4PxZC72lR6z110h; Wed, 12 Apr 2023 20:32:35 +0000 (UTC) From: Giacomo Leidi To: 60521@debbugs.gnu.org Subject: [v3] home: Add home-dotfiles-service. Date: Wed, 12 Apr 2023 22:32:17 +0200 Message-Id: <20230412203217.32606-1-goodoldpaul@autistici.org> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 X-Debbugs-Cc: paren@disroot.org X-Debbugs-Cc: andrew@trop.in X-Debbugs-Cc: ludo@gnu.org Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 60521 Cc: Giacomo Leidi X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) * gnu/home/services.scm (dotfiles-for-app): New variable; (home-dotfiles-configuration): new variable; (home-dotfiles-service-type): new variable. * doc/guix.texi: Document it. --- doc/guix.texi | 85 ++++++++++++++++++++++++++++++++++++++++++- gnu/home/services.scm | 54 +++++++++++++++++++++++++++ 2 files changed, 138 insertions(+), 1 deletion(-) diff --git a/doc/guix.texi b/doc/guix.texi index acb6f0c2e1..b95053039f 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -111,9 +111,9 @@ Copyright @copyright{} 2022 (@* Copyright @copyright{} 2022 John Kehayias@* Copyright @copyright{} 2022⁠–⁠2023 Bruno Victal@* Copyright @copyright{} 2022 Ivan Vilata-i-Balaguer@* -Copyright @copyright{} 2023 Giacomo Leidi@* Copyright @copyright{} 2022 Antero Mejr@* Copyright @copyright{} 2023 Karl Hallsby +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 @@ -42029,6 +42029,89 @@ to use alternative services to implement more advanced use cases like read-only home. Feel free to experiment and share your results. @end defvar +It is often the case that Guix Home users already have a setup for versioning +their user configuration files (also known as @emph{dotfiles}) in a single +directory, and some way of automatically deploy changes to their user home. + +The @code{home-dotfiles-service-type} is designed to ease the way into using +Guix Home for this kind of users, allowing them to point the service to their +dotfiles directory (which must follow +@uref{https://www.gnu.org/software/stow/, GNU Stow}'s layout) and have their +dotfiles automatically deployed to their user home, without migrating them to +Guix native configurations. + +The dotfiles directory layout is expected to 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 +├── nix +│ ├── .config +│ │ └── nixpkgs +│ │ └── config.nix +│ └── .nix-channels +├── tmux +│ └── .tmux.conf +└── vim + └── .vimrc + +13 directories, 10 files +@end example + +For a more formal specification please refer to the +@pxref{Top,,, stow, GNU Stow Manual}. It is advisable to keep your dotfiles +directories under version control, for example in the same repository where +you'd track your Guix Home configuration. A suitable configuration would then +be: + +@lisp + (simple-service 'home-dotfiles + home-dotfiles-service-type + (list (string-append (getcwd) + "/.dotfiles"))) +@end lisp + +The expected home directory state would be: + +@example +. +├── .config +│ ├── guix +│ │ └── channels.scm +│ └── nixpkgs +│ └── config.nix +├── .gitconfig +├── .gnupg +│ ├── gpg-agent.conf +│ └── gpg.conf +├── .guile +├── .nix-channels +├── .tmux.conf +└── .vimrc +@end example + +@defvar home-dotfiles-service-type +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 users that already track their dotfiles under some kind of version +control. This service allows users to point Guix Home to their dotfiles +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. +@end defvar + @defvar 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 b17a34d19d..c45b8cbe24 100644 --- a/gnu/home/services.scm +++ b/gnu/home/services.scm @@ -2,6 +2,7 @@ ;;; Copyright © 2021-2023 Andrew Tropin ;;; Copyright © 2021 Xinglu Chen ;;; Copyright © 2022-2023 Ludovic Courtès +;;; Copyright © 2023 Giacomo Leidi ;;; ;;; This file is part of GNU Guix. ;;; @@ -22,6 +23,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) @@ -35,13 +37,17 @@ (define-module (gnu home services) #:use-module (guix modules) #:use-module (srfi srfi-1) #:use-module (srfi srfi-9) + #: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-dotfiles-service-type + home-dotfiles-configuration home-xdg-configuration-files-service-type home-xdg-data-files-service-type home-run-on-first-login-service-type @@ -341,6 +347,54 @@ (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 directory) + "Return a list of objects compatible with @code{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 DIRECTORY and mapping its contents to the +user's home directory." + (map (lambda (file) + (let ((file-relative-path + (string-drop file (1+ (string-length directory))))) + (list file-relative-path + (local-file file + (string-append "home-dotfiles-" + (string-replace-substring + file-relative-path + "/" "-")))))) + (find-files directory))) + +(define-public (home-dotfiles-configuration dotfiles-directories) + "Return a list of objects compatible with @code{home-files-service-type}'s +value, generated following GNU Stow's algorithm for each of the +DOTFILES-DIRECTORIES." + (define (directory-contents directories) + (append-map + (lambda (directory) + (map + (lambda (content) + (with-directory-excursion directory + (canonicalize-path content))) + (scandir directory + (lambda (name) + (not (member name '("." ".."))))))) + directories)) + (append-map + dotfiles-for-app + (directory-contents dotfiles-directories))) + +(define-public home-dotfiles-service-type + (service-type (name 'home-dotfiles) + (extensions + (list (service-extension home-files-service-type + home-dotfiles-configuration))) + (default-value '()) + (extend append) + (compose concatenate) + (description "Files contained is these directories will be put +in the user's home directory according to GNU Stow's algorithm, and further +processed during activation."))) + (define xdg-configuration-files-directory ".config") (define (xdg-configuration-files files) base-commit: dd3e5e71104a2bcbad80e52e062a144ea96b8c6a -- 2.39.2 From debbugs-submit-bounces@debbugs.gnu.org Mon Apr 24 16:34:11 2023 Received: (at 60521) by debbugs.gnu.org; 24 Apr 2023 20:34:12 +0000 Received: from localhost ([127.0.0.1]:50436 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pr2t1-0000Ka-Fa for submit@debbugs.gnu.org; Mon, 24 Apr 2023 16:34:11 -0400 Received: from eggs.gnu.org ([209.51.188.92]:57056) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pr2sz-0000KL-2H for 60521@debbugs.gnu.org; Mon, 24 Apr 2023 16:34:09 -0400 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 ) id 1pr2ss-0007ed-Ul; Mon, 24 Apr 2023 16:34:02 -0400 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=aMYrRenom4J953J28a1sIr9Qy8DW6AcfDXjOIIQpCUs=; b=IBxS5+1SZqjf9OuyJRw2 alK5K63Da5RgWafLcybR+wQCa9F/9ZGdA/e5rXx4U7r3WGP0l19+yGSO4yCnrWqa4G0ejJwMOM2/x ijog6P/6GzeANGQgtHp3hQPsRdQvQK3aus79sYC5tOugZVuCMxfc5bTNicozR3zSIIWv49boS58+N zjxGUUgh//TBaz8DTY+a4aRsmvUyIyvrQ2Gj8ucKriEy5coyZ7PQne3p7SEKuICVmiS71iqsS7a9q JuNwEsgktFf3bwKEiEfCs/jWPWEIJZEwrGEL90wiEkW3hkt/gLRtsv5L0T3cY945TmYUOvutks3Cm Phjqei1sWucwaQ==; Received: from 91-160-117-201.subs.proxad.net ([91.160.117.201] helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pr2sr-0003SM-C1; Mon, 24 Apr 2023 16:34:02 -0400 From: =?utf-8?Q?Ludovic_Court=C3=A8s?= To: Giacomo Leidi Subject: Re: bug#60521: [PATCH] home: Add home-stow-migration-service. References: <0a8d7bce31856292baa06a08260494c0@autistici.org> <20230412203217.32606-1-goodoldpaul@autistici.org> Date: Mon, 24 Apr 2023 22:33:57 +0200 In-Reply-To: <20230412203217.32606-1-goodoldpaul@autistici.org> (Giacomo Leidi's message of "Wed, 12 Apr 2023 22:32:17 +0200") Message-ID: <87zg6x10lm.fsf_-_@gnu.org> 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@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Hi Giacomo, Giacomo Leidi skribis: > * gnu/home/services.scm (dotfiles-for-app): New variable; > (home-dotfiles-configuration): new variable; > (home-dotfiles-service-type): new variable. > * doc/guix.texi: Document it. Apologies for the loong delay. > +The @code{home-dotfiles-service-type} is designed to ease the way into u= sing > +Guix Home for this kind of users, allowing them to point the service to = their > +dotfiles directory (which must follow > +@uref{https://www.gnu.org/software/stow/, GNU Stow}'s layout) and have t= heir Rather, for proper rendering: dotfiles directory, which must follow the layout prescribed by @uref{https://=E2=80=A6, GNU Stow}, and have their =E2=80=A6 > +For a more formal specification please refer to the > +@pxref{Top,,, stow, GNU Stow Manual}. Rather: please refer to the Stow manual (@pxref{=E2=80=A6}). Maybe a node other than =E2=80=9CTop=E2=80=9D would be advisable? I can=E2= =80=99t see where that formal spec might be at . > +@lisp > + (simple-service 'home-dotfiles > + home-dotfiles-service-type > + (list (string-append (getcwd) > + "/.dotfiles"))) Replace (getcwd) by (current-source-directory), though hmm that=E2=80=99s p= art of (guix utils). (Using (getcwd) is wrong because it gives the current directory of the =E2=80=98guix=E2=80=99 command that evaluates this code, not the directory = the file lives in.) > +(define (dotfiles-for-app directory) > + "Return a list of objects compatible with @code{home-files-service-typ= e}'s > +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 DIRECTORY and mapping its contents to = the > +user's home directory." > + (map (lambda (file) > + (let ((file-relative-path > + (string-drop file (1+ (string-length directory))))) > + (list file-relative-path > + (local-file file > + (string-append "home-dotfiles-" > + (string-replace-substring > + file-relative-path > + "/" "-")))))) > + (find-files directory))) In general, use the term =E2=80=9Cfile name=E2=80=9D, not =E2=80=9Cpath=E2= =80=9D. The variable name can become, say, =E2=80=98file-relative=E2=80=99. Maybe s/dotfiles-for-app/import-dotfiles/ ? But see below. (Sorry for not noticing these earlier!) > +(define-public (home-dotfiles-configuration dotfiles-directories) s/define-public/define/ since it=E2=80=99s already exported at the top. > + "Return a list of objects compatible with @code{home-files-service-typ= e}'s > +value, generated following GNU Stow's algorithm for each of the > +DOTFILES-DIRECTORIES." > + (define (directory-contents directories) > + (append-map > + (lambda (directory) > + (map > + (lambda (content) > + (with-directory-excursion directory > + (canonicalize-path content))) > + (scandir directory > + (lambda (name) > + (not (member name '("." ".."))))))) > + directories)) > + (append-map > + dotfiles-for-app > + (directory-contents dotfiles-directories))) Am I right that this is the same as: (append-map (lambda (directory) (let ((parent (basename directory)) (files (find-files directory))) (define (strip file) (string-drop file (+ 1 (string-length directory)))) (map (lambda (file) (list (strip file) (local-file file))) (find-files directory)))) directories) ? (In that case, we wouldn=E2=80=99t even need =E2=80=98dotfiles-for-app=E2= =80=99.) Also, should we pass =E2=80=98find-files=E2=80=99 a predicate to exclude ed= itor backup files, VCS files, etc.? Thanks, Ludo=E2=80=99. From debbugs-submit-bounces@debbugs.gnu.org Sat Jun 24 11:48:01 2023 Received: (at 60521) by debbugs.gnu.org; 24 Jun 2023 15:48:01 +0000 Received: from localhost ([127.0.0.1]:41360 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qD5UW-0000YF-F3 for submit@debbugs.gnu.org; Sat, 24 Jun 2023 11:48:01 -0400 Received: from confino.investici.org ([93.190.126.19]:21969) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qD5UR-0000XM-3A for 60521@debbugs.gnu.org; Sat, 24 Jun 2023 11:47:58 -0400 Received: from mx1.investici.org (unknown [127.0.0.1]) by confino.investici.org (Postfix) with ESMTP id 4QpJQw5M9hz11Gl; Sat, 24 Jun 2023 15:47:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=autistici.org; s=stigmate; t=1687621672; bh=p80tBxWkJt7B5dCHLNleLwoth8CQKZSABELi/jyqgik=; h=Date:From:Subject:To:From; b=TAkQVRGHRcpu0XqDb/oQwpdClX+r6ObtFUK4v5PKGAOJTNX3L+gRpbnXegl30h2Fq 9oTXfKqxnYjoWmjBfP58ZDfmu8PGiu/cYUd181hvII/B5tNQ64G8uQXnuJmB1pSp/B /BNWgGQpjUV0coJwurVpeHhE+jVW3e/VPCNxMWdw= Received: from [93.190.126.19] (mx1.investici.org [93.190.126.19]) (Authenticated sender: goodoldpaul@autistici.org) by localhost (Postfix) with ESMTPSA id 4QpJQw4v3bz11Cb; Sat, 24 Jun 2023 15:47:52 +0000 (UTC) Content-Type: multipart/alternative; boundary="------------0bO1My8ZlTxcAil7dTphwaAo" Message-ID: Date: Sat, 24 Jun 2023 17:47:52 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.12.0 From: paul Subject: Re: bug#60521: [PATCH] home: Add home-stow-migration-service. To: 60521@debbugs.gnu.org, ludo@gnu.org Content-Language: en-US X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 60521 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) This is a multi-part message in MIME format. --------------0bO1My8ZlTxcAil7dTphwaAo Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Dear Ludo, I apologize for the long delay. I did not receive a notification of your post somehow, I may need to change email provider. > Maybe a node other than “Top” would be advisable? I can’t see where that formal spec might be at https://www.gnu.org/software/stow/manual/html_node/. There may have been a misunderstanding here, I didn't want to imply that there was a formal specification. I just assumed that being a GNU project it would have been documented. Anyway I tried to get to the bottom of this and the only mention/apparent endorsement from the Stow manual to this layout is in the Introduction [0], which references [1] as the original source. [1] explains pretty clearly the layout in a natural language informal fashion, but searching for "stow" and "dotfiles" on the internet it appears to be an established de-facto standard. I changed the manual to "which must follow the layout suggested by". What do you think? > Am I right that this is the same as: > [ ... ] > (In that case, we wouldn’t even need ‘dotfiles-for-app’.) It's not the same I believe. The whole (string-append "home-dotfiles" ... is there because at guix/nix/libstore/store-api.cc line 64 and 71 for . and / respectively an exception is thrown if those characters are in first position or inside the store name. (append-map ... (dir-contents ... is needed due to the Stow layout: suppose you have a directory like this one .dotfiles/ ├── git │     └── .gitconfig ├── gpg │     └── .gnupg │     ├── gpg-agent.conf │     └── gpg.conf ├── guile │     └── .guile ├── guix │     └── .config │     └── guix │     └── channels.scm ├── nix │     ├── .config │     │     └── nixpkgs │     │     └── config.nix │     └── .nix-channels ├── tmux │     └── .tmux.conf └── vim        └── .vimrc The most common Stow workflow would be to have this directory at ~/.dotfiles and then $ cd ~/.dotfiles $ stow git $ stow nix This additional git,nix,gpg,guile etc... layer is not covered by your code, but I tried my best to simplify import-dotfiles. Please let me know what are your feeling about the current state of the service. > Also, should we pass ‘find-files’ a predicate to exclude editor backup files, VCS files, etc.? Yes, that's an awesome idea. I implemented a simple filter (currently '("\\.gitignore" ".*\\.swp" ".*~") ) since I wasn't sure how much we can assume about this use case. I should have addressed all of your suggestions, thank you for your time and help Ludo’ ! I'm sending an update patch. giacomo [0]: https://www.gnu.org/software/stow/manual/html_node/Introduction.html#Introduction [1]: https://brandon.invergo.net/news/2012-05-26-using-gnu-stow-to-manage-your-dotfiles.html [2]: https://duckduckgo.com/?q=stowdotfiles --------------0bO1My8ZlTxcAil7dTphwaAo Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 8bit

Dear Ludo,

I apologize for the long delay. I did not receive a notification of your post somehow, I may need to change email provider.

> Maybe a node other than “Top” would be advisable? I can’t see where that formal spec might be at https://www.gnu.org/software/stow/manual/html_node/.

There may have been a misunderstanding here, I didn't want to imply that there was a formal specification. I just assumed that being a GNU project it would have been documented. Anyway I tried to get to the bottom of this and the only mention/apparent endorsement from the Stow manual to this layout is in the Introduction [0], which references [1] as the original source.

[1] explains pretty clearly the layout in a natural language informal fashion, but searching for "stow" and "dotfiles" on the internet it appears to be an established de-facto standard. I changed the manual to "which must follow the layout suggested by". What do you think?

> Am I right that this is the same as: 

> [ ... ]

> (In that case, we wouldn’t even need ‘dotfiles-for-app’.)

It's not the same I believe. The whole (string-append "home-dotfiles" ... is there because at guix/nix/libstore/store-api.cc line 64 and 71 for . and / respectively an exception is thrown if those characters are in first position or inside the store name. (append-map ... (dir-contents ... is needed due to the Stow layout: suppose you have a directory like this one

.dotfiles/
├── git
│     └── .gitconfig
├── gpg
│     └── .gnupg
│     ├── gpg-agent.conf
│     └── gpg.conf
├── guile
│     └── .guile
├── guix
│     └── .config
│     └── guix
│     └── channels.scm
├── nix
│     ├── .config
│     │     └── nixpkgs
│     │     └── config.nix
│     └── .nix-channels
├── tmux
│     └── .tmux.conf
└── vim
       └── .vimrc

The most common Stow workflow would be to have this directory at ~/.dotfiles and then


$ cd ~/.dotfiles

$ stow git

$ stow nix

This additional git,nix,gpg,guile etc... layer is not covered by your code, but I tried my best to simplify import-dotfiles. Please let me know what are your feeling about the current state of the service.

> Also, should we pass ‘find-files’ a predicate to exclude editor backup files, VCS files, etc.?

Yes, that's an awesome idea. I implemented a simple filter (currently '("\\.gitignore" ".*\\.swp" ".*~") ) since I wasn't sure how much we can assume about this use case.


I should have addressed all of your suggestions, thank you for your time and help Ludo’ ! I'm sending an update patch.


giacomo


[0]: https://www.gnu.org/software/stow/manual/html_node/Introduction.html#Introduction

[1]: https://brandon.invergo.net/news/2012-05-26-using-gnu-stow-to-manage-your-dotfiles.html

[2]: https://duckduckgo.com/?q=stowdotfiles

--------------0bO1My8ZlTxcAil7dTphwaAo-- From debbugs-submit-bounces@debbugs.gnu.org Sat Jun 24 12:02:18 2023 Received: (at 60521) by debbugs.gnu.org; 24 Jun 2023 16:02:18 +0000 Received: from localhost ([127.0.0.1]:41377 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qD5iM-00010j-4C for submit@debbugs.gnu.org; Sat, 24 Jun 2023 12:02:18 -0400 Received: from confino.investici.org ([93.190.126.19]:40673) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qD5iI-00010W-Rn for 60521@debbugs.gnu.org; Sat, 24 Jun 2023 12:02:16 -0400 Received: from mx1.investici.org (unknown [127.0.0.1]) by confino.investici.org (Postfix) with ESMTP id 4QpJlT20VFz11FZ; Sat, 24 Jun 2023 16:02:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=autistici.org; s=stigmate; t=1687622533; bh=kEVWmWMDI6ROyL0EwR2aQ1ZbhbGAm4v7SHOrgZ+Tl60=; h=From:To:Cc:Subject:Date:From; b=AAD0H5+Vx+kTel8sEbTlQjNahw5yqDAqidt1beycsa5fBEa7LrBqqreksHQnx9Bjk I2V1GwEe5MuvWsIARhvW+q871c0EmOZn0ECDsZr6VwzWH0m+7qMFN24jKLgNe2XFUv wUmC5vOKYDEKs+XZZZXgEuem2W7jYQOFS/jW6Rhw= Received: from [93.190.126.19] (mx1.investici.org [93.190.126.19]) (Authenticated sender: goodoldpaul@autistici.org) by localhost (Postfix) with ESMTPSA id 4QpJlT1Vfhz11Dw; Sat, 24 Jun 2023 16:02:13 +0000 (UTC) From: Giacomo Leidi To: 60521@debbugs.gnu.org Subject: [PATCH-v4] home: Add home-dotfiles-service. Date: Sat, 24 Jun 2023 18:01:55 +0200 Message-Id: X-Mailer: git-send-email 2.40.1 MIME-Version: 1.0 X-Debbugs-Cc: paren@disroot.org, andrew@trop.in, ludo@gnu.org X-Debbugs-Cc: ( , Andrew Tropin , Ludovic Courtès Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 60521 Cc: Giacomo Leidi X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) * gnu/home/services.scm (dotfiles-for-app): New variable; (home-dotfiles-configuration): new variable; (home-dotfiles-service-type): new variable. * doc/guix.texi: Document it. --- doc/guix.texi | 108 ++++++++++++++++++++++++++++++++++++++++++ gnu/home/services.scm | 78 ++++++++++++++++++++++++++++++ 2 files changed, 186 insertions(+) diff --git a/doc/guix.texi b/doc/guix.texi index c961f706ec..cb3b0d05b0 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -42659,6 +42659,114 @@ Essential Home Services read-only home. Feel free to experiment and share your results. @end defvar +It is often the case that Guix Home users already have a setup for versioning +their user configuration files (also known as @emph{dotfiles}) in a single +directory, and some way of automatically deploy changes to their user home. + +The @code{home-dotfiles-service-type} is designed to ease the way into using +Guix Home for this kind of users, allowing them to point the service to their +dotfiles directory, which must follow the layout suggested by +@uref{https://www.gnu.org/software/stow/, GNU Stow}, +and have their dotfiles automatically deployed to their user home, without +migrating them to Guix native configurations. + +The dotfiles directory layout is expected to be structured as follows. Please +keep in mind that it is advisable to keep your dotfiles directories under +version control, for example in the same repository where you'd track your +Guix Home configuration. + +@example +~$ tree -a .dotfiles/ +.dotfiles/ +├── git +│ └── .gitconfig +├── gpg +│ └── .gnupg +│ ├── gpg-agent.conf +│ └── gpg.conf +├── guile +│ └── .guile +├── guix +│ └── .config +│ └── guix +│ └── channels.scm +├── nix +│ ├── .config +│ │ └── nixpkgs +│ │ └── config.nix +│ └── .nix-channels +├── tmux +│ └── .tmux.conf +└── vim + └── .vimrc + +13 directories, 10 files +@end example + +For an informal specification please refer to the Stow manual +(@pxref{Top,,, stow, Introduction}). A suitable configuration would then +be: + +@lisp +(use-modules (guix utils)) + +(home-environment + + [...] + + (services + (service home-dotfiles-service-type + (home-dotfiles-configuration + (directories + (list (string-append (current-source-directory) + "/.dotfiles"))))))) +@end lisp + +The expected home directory state would be: + +@example +. +├── .config +│ ├── guix +│ │ └── channels.scm +│ └── nixpkgs +│ └── config.nix +├── .gitconfig +├── .gnupg +│ ├── gpg-agent.conf +│ └── gpg.conf +├── .guile +├── .nix-channels +├── .tmux.conf +└── .vimrc +@end example + +@defvar home-dotfiles-service-type +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 users that already track their dotfiles under some kind of version +control. This service allows users to point Guix Home to their dotfiles +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. +@end defvar + +@deftp {Data Type} home-dotfiles-configuration +Available @code{home-dotfiles-configuration} fields are: + +@table @asis +@item @code{directories} (type: list-of-strings) +The list of dotfiles directories where @code{home-dotfiles-service-type} will +look for application dotfiles. + +@item @code{exclude} (default: @code{'(".*~" ".*\\.swp" "\\.gitignore")}) +The list of file patterns @code{home-dotfiles-service-type} will exclude while +visiting @code{directories}. + +@end table + +@end deftp + @defvar home-xdg-configuration-files-service-type The service is very similar 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 b17a34d19d..2fe6508a9a 100644 --- a/gnu/home/services.scm +++ b/gnu/home/services.scm @@ -2,6 +2,7 @@ ;;; Copyright © 2021-2023 Andrew Tropin ;;; Copyright © 2021 Xinglu Chen ;;; Copyright © 2022-2023 Ludovic Courtès +;;; Copyright © 2023 Giacomo Leidi ;;; ;;; This file is part of GNU Guix. ;;; @@ -22,6 +23,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,15 +35,24 @@ (define-module (gnu home services) #:use-module (guix diagnostics) #:use-module (guix i18n) #:use-module (guix modules) + #:use-module (guix records) #:use-module (srfi srfi-1) #:use-module (srfi srfi-9) + #:use-module (ice-9 ftw) #:use-module (ice-9 match) + #:use-module (ice-9 regex) + #: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-dotfiles-service-type + home-dotfiles-configuration + home-dotfiles-configuration? + home-dotfiles-configuration-directories + home-dotfiles-configuration-excluded home-xdg-configuration-files-service-type home-xdg-data-files-service-type home-run-on-first-login-service-type @@ -341,6 +352,73 @@ (define home-files-service-type (description "Files that will be put in @file{~/.guix-home/files}, and further processed during activation."))) +(define %home-dotfiles-excluded + '(".*~" + ".*\\.swp" + "\\.gitignore")) + +(define-record-type* + home-dotfiles-configuration make-home-dotfiles-configuration + home-dotfiles-configuration? + (directories home-dotfiles-configuration-directories ;list of strings + (default '())) + (excluded home-dotfiles-configuration-excluded ;list of strings + (default %home-dotfiles-excluded))) + +(define* (import-dotfiles directory excluded) + "Return a list of objects compatible with @code{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 DIRECTORY and mapping its contents to the +user's home directory, excluding files that match any of the patterns in EXCLUDED." + (define filtered + (find-files directory + (lambda (file stat) + (not (string-match + (string-append + "^.*(" (string-join excluded "|") ")$") file))))) + (define (strip file) + (string-drop file (+ 1 (string-length directory)))) + (define (format file) + (string-append "home-dotfiles-" + (string-replace-substring file "/" "-"))) + + (map (lambda (file) + (let* ((stripped (strip file))) + (list stripped + (local-file file (format stripped))))) + filtered)) + +(define (home-dotfiles-configuration->files config) + "Return a list of objects compatible with @code{home-files-service-type}'s +value, generated following GNU Stow's algorithm for each of the +directories in CONFIG, excluding files that match any of the patterns configured." + (define (directory-contents directories) + (append-map + (lambda (directory) + (map + (lambda (content) + (with-directory-excursion directory + (canonicalize-path content))) + (scandir directory + (lambda (name) + (not (member name '("." ".."))))))) + directories)) + (append-map + (lambda (app) + (import-dotfiles app (home-dotfiles-configuration-excluded config))) + (directory-contents + (home-dotfiles-configuration-directories config)))) + +(define-public home-dotfiles-service-type + (service-type (name 'home-dotfiles) + (extensions + (list (service-extension home-files-service-type + home-dotfiles-configuration->files))) + (default-value (home-dotfiles-configuration)) + (description "Files that will be put in the user's home directory +following GNU Stow's algorithm, and further processed during activation."))) + (define xdg-configuration-files-directory ".config") (define (xdg-configuration-files files) base-commit: d6dc82e8cdb2d6114a12b06d449ce7f1150c7f70 -- 2.40.1 From debbugs-submit-bounces@debbugs.gnu.org Sat Aug 26 05:35:13 2023 Received: (at 60521) by debbugs.gnu.org; 26 Aug 2023 09:35:13 +0000 Received: from localhost ([127.0.0.1]:41765 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qZphI-0001Ys-PB for submit@debbugs.gnu.org; Sat, 26 Aug 2023 05:35:13 -0400 Received: from confino.investici.org ([93.190.126.19]:22921) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qZphC-0001Ya-Q0 for 60521@debbugs.gnu.org; Sat, 26 Aug 2023 05:35:11 -0400 Received: from 1.mail-backend.investici.org (unknown [10.0.0.11]) by confino.investici.org (Postfix) with ESMTP id 4RXs9c1cNvz116w; Sat, 26 Aug 2023 09:35:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=autistici.org; s=stigmate; t=1693042500; bh=nPKOt8yIYBOYZj90eoCmgMwl/2MlU6PuStY4sjKQyXU=; h=Date:From:To:Subject:In-Reply-To:References:From; b=SyQxLH5t2nDoa9srLfgPneOad1Mhri2vxsSpvsbg68zXYmK3JWlmP5m9WJj9AO6Lx eP6m7VlYBE1qrkxZuZMNZitQo1rh3W0REtCt276w1NvucddZrEPzmR8/65WrwbQz64 mtJ3q+elDdCacngk2b1uwuWfqgdgohkNjnN3hSa0= Received: from 1.webmail.investici.org (localhost [127.0.0.1]) (Authenticated sender: goodoldpaul@autistici.org) by 1.mail-backend.investici.org (Postfix) with ESMTPA id 4RXs9c05nZz8slv; Sat, 26 Aug 2023 09:34:59 +0000 (UTC) MIME-Version: 1.0 Date: Sat, 26 Aug 2023 09:34:59 +0000 From: goodoldpaul@autistici.org To: 60521@debbugs.gnu.org, ludo@gnu.org Subject: Re: bug#60521: [PATCH] home: Add home-stow-migration-service. In-Reply-To: References: User-Agent: Roundcube Webmail Message-ID: <6178cf42812efc69a1eb22a04994c2e7@autistici.org> X-Sender: goodoldpaul@autistici.org Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 60521 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Hi, I'm sending an updated patchset based on the latest master. Thank you for your time! giacomo From debbugs-submit-bounces@debbugs.gnu.org Sat Aug 26 05:39:20 2023 Received: (at 60521) by debbugs.gnu.org; 26 Aug 2023 09:39:20 +0000 Received: from localhost ([127.0.0.1]:41769 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qZplH-0001f3-GB for submit@debbugs.gnu.org; Sat, 26 Aug 2023 05:39:20 -0400 Received: from confino.investici.org ([93.190.126.19]:35809) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qZplF-0001ev-Mb for 60521@debbugs.gnu.org; Sat, 26 Aug 2023 05:39:18 -0400 Received: from mx1.investici.org (unknown [127.0.0.1]) by confino.investici.org (Postfix) with ESMTP id 4RXsGS0Qczz119w; Sat, 26 Aug 2023 09:39:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=autistici.org; s=stigmate; t=1693042752; bh=ts7ZZsyoMq3uDBDwIUxaZa97kr2GblLXYvZkuQfC0wo=; h=From:To:Cc:Subject:Date:From; b=CRKaR0/ATBARXm62i34j0g16z8Ldnxmq6u+LbehcH94S1GXjdX7kDaFgXSEXVo7Xv tsuHcK/JyysgmfOMEr6dGfh0jMHdoBaDy6zZshHll6NKwGb9cRNQ02UP0jWvFaN/cA 3cHHUbjLxl0SKkvyNCYW7FPE56rGNZLBm9i/I418= Received: from [93.190.126.19] (mx1.investici.org [93.190.126.19]) (Authenticated sender: goodoldpaul@autistici.org) by localhost (Postfix) with ESMTPSA id 4RXsGR70v5z116w; Sat, 26 Aug 2023 09:39:11 +0000 (UTC) From: Giacomo Leidi To: 60521@debbugs.gnu.org Subject: [PATCH-v4] home: Add home-dotfiles-service. Date: Sat, 26 Aug 2023 11:39:00 +0200 Message-ID: X-Mailer: git-send-email 2.41.0 MIME-Version: 1.0 X-Debbugs-Cc: paren@disroot.org, andrew@trop.in, ludo@gnu.org X-Debbugs-Cc: ( , Andrew Tropin , Ludovic Courtès Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 60521 Cc: Giacomo Leidi X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) * gnu/home/services.scm (dotfiles-for-app): New variable; (home-dotfiles-configuration): new variable; (home-dotfiles-service-type): new variable. * doc/guix.texi: Document it. --- doc/guix.texi | 108 ++++++++++++++++++++++++++++++++++++++++++ gnu/home/services.scm | 78 ++++++++++++++++++++++++++++++ 2 files changed, 186 insertions(+) diff --git a/doc/guix.texi b/doc/guix.texi index 6105195bd9..87f0fdf8a1 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -43153,6 +43153,114 @@ Essential Home Services read-only home. Feel free to experiment and share your results. @end defvar +It is often the case that Guix Home users already have a setup for versioning +their user configuration files (also known as @emph{dotfiles}) in a single +directory, and some way of automatically deploy changes to their user home. + +The @code{home-dotfiles-service-type} is designed to ease the way into using +Guix Home for this kind of users, allowing them to point the service to their +dotfiles directory, which must follow the layout suggested by +@uref{https://www.gnu.org/software/stow/, GNU Stow}, +and have their dotfiles automatically deployed to their user home, without +migrating them to Guix native configurations. + +The dotfiles directory layout is expected to be structured as follows. Please +keep in mind that it is advisable to keep your dotfiles directories under +version control, for example in the same repository where you'd track your +Guix Home configuration. + +@example +~$ tree -a .dotfiles/ +.dotfiles/ +├── git +│ └── .gitconfig +├── gpg +│ └── .gnupg +│ ├── gpg-agent.conf +│ └── gpg.conf +├── guile +│ └── .guile +├── guix +│ └── .config +│ └── guix +│ └── channels.scm +├── nix +│ ├── .config +│ │ └── nixpkgs +│ │ └── config.nix +│ └── .nix-channels +├── tmux +│ └── .tmux.conf +└── vim + └── .vimrc + +13 directories, 10 files +@end example + +For an informal specification please refer to the Stow manual +(@pxref{Top,,, stow, Introduction}). A suitable configuration would then +be: + +@lisp +(use-modules (guix utils)) + +(home-environment + + [...] + + (services + (service home-dotfiles-service-type + (home-dotfiles-configuration + (directories + (list (string-append (current-source-directory) + "/.dotfiles"))))))) +@end lisp + +The expected home directory state would be: + +@example +. +├── .config +│ ├── guix +│ │ └── channels.scm +│ └── nixpkgs +│ └── config.nix +├── .gitconfig +├── .gnupg +│ ├── gpg-agent.conf +│ └── gpg.conf +├── .guile +├── .nix-channels +├── .tmux.conf +└── .vimrc +@end example + +@defvar home-dotfiles-service-type +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 users that already track their dotfiles under some kind of version +control. This service allows users to point Guix Home to their dotfiles +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. +@end defvar + +@deftp {Data Type} home-dotfiles-configuration +Available @code{home-dotfiles-configuration} fields are: + +@table @asis +@item @code{directories} (type: list-of-strings) +The list of dotfiles directories where @code{home-dotfiles-service-type} will +look for application dotfiles. + +@item @code{exclude} (default: @code{'(".*~" ".*\\.swp" "\\.gitignore")}) +The list of file patterns @code{home-dotfiles-service-type} will exclude while +visiting @code{directories}. + +@end table + +@end deftp + @defvar home-xdg-configuration-files-service-type The service is very similar 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 8d53f2f4d3..8a74052b5a 100644 --- a/gnu/home/services.scm +++ b/gnu/home/services.scm @@ -2,6 +2,7 @@ ;;; Copyright © 2021-2023 Andrew Tropin ;;; Copyright © 2021 Xinglu Chen ;;; Copyright © 2022-2023 Ludovic Courtès +;;; Copyright © 2023 Giacomo Leidi ;;; ;;; This file is part of GNU Guix. ;;; @@ -22,6 +23,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) @@ -34,15 +36,24 @@ (define-module (gnu home services) #:use-module (guix i18n) #:use-module (guix modules) #:use-module (guix memoization) + #:use-module (guix records) #:use-module (srfi srfi-1) #:use-module (srfi srfi-9) + #:use-module (ice-9 ftw) #:use-module (ice-9 match) + #:use-module (ice-9 regex) + #: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-dotfiles-service-type + home-dotfiles-configuration + home-dotfiles-configuration? + home-dotfiles-configuration-directories + home-dotfiles-configuration-excluded home-xdg-configuration-files-service-type home-xdg-data-files-service-type home-run-on-first-login-service-type @@ -354,6 +365,73 @@ (define home-files-service-type (description "Files that will be put in @file{~/.guix-home/files}, and further processed during activation."))) +(define %home-dotfiles-excluded + '(".*~" + ".*\\.swp" + "\\.gitignore")) + +(define-record-type* + home-dotfiles-configuration make-home-dotfiles-configuration + home-dotfiles-configuration? + (directories home-dotfiles-configuration-directories ;list of strings + (default '())) + (excluded home-dotfiles-configuration-excluded ;list of strings + (default %home-dotfiles-excluded))) + +(define* (import-dotfiles directory excluded) + "Return a list of objects compatible with @code{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 DIRECTORY and mapping its contents to the +user's home directory, excluding files that match any of the patterns in EXCLUDED." + (define filtered + (find-files directory + (lambda (file stat) + (not (string-match + (string-append + "^.*(" (string-join excluded "|") ")$") file))))) + (define (strip file) + (string-drop file (+ 1 (string-length directory)))) + (define (format file) + (string-append "home-dotfiles-" + (string-replace-substring file "/" "-"))) + + (map (lambda (file) + (let* ((stripped (strip file))) + (list stripped + (local-file file (format stripped))))) + filtered)) + +(define (home-dotfiles-configuration->files config) + "Return a list of objects compatible with @code{home-files-service-type}'s +value, generated following GNU Stow's algorithm for each of the +directories in CONFIG, excluding files that match any of the patterns configured." + (define (directory-contents directories) + (append-map + (lambda (directory) + (map + (lambda (content) + (with-directory-excursion directory + (canonicalize-path content))) + (scandir directory + (lambda (name) + (not (member name '("." ".."))))))) + directories)) + (append-map + (lambda (app) + (import-dotfiles app (home-dotfiles-configuration-excluded config))) + (directory-contents + (home-dotfiles-configuration-directories config)))) + +(define-public home-dotfiles-service-type + (service-type (name 'home-dotfiles) + (extensions + (list (service-extension home-files-service-type + home-dotfiles-configuration->files))) + (default-value (home-dotfiles-configuration)) + (description "Files that will be put in the user's home directory +following GNU Stow's algorithm, and further processed during activation."))) + (define xdg-configuration-files-directory ".config") (define (xdg-configuration-files files) base-commit: eeb71d778f149834015858467fbeeb1276d96d1d -- 2.41.0 From debbugs-submit-bounces@debbugs.gnu.org Fri Sep 22 09:00:04 2023 Received: (at 60521) by debbugs.gnu.org; 22 Sep 2023 13:00:04 +0000 Received: from localhost ([127.0.0.1]:35621 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qjflM-0005q8-7x for submit@debbugs.gnu.org; Fri, 22 Sep 2023 09:00:04 -0400 Received: from confino.investici.org ([2a11:7980:1::2:0]:60925) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qjflE-0005ov-SY for 60521@debbugs.gnu.org; Fri, 22 Sep 2023 09:00:01 -0400 Received: from mx1.investici.org (unknown [127.0.0.1]) by confino.investici.org (Postfix) with ESMTP id 4RsXRM0NN1z111w; Fri, 22 Sep 2023 12:59:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=autistici.org; s=stigmate; t=1695387583; bh=7i0EdUEmhkS5OO319EXIk3dpIXayK8MkNKE1GINPj3c=; h=Date:Subject:From:To:References:In-Reply-To:From; b=FSN8r8PIHuyKLRUHaQOka7xMEFghi47dOR+HW7zgHNZmmjf6UFu/Gqt4PW5f/REkM gOsfjXOdvnYpKttyZO9lM+XFigfTs5hYwdgxdginCRYe04AWRYYD+RkDDGDjQqeBIo 7MXeTNd18r2eQtVk3PPa9AVgOTeijp9x/afKKI/0= Received: from [93.190.126.19] (mx1.investici.org [93.190.126.19]) (Authenticated sender: goodoldpaul@autistici.org) by localhost (Postfix) with ESMTPSA id 4RsXRL6SRZz111v; Fri, 22 Sep 2023 12:59:42 +0000 (UTC) Message-ID: <96a1d2be-bf39-f15c-1947-0a6ddeb2e44b@autistici.org> Date: Fri, 22 Sep 2023 14:59:42 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.15.0 Subject: Re: bug#60521: [PATCH] home: Add home-stow-migration-service. From: paul To: 60521@debbugs.gnu.org, ludo@gnu.org, paren@disroot.org, andrew@trop.in References: <6178cf42812efc69a1eb22a04994c2e7@autistici.org> Content-Language: en-US In-Reply-To: <6178cf42812efc69a1eb22a04994c2e7@autistici.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: -1.5 (-) X-Debbugs-Envelope-To: 60521 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.5 (--) Hi, I'm sending an updated patchset rebased on current master. Thank you for your time, giacomo From debbugs-submit-bounces@debbugs.gnu.org Fri Sep 22 09:01:59 2023 Received: (at 60521) by debbugs.gnu.org; 22 Sep 2023 13:01:59 +0000 Received: from localhost ([127.0.0.1]:35626 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qjfnC-0005tu-OO for submit@debbugs.gnu.org; Fri, 22 Sep 2023 09:01:59 -0400 Received: from confino.investici.org ([2a11:7980:1::2:0]:54533) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qjfnA-0005tm-6c for 60521@debbugs.gnu.org; Fri, 22 Sep 2023 09:01:57 -0400 Received: from mx1.investici.org (unknown [127.0.0.1]) by confino.investici.org (Postfix) with ESMTP id 4RsXTh71Yfz113P; Fri, 22 Sep 2023 13:01:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=autistici.org; s=stigmate; t=1695387704; bh=f8HNJt7MQUDy5ZWR6nrFXHXrX9I8B3ygjQhMs3F3S+8=; h=From:To:Cc:Subject:Date:From; b=AWQ2Q7usYYMAE2oFtD/9GQCX11vQFVJbEQmKGr82TAMhgRBeJ5ndDIy6/WpLMqPC4 au1Jt3W5tx7dmO2LwzhL/7suQxC3qLbZkPhhcMG1qNOu0H7Ekj56z1z34O6GJXDY3t uoZ4wEXI02Y/86AebkDg8YcE3VFnNG0KOpX/8utk= Received: from [93.190.126.19] (mx1.investici.org [93.190.126.19]) (Authenticated sender: goodoldpaul@autistici.org) by localhost (Postfix) with ESMTPSA id 4RsXTh6CX8z111v; Fri, 22 Sep 2023 13:01:44 +0000 (UTC) From: Giacomo Leidi To: 60521@debbugs.gnu.org Subject: [PATCH] home: Add home-dotfiles-service. Date: Fri, 22 Sep 2023 15:01:04 +0200 Message-ID: <88eee8890b69cd58052188348f89fc673fa1c922.1695387663.git.goodoldpaul@autistici.org> X-Mailer: git-send-email 2.41.0 MIME-Version: 1.0 X-Debbugs-Cc: ( , Andrew Tropin , Ludovic Courtès Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 60521 Cc: Giacomo Leidi X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) * gnu/home/services.scm (dotfiles-for-app): New variable; (home-dotfiles-configuration): new variable; (home-dotfiles-service-type): new variable. * doc/guix.texi: Document it. --- doc/guix.texi | 108 ++++++++++++++++++++++++++++++++++++++++++ gnu/home/services.scm | 78 ++++++++++++++++++++++++++++++ 2 files changed, 186 insertions(+) diff --git a/doc/guix.texi b/doc/guix.texi index 617b8463e3..9d75253c2b 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -43239,6 +43239,114 @@ Essential Home Services read-only home. Feel free to experiment and share your results. @end defvar +It is often the case that Guix Home users already have a setup for versioning +their user configuration files (also known as @emph{dotfiles}) in a single +directory, and some way of automatically deploy changes to their user home. + +The @code{home-dotfiles-service-type} is designed to ease the way into using +Guix Home for this kind of users, allowing them to point the service to their +dotfiles directory, which must follow the layout suggested by +@uref{https://www.gnu.org/software/stow/, GNU Stow}, +and have their dotfiles automatically deployed to their user home, without +migrating them to Guix native configurations. + +The dotfiles directory layout is expected to be structured as follows. Please +keep in mind that it is advisable to keep your dotfiles directories under +version control, for example in the same repository where you'd track your +Guix Home configuration. + +@example +~$ tree -a .dotfiles/ +.dotfiles/ +├── git +│ └── .gitconfig +├── gpg +│ └── .gnupg +│ ├── gpg-agent.conf +│ └── gpg.conf +├── guile +│ └── .guile +├── guix +│ └── .config +│ └── guix +│ └── channels.scm +├── nix +│ ├── .config +│ │ └── nixpkgs +│ │ └── config.nix +│ └── .nix-channels +├── tmux +│ └── .tmux.conf +└── vim + └── .vimrc + +13 directories, 10 files +@end example + +For an informal specification please refer to the Stow manual +(@pxref{Top,,, stow, Introduction}). A suitable configuration would then +be: + +@lisp +(use-modules (guix utils)) + +(home-environment + + [...] + + (services + (service home-dotfiles-service-type + (home-dotfiles-configuration + (directories + (list (string-append (current-source-directory) + "/.dotfiles"))))))) +@end lisp + +The expected home directory state would be: + +@example +. +├── .config +│ ├── guix +│ │ └── channels.scm +│ └── nixpkgs +│ └── config.nix +├── .gitconfig +├── .gnupg +│ ├── gpg-agent.conf +│ └── gpg.conf +├── .guile +├── .nix-channels +├── .tmux.conf +└── .vimrc +@end example + +@defvar home-dotfiles-service-type +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 users that already track their dotfiles under some kind of version +control. This service allows users to point Guix Home to their dotfiles +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. +@end defvar + +@deftp {Data Type} home-dotfiles-configuration +Available @code{home-dotfiles-configuration} fields are: + +@table @asis +@item @code{directories} (type: list-of-strings) +The list of dotfiles directories where @code{home-dotfiles-service-type} will +look for application dotfiles. + +@item @code{exclude} (default: @code{'(".*~" ".*\\.swp" "\\.gitignore")}) +The list of file patterns @code{home-dotfiles-service-type} will exclude while +visiting @code{directories}. + +@end table + +@end deftp + @defvar home-xdg-configuration-files-service-type The service is very similar 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 8d53f2f4d3..8a74052b5a 100644 --- a/gnu/home/services.scm +++ b/gnu/home/services.scm @@ -2,6 +2,7 @@ ;;; Copyright © 2021-2023 Andrew Tropin ;;; Copyright © 2021 Xinglu Chen ;;; Copyright © 2022-2023 Ludovic Courtès +;;; Copyright © 2023 Giacomo Leidi ;;; ;;; This file is part of GNU Guix. ;;; @@ -22,6 +23,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) @@ -34,15 +36,24 @@ (define-module (gnu home services) #:use-module (guix i18n) #:use-module (guix modules) #:use-module (guix memoization) + #:use-module (guix records) #:use-module (srfi srfi-1) #:use-module (srfi srfi-9) + #:use-module (ice-9 ftw) #:use-module (ice-9 match) + #:use-module (ice-9 regex) + #: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-dotfiles-service-type + home-dotfiles-configuration + home-dotfiles-configuration? + home-dotfiles-configuration-directories + home-dotfiles-configuration-excluded home-xdg-configuration-files-service-type home-xdg-data-files-service-type home-run-on-first-login-service-type @@ -354,6 +365,73 @@ (define home-files-service-type (description "Files that will be put in @file{~/.guix-home/files}, and further processed during activation."))) +(define %home-dotfiles-excluded + '(".*~" + ".*\\.swp" + "\\.gitignore")) + +(define-record-type* + home-dotfiles-configuration make-home-dotfiles-configuration + home-dotfiles-configuration? + (directories home-dotfiles-configuration-directories ;list of strings + (default '())) + (excluded home-dotfiles-configuration-excluded ;list of strings + (default %home-dotfiles-excluded))) + +(define* (import-dotfiles directory excluded) + "Return a list of objects compatible with @code{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 DIRECTORY and mapping its contents to the +user's home directory, excluding files that match any of the patterns in EXCLUDED." + (define filtered + (find-files directory + (lambda (file stat) + (not (string-match + (string-append + "^.*(" (string-join excluded "|") ")$") file))))) + (define (strip file) + (string-drop file (+ 1 (string-length directory)))) + (define (format file) + (string-append "home-dotfiles-" + (string-replace-substring file "/" "-"))) + + (map (lambda (file) + (let* ((stripped (strip file))) + (list stripped + (local-file file (format stripped))))) + filtered)) + +(define (home-dotfiles-configuration->files config) + "Return a list of objects compatible with @code{home-files-service-type}'s +value, generated following GNU Stow's algorithm for each of the +directories in CONFIG, excluding files that match any of the patterns configured." + (define (directory-contents directories) + (append-map + (lambda (directory) + (map + (lambda (content) + (with-directory-excursion directory + (canonicalize-path content))) + (scandir directory + (lambda (name) + (not (member name '("." ".."))))))) + directories)) + (append-map + (lambda (app) + (import-dotfiles app (home-dotfiles-configuration-excluded config))) + (directory-contents + (home-dotfiles-configuration-directories config)))) + +(define-public home-dotfiles-service-type + (service-type (name 'home-dotfiles) + (extensions + (list (service-extension home-files-service-type + home-dotfiles-configuration->files))) + (default-value (home-dotfiles-configuration)) + (description "Files that will be put in the user's home directory +following GNU Stow's algorithm, and further processed during activation."))) + (define xdg-configuration-files-directory ".config") (define (xdg-configuration-files files) base-commit: f45c0c82289d409b4fac00464ea8b323839ba53f -- 2.41.0 From debbugs-submit-bounces@debbugs.gnu.org Mon Oct 02 01:34:02 2023 Received: (at 60521) by debbugs.gnu.org; 2 Oct 2023 05:34:02 +0000 Received: from localhost ([127.0.0.1]:35739 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qnBZB-0003x4-Rz for submit@debbugs.gnu.org; Mon, 02 Oct 2023 01:34:02 -0400 Received: from mail-ej1-x633.google.com ([2a00:1450:4864:20::633]:49418) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qn8Xv-0003VL-Mz for 60521@debbugs.gnu.org; Sun, 01 Oct 2023 22:20:32 -0400 Received: by mail-ej1-x633.google.com with SMTP id a640c23a62f3a-9b2cee55056so527722066b.3 for <60521@debbugs.gnu.org>; Sun, 01 Oct 2023 19:20:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1696213209; x=1696818009; darn=debbugs.gnu.org; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=WDspwT0T/ceelf3v34GywHjX9hPQ0zfaOySuO0BDZ/c=; b=AnC9nrpE9IFT21RxPG+sWfnzWOQl6ZlsfW+5y+jSzzoSGaGk03/QxdSuAxBQCeMgxv fu5B7oK8bdDtAvwqg9pow7QZVM/Lv53PXstHnx198Ph+nZ4U1X9mZd65BxKaEEwOaSeR trX2P7EmtLDF/3RheLWw67DZqnD12ccVQPWbPBW7BNc7KZ5tnmWtAVexCG1m2UCudvxl pimQbOkOn7Whh4DK4nkE3hhoM8OaeIROdLaLi8df0HI7aZ4qzwRSJx4R0c/Rj5etWM8N tL1Oq5yZQBT9TETF7OlQppYBH/n5YDQyjPKIIOpup0B3l3iPd22x0j46ItYBIsSlbWut FZFQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696213209; x=1696818009; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=WDspwT0T/ceelf3v34GywHjX9hPQ0zfaOySuO0BDZ/c=; b=W8P+YQlPv+UzhbTnqn0EpCGGgbBkt4zh5y+COgTWjP/+1Ont8erFTiIun0RrpLYKwt XUp68sWFio27DRh26cN8YvWbfUdhamw80dlc6u7lYFw1OZI8CAzRUFtjeekcf34a0ozU GGr/mo+EmEkfE7Vqu4IjfgfWNU5ED6AKfUAxaZTAR1V5pTEy5gP6c1HZbmenWV3GpfOm teEKV6vZQj9KnFhXLow9WdecQJKZqjJ76Z5tcXhPQlA7ht1/iud2EnJCvBZF+cCGFwET FVZeu3BJGz7PhkyYcPo7PH1+W7F6P7vo669/k6NoAHNjS1D1t3OgpjbBk4TfgktGjQC+ +/gA== X-Gm-Message-State: AOJu0YxWzM/9kdUtB55CB9jZZvCeO6nChicm0KN2f7mwV7l3h+ec0RHM awpd5SSwW21u/jU9XLCp3yvDcBFct/mPxgPFFIRKIN+euiAulA== X-Google-Smtp-Source: AGHT+IGvkhS/BkRa4GG3h4vMH8lAmoFWBrpbN8KO9h4m7UXOCDZYrl7xKnP4qTmJUuAtPU7GcoDcp5LE+/Hj4u1plnI= X-Received: by 2002:a17:906:5352:b0:9b2:d2d8:f0f4 with SMTP id j18-20020a170906535200b009b2d2d8f0f4mr7476025ejo.39.1696213209252; Sun, 01 Oct 2023 19:20:09 -0700 (PDT) MIME-Version: 1.0 From: Nicolas Odermatt-Lemay Date: Sun, 1 Oct 2023 22:19:58 -0400 Message-ID: Subject: To: 60521@debbugs.gnu.org Content-Type: multipart/alternative; boundary="000000000000cd06d80606b26971" X-Spam-Score: 2.0 (++) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Hi ! I've been playing with the code from this patch and I'd suggest adding the .git directory to %home-dotfiles-excluded Hi ! I've been playing with the code from this patch and I'd suggest adding the .git directory to %home-dotfiles-excluded Content analysis details: (2.0 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (nodermattlemay[at]gmail.com) 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 HTML_MESSAGE BODY: HTML included in message -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:633 listed in] [list.dnswl.org] 2.0 BLANK_SUBJECT Subject is present but empty X-Debbugs-Envelope-To: 60521 X-Mailman-Approved-At: Mon, 02 Oct 2023 01:34:01 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 1.0 (+) --000000000000cd06d80606b26971 Content-Type: text/plain; charset="UTF-8" Hi ! I've been playing with the code from this patch and I'd suggest adding the .git directory to %home-dotfiles-excluded --000000000000cd06d80606b26971 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi ! I've been playing with the code from this patch a= nd I'd suggest adding the .git directory to=C2=A0%home-dotfiles-excluded
--000000000000cd06d80606b26971-- From debbugs-submit-bounces@debbugs.gnu.org Fri Oct 06 17:17:36 2023 Received: (at 60521) by debbugs.gnu.org; 6 Oct 2023 21:17:36 +0000 Received: from localhost ([127.0.0.1]:52793 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qosCW-0000oO-HI for submit@debbugs.gnu.org; Fri, 06 Oct 2023 17:17:36 -0400 Received: from confino.investici.org ([2a11:7980:1::2:0]:27149) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qosCU-0000oF-25 for 60521@debbugs.gnu.org; Fri, 06 Oct 2023 17:17:35 -0400 Received: from mx1.investici.org (unknown [127.0.0.1]) by confino.investici.org (Postfix) with ESMTP id 4S2Lpx23vPz114S; Fri, 6 Oct 2023 21:17:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=autistici.org; s=stigmate; t=1696627033; bh=565pXBwC2G9yKrSCo4NCdkEaro0Sk7TUCTte6T/qEbc=; h=Date:To:Cc:From:Subject:From; b=O8fbYysihRCK4+e0Mi53d3dUh0geqcWTp9o/r+JMA86zFYvPunrnDW+0ExJmWPRs6 Gg0DdP6IJATXQcB8x603jpsCYpZ8+cmmYgDvVohSkynbCNYr9am3aNKu6VbiMYDU30 KT16tERUmPCRQB6Eq4c/fJItRpQYpc5cvOpyUxks= Received: from [93.190.126.19] (mx1.investici.org [93.190.126.19]) (Authenticated sender: goodoldpaul@autistici.org) by localhost (Postfix) with ESMTPSA id 4S2Lpx08GCz113W; Fri, 6 Oct 2023 21:17:12 +0000 (UTC) Content-Type: multipart/alternative; boundary="------------TDS0t02d8BKuIYorhQglOfEK" Message-ID: <3a46ad25-5d49-f121-6910-8582aa2bdff7@autistici.org> Date: Fri, 6 Oct 2023 23:17:12 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.15.0 Content-Language: en-US To: 60521@debbugs.gnu.org, nodermattlemay@gmail.com From: paul Subject: Re: [PATCH] home: Add home-dotfiles-service. X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 60521 Cc: =?UTF-8?Q?Ludovic_Court=c3=a8s?= X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) This is a multi-part message in MIME format. --------------TDS0t02d8BKuIYorhQglOfEK Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Hi Nicolas, nice catch. I'm sending a patchset rebased on current master --------------TDS0t02d8BKuIYorhQglOfEK Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 7bit

Hi Nicolas, nice catch. I'm sending a patchset rebased on current master

--------------TDS0t02d8BKuIYorhQglOfEK-- From debbugs-submit-bounces@debbugs.gnu.org Fri Oct 06 17:22:47 2023 Received: (at 60521) by debbugs.gnu.org; 6 Oct 2023 21:22:47 +0000 Received: from localhost ([127.0.0.1]:52797 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qosHX-0000w1-5y for submit@debbugs.gnu.org; Fri, 06 Oct 2023 17:22:47 -0400 Received: from confino.investici.org ([93.190.126.19]:54307) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qosHV-0000vt-LM for 60521@debbugs.gnu.org; Fri, 06 Oct 2023 17:22:46 -0400 Received: from mx1.investici.org (unknown [127.0.0.1]) by confino.investici.org (Postfix) with ESMTP id 4S2Lwx1dLGz114S; Fri, 6 Oct 2023 21:22:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=autistici.org; s=stigmate; t=1696627345; bh=6yjlB6GWLYxIObfQ902WGaY/o4yk220KHFNAQUVaxbA=; h=From:To:Cc:Subject:Date:From; b=XVDw/7uTjViAMnigqHYH/FxLJ8UiZvNLrujg28LxUatTw5K8lGglZpEm6PQClwXlq 5wtt3TqkTLK6PgGWUYwYp6KtOcVWiQB94XndFMMX4IMuYH/xk+mwCut7umHD01mAxA WexC7FlRjvl7UObjRxReY+gMRFXeYP5jiMlANTcQ= Received: from [93.190.126.19] (mx1.investici.org [93.190.126.19]) (Authenticated sender: goodoldpaul@autistici.org) by localhost (Postfix) with ESMTPSA id 4S2Lwx0pszz114D; Fri, 6 Oct 2023 21:22:25 +0000 (UTC) From: Giacomo Leidi To: 60521@debbugs.gnu.org Subject: [PATCH] home: Add home-dotfiles-service. Date: Fri, 6 Oct 2023 23:22:00 +0200 Message-ID: <6455ef24879021f0d1cb1f302d40df1ed5aa4370.1696627320.git.goodoldpaul@autistici.org> X-Mailer: git-send-email 2.41.0 MIME-Version: 1.0 X-Debbugs-Cc: ( , Andrew Tropin , Ludovic Courtès Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 60521 Cc: Giacomo Leidi X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) * gnu/home/services.scm (dotfiles-for-app): New variable; (home-dotfiles-configuration): new variable; (home-dotfiles-service-type): new variable. * doc/guix.texi: Document it. --- doc/guix.texi | 108 ++++++++++++++++++++++++++++++++++++++++++ gnu/home/services.scm | 79 ++++++++++++++++++++++++++++++ 2 files changed, 187 insertions(+) diff --git a/doc/guix.texi b/doc/guix.texi index 52a573f0d8..56ec1f4d7c 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -43348,6 +43348,114 @@ Essential Home Services read-only home. Feel free to experiment and share your results. @end defvar +It is often the case that Guix Home users already have a setup for versioning +their user configuration files (also known as @emph{dotfiles}) in a single +directory, and some way of automatically deploy changes to their user home. + +The @code{home-dotfiles-service-type} is designed to ease the way into using +Guix Home for this kind of users, allowing them to point the service to their +dotfiles directory, which must follow the layout suggested by +@uref{https://www.gnu.org/software/stow/, GNU Stow}, +and have their dotfiles automatically deployed to their user home, without +migrating them to Guix native configurations. + +The dotfiles directory layout is expected to be structured as follows. Please +keep in mind that it is advisable to keep your dotfiles directories under +version control, for example in the same repository where you'd track your +Guix Home configuration. + +@example +~$ tree -a .dotfiles/ +.dotfiles/ +├── git +│ └── .gitconfig +├── gpg +│ └── .gnupg +│ ├── gpg-agent.conf +│ └── gpg.conf +├── guile +│ └── .guile +├── guix +│ └── .config +│ └── guix +│ └── channels.scm +├── nix +│ ├── .config +│ │ └── nixpkgs +│ │ └── config.nix +│ └── .nix-channels +├── tmux +│ └── .tmux.conf +└── vim + └── .vimrc + +13 directories, 10 files +@end example + +For an informal specification please refer to the Stow manual +(@pxref{Top,,, stow, Introduction}). A suitable configuration would then +be: + +@lisp +(use-modules (guix utils)) + +(home-environment + + [...] + + (services + (service home-dotfiles-service-type + (home-dotfiles-configuration + (directories + (list (string-append (current-source-directory) + "/.dotfiles"))))))) +@end lisp + +The expected home directory state would be: + +@example +. +├── .config +│ ├── guix +│ │ └── channels.scm +│ └── nixpkgs +│ └── config.nix +├── .gitconfig +├── .gnupg +│ ├── gpg-agent.conf +│ └── gpg.conf +├── .guile +├── .nix-channels +├── .tmux.conf +└── .vimrc +@end example + +@defvar home-dotfiles-service-type +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 users that already track their dotfiles under some kind of version +control. This service allows users to point Guix Home to their dotfiles +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. +@end defvar + +@deftp {Data Type} home-dotfiles-configuration +Available @code{home-dotfiles-configuration} fields are: + +@table @asis +@item @code{directories} (type: list-of-strings) +The list of dotfiles directories where @code{home-dotfiles-service-type} will +look for application dotfiles. + +@item @code{exclude} (default: @code{'(".*~" ".*\\.swp" "\\.gitignore")}) +The list of file patterns @code{home-dotfiles-service-type} will exclude while +visiting @code{directories}. + +@end table + +@end deftp + @defvar home-xdg-configuration-files-service-type The service is very similar 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 8d53f2f4d3..87c4a95da3 100644 --- a/gnu/home/services.scm +++ b/gnu/home/services.scm @@ -2,6 +2,7 @@ ;;; Copyright © 2021-2023 Andrew Tropin ;;; Copyright © 2021 Xinglu Chen ;;; Copyright © 2022-2023 Ludovic Courtès +;;; Copyright © 2023 Giacomo Leidi ;;; ;;; This file is part of GNU Guix. ;;; @@ -22,6 +23,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) @@ -34,15 +36,24 @@ (define-module (gnu home services) #:use-module (guix i18n) #:use-module (guix modules) #:use-module (guix memoization) + #:use-module (guix records) #:use-module (srfi srfi-1) #:use-module (srfi srfi-9) + #:use-module (ice-9 ftw) #:use-module (ice-9 match) + #:use-module (ice-9 regex) + #: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-dotfiles-service-type + home-dotfiles-configuration + home-dotfiles-configuration? + home-dotfiles-configuration-directories + home-dotfiles-configuration-excluded home-xdg-configuration-files-service-type home-xdg-data-files-service-type home-run-on-first-login-service-type @@ -354,6 +365,74 @@ (define home-files-service-type (description "Files that will be put in @file{~/.guix-home/files}, and further processed during activation."))) +(define %home-dotfiles-excluded + '(".*~" + ".*\\.swp" + "\\.git" + "\\.gitignore")) + +(define-record-type* + home-dotfiles-configuration make-home-dotfiles-configuration + home-dotfiles-configuration? + (directories home-dotfiles-configuration-directories ;list of strings + (default '())) + (excluded home-dotfiles-configuration-excluded ;list of strings + (default %home-dotfiles-excluded))) + +(define* (import-dotfiles directory excluded) + "Return a list of objects compatible with @code{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 DIRECTORY and mapping its contents to the +user's home directory, excluding files that match any of the patterns in EXCLUDED." + (define filtered + (find-files directory + (lambda (file stat) + (not (string-match + (string-append + "^.*(" (string-join excluded "|") ")$") file))))) + (define (strip file) + (string-drop file (+ 1 (string-length directory)))) + (define (format file) + (string-append "home-dotfiles-" + (string-replace-substring file "/" "-"))) + + (map (lambda (file) + (let* ((stripped (strip file))) + (list stripped + (local-file file (format stripped))))) + filtered)) + +(define (home-dotfiles-configuration->files config) + "Return a list of objects compatible with @code{home-files-service-type}'s +value, generated following GNU Stow's algorithm for each of the +directories in CONFIG, excluding files that match any of the patterns configured." + (define (directory-contents directories) + (append-map + (lambda (directory) + (map + (lambda (content) + (with-directory-excursion directory + (canonicalize-path content))) + (scandir directory + (lambda (name) + (not (member name '("." ".."))))))) + directories)) + (append-map + (lambda (app) + (import-dotfiles app (home-dotfiles-configuration-excluded config))) + (directory-contents + (home-dotfiles-configuration-directories config)))) + +(define-public home-dotfiles-service-type + (service-type (name 'home-dotfiles) + (extensions + (list (service-extension home-files-service-type + home-dotfiles-configuration->files))) + (default-value (home-dotfiles-configuration)) + (description "Files that will be put in the user's home directory +following GNU Stow's algorithm, and further processed during activation."))) + (define xdg-configuration-files-directory ".config") (define (xdg-configuration-files files) base-commit: add2a22ad7bcca2521432e3f486460138401d5a5 -- 2.41.0 From debbugs-submit-bounces@debbugs.gnu.org Sun Oct 29 08:58:44 2023 Received: (at 60521) by debbugs.gnu.org; 29 Oct 2023 12:58:44 +0000 Received: from localhost ([127.0.0.1]:40702 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qx5NL-0001rr-Pt for submit@debbugs.gnu.org; Sun, 29 Oct 2023 08:58:44 -0400 Received: from confino.investici.org ([93.190.126.19]:25111) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qx5NJ-0001rg-3V for 60521@debbugs.gnu.org; Sun, 29 Oct 2023 08:58:42 -0400 Received: from mx1.investici.org (unknown [127.0.0.1]) by confino.investici.org (Postfix) with ESMTP id 4SJGfQ5zK1z110N; Sun, 29 Oct 2023 12:58:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=autistici.org; s=stigmate; t=1698584286; bh=7i0EdUEmhkS5OO319EXIk3dpIXayK8MkNKE1GINPj3c=; h=Date:To:Cc:From:Subject:From; b=ZJlufPW1DhnTnWf4zT7/7IBu8qi+u53hnRfQtoprTD5hUU0ZhJqKu9jzxEX64g8tb 9YnUUlBpTUjwWhlIOOYujdDKxFUGFE3+Hk4TtX5S+ac7O3elmJ3DXOU3hTam6B5sRs yxOJgmvg/ntFp7J97d1j8VkW/LPGdQ3su4CiiC5Q= Received: from [93.190.126.19] (mx1.investici.org [93.190.126.19]) (Authenticated sender: goodoldpaul@autistici.org) by localhost (Postfix) with ESMTPSA id 4SJGfQ5B7bz110M; Sun, 29 Oct 2023 12:58:06 +0000 (UTC) Message-ID: <0a34b882-cb82-cbb2-50fe-f85725acf024@autistici.org> Date: Sun, 29 Oct 2023 13:58:06 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.15.0 Content-Language: en-US To: 60521@debbugs.gnu.org From: paul Subject: [60521] Add home-dotfiles-service-type - Rebased on master Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 60521 Cc: =?UTF-8?Q?Ludovic_Court=c3=a8s?= , mirai@makinata.eu, andrew@trop.in X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Hi, I'm sending an updated patchset rebased on current master. Thank you for your time, giacomo From debbugs-submit-bounces@debbugs.gnu.org Sun Oct 29 09:01:12 2023 Received: (at 60521) by debbugs.gnu.org; 29 Oct 2023 13:01:12 +0000 Received: from localhost ([127.0.0.1]:40713 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qx5Pj-0001y4-ML for submit@debbugs.gnu.org; Sun, 29 Oct 2023 09:01:12 -0400 Received: from confino.investici.org ([2a11:7980:1::2:0]:45083) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qx5Ph-0001xv-I9 for 60521@debbugs.gnu.org; Sun, 29 Oct 2023 09:01:10 -0400 Received: from mx1.investici.org (unknown [127.0.0.1]) by confino.investici.org (Postfix) with ESMTP id 4SJGjH3S5pz110M; Sun, 29 Oct 2023 13:00:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=autistici.org; s=stigmate; t=1698584435; bh=oo5mgH/Gi4CNYf6x+gaLXxaXeF8kMZJC5WJkQtaZIes=; h=From:To:Cc:Subject:Date:From; b=dn70YW0M9ssb/J9z8PJTEF/X0f3QFKqnqiqc7iUvA/A0q4tSeIUqK3L/dkN+pCA/b iWRlPBmnaCDiALbUZhRn4DzgjDVSmB4162ASGs8jRksb6VgR7AqgnZskHLVo92xyWo fJSS49QGVA4/rRIRTpESeclJIf28+ev6MWIKd9tI= Received: from [93.190.126.19] (mx1.investici.org [93.190.126.19]) (Authenticated sender: goodoldpaul@autistici.org) by localhost (Postfix) with ESMTPSA id 4SJGjH2lvNz10y8; Sun, 29 Oct 2023 13:00:35 +0000 (UTC) From: Giacomo Leidi To: 60521@debbugs.gnu.org Subject: [PATCH v4] home: Add home-dotfiles-service. Date: Sun, 29 Oct 2023 13:59:26 +0100 Message-ID: X-Mailer: git-send-email 2.41.0 MIME-Version: 1.0 X-Debbugs-Cc: ( , Andrew Tropin , Ludovic Courtès Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 60521 Cc: Giacomo Leidi X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) * gnu/home/services.scm (dotfiles-for-app): New variable; (home-dotfiles-configuration): new variable; (home-dotfiles-service-type): new variable. * doc/guix.texi: Document it. --- doc/guix.texi | 108 ++++++++++++++++++++++++++++++++++++++++++ gnu/home/services.scm | 79 ++++++++++++++++++++++++++++++ 2 files changed, 187 insertions(+) diff --git a/doc/guix.texi b/doc/guix.texi index b90078be06..7ef75d09da 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -43502,6 +43502,114 @@ Essential Home Services read-only home. Feel free to experiment and share your results. @end defvar +It is often the case that Guix Home users already have a setup for versioning +their user configuration files (also known as @emph{dotfiles}) in a single +directory, and some way of automatically deploy changes to their user home. + +The @code{home-dotfiles-service-type} is designed to ease the way into using +Guix Home for this kind of users, allowing them to point the service to their +dotfiles directory, which must follow the layout suggested by +@uref{https://www.gnu.org/software/stow/, GNU Stow}, +and have their dotfiles automatically deployed to their user home, without +migrating them to Guix native configurations. + +The dotfiles directory layout is expected to be structured as follows. Please +keep in mind that it is advisable to keep your dotfiles directories under +version control, for example in the same repository where you'd track your +Guix Home configuration. + +@example +~$ tree -a .dotfiles/ +.dotfiles/ +├── git +│ └── .gitconfig +├── gpg +│ └── .gnupg +│ ├── gpg-agent.conf +│ └── gpg.conf +├── guile +│ └── .guile +├── guix +│ └── .config +│ └── guix +│ └── channels.scm +├── nix +│ ├── .config +│ │ └── nixpkgs +│ │ └── config.nix +│ └── .nix-channels +├── tmux +│ └── .tmux.conf +└── vim + └── .vimrc + +13 directories, 10 files +@end example + +For an informal specification please refer to the Stow manual +(@pxref{Top,,, stow, Introduction}). A suitable configuration would then +be: + +@lisp +(use-modules (guix utils)) + +(home-environment + + [...] + + (services + (service home-dotfiles-service-type + (home-dotfiles-configuration + (directories + (list (string-append (current-source-directory) + "/.dotfiles"))))))) +@end lisp + +The expected home directory state would be: + +@example +. +├── .config +│ ├── guix +│ │ └── channels.scm +│ └── nixpkgs +│ └── config.nix +├── .gitconfig +├── .gnupg +│ ├── gpg-agent.conf +│ └── gpg.conf +├── .guile +├── .nix-channels +├── .tmux.conf +└── .vimrc +@end example + +@defvar home-dotfiles-service-type +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 users that already track their dotfiles under some kind of version +control. This service allows users to point Guix Home to their dotfiles +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. +@end defvar + +@deftp {Data Type} home-dotfiles-configuration +Available @code{home-dotfiles-configuration} fields are: + +@table @asis +@item @code{directories} (type: list-of-strings) +The list of dotfiles directories where @code{home-dotfiles-service-type} will +look for application dotfiles. + +@item @code{exclude} (default: @code{'(".*~" ".*\\.swp" "\\.git" "\\.gitignore")}) +The list of file patterns @code{home-dotfiles-service-type} will exclude while +visiting each one of the @code{directories}. + +@end table + +@end deftp + @defvar home-xdg-configuration-files-service-type The service is very similar 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 44f585aff5..ff649e9612 100644 --- a/gnu/home/services.scm +++ b/gnu/home/services.scm @@ -3,6 +3,7 @@ ;;; Copyright © 2021 Xinglu Chen ;;; Copyright © 2022-2023 Ludovic Courtès ;;; Copyright © 2023 Carlo Zancanaro +;;; Copyright © 2023 Giacomo Leidi ;;; ;;; This file is part of GNU Guix. ;;; @@ -23,6 +24,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) @@ -35,15 +37,24 @@ (define-module (gnu home services) #:use-module (guix i18n) #:use-module (guix modules) #:use-module (guix memoization) + #:use-module (guix records) #:use-module (srfi srfi-1) #:use-module (srfi srfi-9) + #:use-module (ice-9 ftw) #:use-module (ice-9 match) + #:use-module (ice-9 regex) + #: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-dotfiles-service-type + home-dotfiles-configuration + home-dotfiles-configuration? + home-dotfiles-configuration-directories + home-dotfiles-configuration-excluded home-xdg-configuration-files-service-type home-xdg-data-files-service-type home-run-on-first-login-service-type @@ -355,6 +366,74 @@ (define home-files-service-type (description "Files that will be put in @file{~/.guix-home/files}, and further processed during activation."))) +(define %home-dotfiles-excluded + '(".*~" + ".*\\.swp" + "\\.git" + "\\.gitignore")) + +(define-record-type* + home-dotfiles-configuration make-home-dotfiles-configuration + home-dotfiles-configuration? + (directories home-dotfiles-configuration-directories ;list of strings + (default '())) + (excluded home-dotfiles-configuration-excluded ;list of strings + (default %home-dotfiles-excluded))) + +(define* (import-dotfiles directory excluded) + "Return a list of objects compatible with @code{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 DIRECTORY and mapping its contents to the +user's home directory, excluding files that match any of the patterns in EXCLUDED." + (define filtered + (find-files directory + (lambda (file stat) + (not (string-match + (string-append + "^.*(" (string-join excluded "|") ")$") file))))) + (define (strip file) + (string-drop file (+ 1 (string-length directory)))) + (define (format file) + (string-append "home-dotfiles-" + (string-replace-substring file "/" "-"))) + + (map (lambda (file) + (let* ((stripped (strip file))) + (list stripped + (local-file file (format stripped))))) + filtered)) + +(define (home-dotfiles-configuration->files config) + "Return a list of objects compatible with @code{home-files-service-type}'s +value, generated following GNU Stow's algorithm for each of the +directories in CONFIG, excluding files that match any of the patterns configured." + (define (directory-contents directories) + (append-map + (lambda (directory) + (map + (lambda (content) + (with-directory-excursion directory + (canonicalize-path content))) + (scandir directory + (lambda (name) + (not (member name '("." ".."))))))) + directories)) + (append-map + (lambda (app) + (import-dotfiles app (home-dotfiles-configuration-excluded config))) + (directory-contents + (home-dotfiles-configuration-directories config)))) + +(define-public home-dotfiles-service-type + (service-type (name 'home-dotfiles) + (extensions + (list (service-extension home-files-service-type + home-dotfiles-configuration->files))) + (default-value (home-dotfiles-configuration)) + (description "Files that will be put in the user's home directory +following GNU Stow's algorithm, and further processed during activation."))) + (define xdg-configuration-files-directory ".config") (define (xdg-configuration-files files) base-commit: 2b5c6e1a41e4ddcf4cfa53a319ed784a856eac5d -- 2.41.0 From debbugs-submit-bounces@debbugs.gnu.org Sun Nov 05 19:56:32 2023 Received: (at 60521) by debbugs.gnu.org; 6 Nov 2023 00:56:32 +0000 Received: from localhost ([127.0.0.1]:38440 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qznup-0001LD-TC for submit@debbugs.gnu.org; Sun, 05 Nov 2023 19:56:32 -0500 Received: from m12.mail.163.com ([220.181.12.215]:33728) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qznum-0001Kz-0y for 60521@debbugs.gnu.org; Sun, 05 Nov 2023 19:56:30 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:Subject:Date:Message-ID:MIME-Version: Content-Type; bh=ecO5JPZ3GYEd0YxDwUqPzeSamJCOkqULbsyUFJ98jiM=; b=aPujLLihT3+zFLSr7fENjHDo9e25MgWSSU9+QHWVzqm6VlQIgoP1TNJrsEcdul 9pYQyRJmReOq88r79j+C8k2H/EkOy7Jmb6pBm6+vXR11r8Fp+h3f9gkhbY+wcAy1 ufJUJN74qO2wqBPzQteNjWkwy/RMuhRuIZEP/pbB5iqd0= Received: from Tumashu (unknown [218.92.14.78]) by zwqz-smtp-mta-g5-3 (Coremail) with SMTP id _____wBnT4WKOUhlkE+9CQ--.17431S2; Mon, 06 Nov 2023 08:55:39 +0800 (CST) From: Feng Shu To: 60521@debbugs.gnu.org Subject: [PATCH] home: Add home-stow-migration-service. Date: Mon, 06 Nov 2023 08:55:38 +0800 Message-ID: <87a5rrk8dx.fsf@163.com> MIME-Version: 1.0 Content-Type: text/plain X-CM-TRANSID: _____wBnT4WKOUhlkE+9CQ--.17431S2 X-Coremail-Antispam: 1Uf129KBjDUn29KB7ZKAUJUUUUU529EdanIXcx71UUUUU7v73 VFW2AGmfu7bjvjm3AaLaJ3UbIYCTnIWIevJa73UjIFyTuYvjxUnBMNDUUUU X-Originating-IP: [218.92.14.78] X-CM-SenderInfo: 5wxpt2lkx6il2tof0z/xtbBEQEg1FaEQvlRfAAAsg X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 60521 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) This feature is very useful for me, thanks very much. I have faced a small bug when try it. if a softlink to direcory in dotfiles dir, it will show error, softlink to file have not this problem. ``` dotfiles rime .config/ibus/rime .emacs.d/rime -> ../.config/ibus/rime ``` From debbugs-submit-bounces@debbugs.gnu.org Tue Nov 07 03:59:22 2023 Received: (at 60521) by debbugs.gnu.org; 7 Nov 2023 08:59:22 +0000 Received: from localhost ([127.0.0.1]:41293 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r0Hve-0002ad-6g for submit@debbugs.gnu.org; Tue, 07 Nov 2023 03:59:22 -0500 Received: from m12.mail.163.com ([220.181.12.214]:43746) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r0Hva-0002aN-8N for 60521@debbugs.gnu.org; Tue, 07 Nov 2023 03:59:20 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:Subject:Date:Message-ID:MIME-Version: Content-Type; bh=fdXV7UBSVa30VziifRDfzgN5iFHODtp5gvfB8pXFPoE=; b=oKYT8KyB8GDKT6v19xaG0xfPCTUogZvM6s7/RHl2/FIu8xjmswrqHFX7gsIXL8 a+mYlEu0BMIO0uLEOBycjY4Q+ZabNlEG3lib7IEwti5JMXYXxqwV2PPqsQqNB/Yq XcPLA0WpKQyZTtl7TpcZx1JHmktXXw6xcNBc1BoaKX3ww= Received: from Tumashu (unknown [218.92.14.78]) by zwqz-smtp-mta-g4-0 (Coremail) with SMTP id _____wDXXwY0_EllVDAFCg--.2130S2; Tue, 07 Nov 2023 16:58:28 +0800 (CST) From: Feng Shu To: 60521@debbugs.gnu.org Subject: [PATCH] home: Add home-stow-migration-service. Date: Tue, 07 Nov 2023 16:58:28 +0800 Message-ID: <87ttpyueh7.fsf@163.com> MIME-Version: 1.0 Content-Type: text/plain X-CM-TRANSID: _____wDXXwY0_EllVDAFCg--.2130S2 X-Coremail-Antispam: 1Uf129KBjDUn29KB7ZKAUJUUUUU529EdanIXcx71UUUUU7v73 VFW2AGmfu7bjvjm3AaLaJ3UbIYCTnIWIevJa73UjIFyTuYvjxUeeOGUUUUU X-Originating-IP: [218.92.14.78] X-CM-SenderInfo: 5wxpt2lkx6il2tof0z/1tbiRQQh1GDu2xY6JgAAsr X-Spam-Score: 1.3 (+) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Another small issue is that filename with space can not be handle properly :-) Content analysis details: (1.3 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 1.3 RCVD_IN_VALIDITY_RPBL RBL: Relay in Validity RPBL, https://senderscore.org/blocklistlookup/ [220.181.12.214 listed in bl.score.senderscore.com] -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [220.181.12.214 listed in list.dnswl.org] 0.0 RCVD_IN_MSPIKE_L4 RBL: Bad reputation (-4) [220.181.12.214 listed in bl.mailspike.net] 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (tumashu[at]163.com) 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record 0.0 RCVD_IN_MSPIKE_BL Mailspike blocklisted X-Debbugs-Envelope-To: 60521 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.3 (/) Another small issue is that filename with space can not be handle properly :-) From debbugs-submit-bounces@debbugs.gnu.org Wed Nov 08 20:00:32 2023 Received: (at 60521) by debbugs.gnu.org; 9 Nov 2023 01:00:32 +0000 Received: from localhost ([127.0.0.1]:46464 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r0tPM-0002vg-8X for submit@debbugs.gnu.org; Wed, 08 Nov 2023 20:00:32 -0500 Received: from m12.mail.163.com ([220.181.12.216]:42200) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r0tPH-0002vN-Pz for 60521@debbugs.gnu.org; Wed, 08 Nov 2023 20:00:30 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:Subject:Date:Message-ID:MIME-Version: Content-Type; bh=VeL07Q3TdxbRLYg8Yl+NVc0FE+pZe7UK2uyDagFYvz8=; b=SfmkgxlepkhuJ7LSzZmlQ2zWDPb3V+PNORvMaNMRYiLHPvkadZPTtA7nO8UJtX otqzMZayRQqQP84w4WJRZckLKAaJ/hgsws07FYadSAA9fL9/UNPf1h2wNUuI7ikx WYH7+7OJ9JEn5yQj3AIwpgITY/SVZAFp0OPOgIVYvOJ6c= Received: from Tumashu (unknown [218.92.14.78]) by zwqz-smtp-mta-g4-2 (Coremail) with SMTP id _____wAHR778LkxlnLW8Cg--.15097S2; Thu, 09 Nov 2023 08:59:41 +0800 (CST) From: Feng Shu To: 60521@debbugs.gnu.org Subject: [PATCH] home: Add home-stow-migration-service. Date: Thu, 09 Nov 2023 08:59:40 +0800 Message-ID: <87zfznd9mr.fsf@163.com> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-CM-TRANSID: _____wAHR778LkxlnLW8Cg--.15097S2 X-Coremail-Antispam: 1Uf129KBjDUn29KB7ZKAUJUUUUU529EdanIXcx71UUUUU7v73 VFW2AGmfu7bjvjm3AaLaJ3UbIYCTnIWIevJa73UjIFyTuYvjxUeeOGUUUUU X-Originating-IP: [218.92.14.78] X-CM-SenderInfo: 5wxpt2lkx6il2tof0z/xtbBEQsi1FaEQz-1mgABss X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 60521 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Hello, What about add template feature to home-dotfiles-service-type. for example, if I have a stow file like below. .Xresources ``` xft.dpi: $MYDPI ``` I can config home-dotfiles-service-type to replace $MYDPI to a value. maybe we can add a converter argument and let user define a converter function to handle all text file before local-file. -- From debbugs-submit-bounces@debbugs.gnu.org Sun Jan 21 12:06:31 2024 Received: (at 60521) by debbugs.gnu.org; 21 Jan 2024 17:06:31 +0000 Received: from localhost ([127.0.0.1]:38886 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rRbHD-00087D-6O for submit@debbugs.gnu.org; Sun, 21 Jan 2024 12:06:31 -0500 Received: from confino.investici.org ([2a11:7980:1::2:0]:49061) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rRbH8-00086t-Rr for 60521@debbugs.gnu.org; Sun, 21 Jan 2024 12:06:30 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=autistici.org; s=stigmate; t=1705856780; bh=XBDCE83rBSNEouUY2n8MaKpIR8xnulyzP3AKgmH4Ccg=; h=Date:Subject:From:To:References:In-Reply-To:From; b=a8z4kccT2FNM0LZtsvZyGmH7iNYgSEPdFlglXMuvcSRURYBaH+c7EZmvBgJ+NXH3h gyE+Z1JLWcc6I//Cn4TbkD3YaciDN4rMx0IEnMCkx/EuKVj1IiEYWanEgj+ijyjXsv 0obKv4LA4dQiHz68NiWJCFS7kiEErJJCSv5rnd/0= Received: from mx1.investici.org (unknown [127.0.0.1]) by confino.investici.org (Postfix) with ESMTP id 4TJ0B430v1z114B; Sun, 21 Jan 2024 17:06:20 +0000 (UTC) Received: from [93.190.126.19] (mx1.investici.org [93.190.126.19]) (Authenticated sender: goodoldpaul@autistici.org) by localhost (Postfix) with ESMTPSA id 4TJ0B41Kbfz1129; Sun, 21 Jan 2024 17:06:20 +0000 (UTC) Content-Type: multipart/alternative; boundary="------------mlGca0QO9yRtENQBAlOwHKxA" Message-ID: <2882eccf-000b-3db4-b2da-2dcb5c68e8ff@autistici.org> Date: Sun, 21 Jan 2024 18:06:19 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.15.0 Subject: Re: [60521] Add home-dotfiles-service-type - Rebased on master Content-Language: en-US From: paul To: 60521@debbugs.gnu.org, tumashu@163.com References: <0a34b882-cb82-cbb2-50fe-f85725acf024@autistici.org> In-Reply-To: <0a34b882-cb82-cbb2-50fe-f85725acf024@autistici.org> X-Spam-Score: -3.1 (---) X-Debbugs-Envelope-To: 60521 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -4.1 (----) This is a multi-part message in MIME format. --------------mlGca0QO9yRtENQBAlOwHKxA Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Hello Feng Shu, Apologies for the delay. I fixed the bug you pointed out for symlinks and spaces in file names. Thank you for catching them! About templating I would suggest you to use mixed-text-file or computed file from (guix gexp) and pass them directly to them home-files-service-type. It is possible to use it together with home-dotfiles-service-type. giacomo --------------mlGca0QO9yRtENQBAlOwHKxA Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 7bit

Hello Feng Shu,

Apologies for the delay. I fixed the bug you pointed out for symlinks and spaces in file names. Thank you for catching them!

About templating I would suggest you to use mixed-text-file or computed file from (guix gexp) and pass them directly to them home-files-service-type. It is possible to use it together with home-dotfiles-service-type.

giacomo

--------------mlGca0QO9yRtENQBAlOwHKxA-- From debbugs-submit-bounces@debbugs.gnu.org Sun Jan 21 12:07:25 2024 Received: (at 60521) by debbugs.gnu.org; 21 Jan 2024 17:07:26 +0000 Received: from localhost ([127.0.0.1]:38892 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rRbI5-00089h-JL for submit@debbugs.gnu.org; Sun, 21 Jan 2024 12:07:25 -0500 Received: from confino.investici.org ([2a11:7980:1::2:0]:41469) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rRbI3-00089T-As for 60521@debbugs.gnu.org; Sun, 21 Jan 2024 12:07:23 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=autistici.org; s=stigmate; t=1705856839; bh=waOqm32M+lg7y8pAtA8EP/89aTgNdDhrVfQqax+60M4=; h=Date:Subject:From:To:Cc:References:In-Reply-To:From; b=t7nxmyfUw7/SkVEsKPskOElaEbVAGnUX3ixmixvEBXaUC94ryTeYnMT8naaXoqYus E/AyXm+fR7cOz0mxDpfD9WlprLewQz7E+/+IvzHbVUXQXs2Q+DnjoKj4ZG7lL9nbMb 21EqPfXp9dpF0d9rEA5IkAwYlX18WcRa/2fT1BBM= Received: from mx1.investici.org (unknown [127.0.0.1]) by confino.investici.org (Postfix) with ESMTP id 4TJ0CC0fLJz1117; Sun, 21 Jan 2024 17:07:19 +0000 (UTC) Received: from [93.190.126.19] (mx1.investici.org [93.190.126.19]) (Authenticated sender: goodoldpaul@autistici.org) by localhost (Postfix) with ESMTPSA id 4TJ0CB6Ncqz110Q; Sun, 21 Jan 2024 17:07:18 +0000 (UTC) Message-ID: Date: Sun, 21 Jan 2024 18:07:18 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.15.0 Subject: Re: [60521] Add home-dotfiles-service-type - Rebased on master Content-Language: en-US From: paul To: 60521@debbugs.gnu.org References: <0a34b882-cb82-cbb2-50fe-f85725acf024@autistici.org> In-Reply-To: <0a34b882-cb82-cbb2-50fe-f85725acf024@autistici.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: -3.1 (---) X-Debbugs-Envelope-To: 60521 Cc: tumashu@163.com, =?UTF-8?Q?Ludovic_Court=c3=a8s?= , mirai@makinata.eu, andrew@trop.in X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -4.1 (----) Hello, I'm sending an updated patchset rebased on current master. Thank you for your time, giacomo From debbugs-submit-bounces@debbugs.gnu.org Sun Jan 21 12:08:41 2024 Received: (at 60521) by debbugs.gnu.org; 21 Jan 2024 17:08:41 +0000 Received: from localhost ([127.0.0.1]:38896 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rRbJJ-0008Bx-06 for submit@debbugs.gnu.org; Sun, 21 Jan 2024 12:08:41 -0500 Received: from confino.investici.org ([2a11:7980:1::2:0]:43207) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rRbJG-0008Bp-C5 for 60521@debbugs.gnu.org; Sun, 21 Jan 2024 12:08:39 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=autistici.org; s=stigmate; t=1705856914; bh=pgtGrbvs+ZVcbJ0mF03fAvWJjRjdiJjq8DNRs7Cg3dg=; h=From:To:Cc:Subject:Date:From; b=bxOle/5ARKEwESmBW3Mn1O9y+Mh0VQMM1cydDBDssM+YXNUuK8IkxiUqNDReFB8cz mqIaihj9AI7pSxGaMp6JYY+gUAephyOlAF92vGW3uqd11tyBiBgJpEZjSShWkyH0LK FVhyVwtAwP0CYNBz1652duisqpVpMdtP5K01zvdE= Received: from mx1.investici.org (unknown [127.0.0.1]) by confino.investici.org (Postfix) with ESMTP id 4TJ0Df1jhPz114B; Sun, 21 Jan 2024 17:08:34 +0000 (UTC) Received: from [93.190.126.19] (mx1.investici.org [93.190.126.19]) (Authenticated sender: goodoldpaul@autistici.org) by localhost (Postfix) with ESMTPSA id 4TJ0Df0sQsz1117; Sun, 21 Jan 2024 17:08:34 +0000 (UTC) From: Giacomo Leidi To: 60521@debbugs.gnu.org Subject: [PATCH v5] home: Add home-dotfiles-service. Date: Sun, 21 Jan 2024 18:08:01 +0100 Message-ID: <20240121170802.13719-1-goodoldpaul@autistici.org> X-Mailer: git-send-email 2.41.0 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 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) * gnu/home/services.scm (dotfiles-for-app): New variable; (home-dotfiles-configuration): new variable; (home-dotfiles-service-type): new variable. * doc/guix.texi: Document it. --- doc/guix.texi | 108 ++++++++++++++++++++++++++++++++++++++++++ gnu/home/services.scm | 88 ++++++++++++++++++++++++++++++++++ 2 files changed, 196 insertions(+) diff --git a/doc/guix.texi b/doc/guix.texi index ac17f91f7d..68697a041e 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -43961,6 +43961,114 @@ to use alternative services to implement more advanced use cases like read-only home. Feel free to experiment and share your results. @end defvar +It is often the case that Guix Home users already have a setup for versioning +their user configuration files (also known as @emph{dotfiles}) in a single +directory, and some way of automatically deploy changes to their user home. + +The @code{home-dotfiles-service-type} is designed to ease the way into using +Guix Home for this kind of users, allowing them to point the service to their +dotfiles directory, which must follow the layout suggested by +@uref{https://www.gnu.org/software/stow/, GNU Stow}, +and have their dotfiles automatically deployed to their user home, without +migrating them to Guix native configurations. + +The dotfiles directory layout is expected to be structured as follows. Please +keep in mind that it is advisable to keep your dotfiles directories under +version control, for example in the same repository where you'd track your +Guix Home configuration. + +@example +~$ tree -a .dotfiles/ +.dotfiles/ +├── git +│ └── .gitconfig +├── gpg +│ └── .gnupg +│ ├── gpg-agent.conf +│ └── gpg.conf +├── guile +│ └── .guile +├── guix +│ └── .config +│ └── guix +│ └── channels.scm +├── nix +│ ├── .config +│ │ └── nixpkgs +│ │ └── config.nix +│ └── .nix-channels +├── tmux +│ └── .tmux.conf +└── vim + └── .vimrc + +13 directories, 10 files +@end example + +For an informal specification please refer to the Stow manual +(@pxref{Top,,, stow, Introduction}). A suitable configuration would then +be: + +@lisp +(use-modules (guix utils)) + +(home-environment + + [...] + + (services + (service home-dotfiles-service-type + (home-dotfiles-configuration + (directories + (list (string-append (current-source-directory) + "/.dotfiles"))))))) +@end lisp + +The expected home directory state would be: + +@example +. +├── .config +│ ├── guix +│ │ └── channels.scm +│ └── nixpkgs +│ └── config.nix +├── .gitconfig +├── .gnupg +│ ├── gpg-agent.conf +│ └── gpg.conf +├── .guile +├── .nix-channels +├── .tmux.conf +└── .vimrc +@end example + +@defvar home-dotfiles-service-type +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 users that already track their dotfiles under some kind of version +control. This service allows users to point Guix Home to their dotfiles +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. +@end defvar + +@deftp {Data Type} home-dotfiles-configuration +Available @code{home-dotfiles-configuration} fields are: + +@table @asis +@item @code{directories} (type: list-of-strings) +The list of dotfiles directories where @code{home-dotfiles-service-type} will +look for application dotfiles. + +@item @code{exclude} (default: @code{'(".*~" ".*\\.swp" "\\.git" "\\.gitignore")}) +The list of file patterns @code{home-dotfiles-service-type} will exclude while +visiting each one of the @code{directories}. + +@end table + +@end deftp + @defvar home-xdg-configuration-files-service-type The service is very similar 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 44f585aff5..aece51cde4 100644 --- a/gnu/home/services.scm +++ b/gnu/home/services.scm @@ -3,6 +3,7 @@ ;;; Copyright © 2021 Xinglu Chen ;;; Copyright © 2022-2023 Ludovic Courtès ;;; Copyright © 2023 Carlo Zancanaro +;;; Copyright © 2023 Giacomo Leidi ;;; ;;; This file is part of GNU Guix. ;;; @@ -23,6 +24,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) @@ -35,15 +37,24 @@ (define-module (gnu home services) #:use-module (guix i18n) #:use-module (guix modules) #:use-module (guix memoization) + #:use-module (guix records) #:use-module (srfi srfi-1) #:use-module (srfi srfi-9) + #:use-module (ice-9 ftw) #:use-module (ice-9 match) + #:use-module (ice-9 regex) + #: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-dotfiles-service-type + home-dotfiles-configuration + home-dotfiles-configuration? + home-dotfiles-configuration-directories + home-dotfiles-configuration-excluded home-xdg-configuration-files-service-type home-xdg-data-files-service-type home-run-on-first-login-service-type @@ -355,6 +366,83 @@ (define home-files-service-type (description "Files that will be put in @file{~/.guix-home/files}, and further processed during activation."))) +(define %home-dotfiles-excluded + '(".*~" + ".*\\.swp" + "\\.git" + "\\.gitignore")) + +(define-record-type* + home-dotfiles-configuration make-home-dotfiles-configuration + home-dotfiles-configuration? + (directories home-dotfiles-configuration-directories ;list of strings + (default '())) + (excluded home-dotfiles-configuration-excluded ;list of strings + (default %home-dotfiles-excluded))) + +(define* (import-dotfiles directory excluded) + "Return a list of objects compatible with @code{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 DIRECTORY and mapping its contents to the +user's home directory, excluding files that match any of the patterns in EXCLUDED." + (define filtered + (find-files directory + (lambda (file stat) + (not (string-match + (string-append + "^.*(" (string-join excluded "|") ")$") file))))) + (define (strip file) + (string-drop file (+ 1 (string-length directory)))) + (define (resolve file) + (if (eq? 'symlink (stat:type (lstat file))) + (let ((resolved (readlink file))) + (with-directory-excursion (dirname file) + (canonicalize-path resolved))) + file)) + (define (format file) + (let* ((without-spaces + (string-replace-substring file " " "_")) + (without-slashes-and-spaces + (string-replace-substring without-spaces "/" "-"))) + (string-append "home-dotfiles-" without-slashes-and-spaces))) + + (map (lambda (file) + (let* ((stripped (strip file))) + (list stripped + (local-file (resolve file) (format stripped))))) + filtered)) + +(define (home-dotfiles-configuration->files config) + "Return a list of objects compatible with @code{home-files-service-type}'s +value, generated following GNU Stow's algorithm for each of the +directories in CONFIG, excluding files that match any of the patterns configured." + (define (directory-contents directories) + (append-map + (lambda (directory) + (map + (lambda (content) + (with-directory-excursion directory + (canonicalize-path content))) + (scandir directory + (lambda (name) + (not (member name '("." ".."))))))) + directories)) + (append-map + (lambda (app) + (import-dotfiles app (home-dotfiles-configuration-excluded config))) + (directory-contents + (home-dotfiles-configuration-directories config)))) + +(define-public home-dotfiles-service-type + (service-type (name 'home-dotfiles) + (extensions + (list (service-extension home-files-service-type + home-dotfiles-configuration->files))) + (default-value (home-dotfiles-configuration)) + (description "Files that will be put in the user's home directory +following GNU Stow's algorithm, and further processed during activation."))) + (define xdg-configuration-files-directory ".config") (define (xdg-configuration-files files) base-commit: 121de47decc1029c06f6e46e5f06d7fefe8e85ec -- 2.41.0 From debbugs-submit-bounces@debbugs.gnu.org Sun Jan 21 19:16:31 2024 Received: (at 60521) by debbugs.gnu.org; 22 Jan 2024 00:16:31 +0000 Received: from localhost ([127.0.0.1]:39419 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rRhzL-0005kW-61 for submit@debbugs.gnu.org; Sun, 21 Jan 2024 19:16:31 -0500 Received: from m15.mail.163.com ([45.254.50.220]:34628) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rRhzH-0005jf-DR for 60521@debbugs.gnu.org; Sun, 21 Jan 2024 19:16:30 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=Date:From:Subject:Content-Type:MIME-Version: Message-ID; bh=MUbvq8b1K6FXcrudWC0EE2qQ+bHZ3Pb61L0BrA9jbCQ=; b=d Z/16+naMjltJCy2qh9OeOhGgU5amqIzFbZRNB1SxTvJtaMT642xhmsqQkRl7DtZR of8C+RAc8qbgYngeuNCr5i5qLMcJXKvbscJkRLUxPQn+rDVVnL/t/zh2Z8XDwIMj KlCAdxKYMSLW4OV/svWRJ8m1MbPuM4VxUelWuNVQ6I= Received: from tumashu$163.com ( [49.94.116.154] ) by ajax-webmail-wmsvr-40-109 (Coremail) ; Mon, 22 Jan 2024 08:16:03 +0800 (CST) X-Originating-IP: [49.94.116.154] Date: Mon, 22 Jan 2024 08:16:03 +0800 (CST) From: tumashu To: paul Subject: Re:Re: [60521] Add home-dotfiles-service-type - Rebased on master X-Priority: 3 X-Mailer: Coremail Webmail Server Version XT5.0.14 build 20230109(dcb5de15) Copyright (c) 2002-2024 www.mailtech.cn 163com In-Reply-To: <2882eccf-000b-3db4-b2da-2dcb5c68e8ff@autistici.org> References: <0a34b882-cb82-cbb2-50fe-f85725acf024@autistici.org> <2882eccf-000b-3db4-b2da-2dcb5c68e8ff@autistici.org> X-NTES-SC: AL_Qu2bB/STvU0t5SCfYulS4DNV75VWJb7wwZl5mfkQfOIQvCTExzAJRXpgPnDY4O4nS+bUTC0yvtd744wIQMzm Content-Type: multipart/alternative; boundary="----=_Part_6799_361085714.1705882563083" MIME-Version: 1.0 Message-ID: <1dfe3e4f.1d9.18d2e86320b.Coremail.tumashu@163.com> X-Coremail-Locale: zh_CN X-CM-TRANSID: _____wD337nDs61lWKZhAA--.41648W X-CM-SenderInfo: 5wxpt2lkx6il2tof0z/1tbiSg9s1GVOA5XkggACsk X-Coremail-Antispam: 1U5529EdanIXcx71UUUUU7vcSsGvfC2KfnxnUU== X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 60521 Cc: 60521@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) ------=_Part_6799_361085714.1705882563083 Content-Type: text/plain; charset=gbk Content-Transfer-Encoding: base64 ICAgICAgSXQgaXMgcG9zc2libGUgdG8gdXNlIGl0IHRvZ2V0aGVyIHdpdGggaG9tZS1kb3RmaWxl cy0gIHNlcnZpY2UtdHlwZS4KCgpjYW4geW91IGdpdmUgYSBzaW1wbGUgZXhhbXBsZaO/IHRoYW5r cwoKCgoKCgotLQq3otfUztK1xM340tfTys/kyta7+tbHxNyw5goKCgrU2iAyMDI0LTAxLTIyIDAx OjA2OjE5o6xwYXVsIDxnb29kb2xkcGF1bEBhdXRpc3RpY2kub3JnPiDQtLXAo7oKCgpIZWxsbyBG ZW5nIFNodSwKCkFwb2xvZ2llcyBmb3IgdGhlIGRlbGF5LiBJIGZpeGVkIHRoZSBidWcgeW91IHBv aW50ZWQgb3V0IGZvciBzeW1saW5rcyBhbmQgc3BhY2VzIGluIGZpbGUgbmFtZXMuIFRoYW5rIHlv dSBmb3IgY2F0Y2hpbmcgdGhlbSEKCkFib3V0IHRlbXBsYXRpbmcgSSB3b3VsZCBzdWdnZXN0IHlv dSB0byB1c2UgbWl4ZWQtdGV4dC1maWxlIG9yIGNvbXB1dGVkIGZpbGUgZnJvbSAoZ3VpeCBnZXhw KSBhbmQgcGFzcyB0aGVtIGRpcmVjdGx5IHRvIHRoZW0gaG9tZS1maWxlcy1zZXJ2aWNlLXR5cGUu IEl0IGlzIHBvc3NpYmxlIHRvIHVzZSBpdCB0b2dldGhlciB3aXRoIGhvbWUtZG90ZmlsZXMtc2Vy dmljZS10eXBlLgoKCgoKCgoKCmdpYWNvbW8K ------=_Part_6799_361085714.1705882563083 Content-Type: text/html; charset=gbk Content-Transfer-Encoding: base64 PGRpdj48c3BhbiBjbGFzcz0iYWRkcmVzcyI+Jm5ic3A7Jm5ic3A7Jm5ic3A7Jm5ic3A7Jm5ic3A7 IEl0IGlzIHBvc3NpYmxlIHRvIHVzZQogICAgICAgIGl0IHRvZ2V0aGVyIHdpdGggaG9tZS1kb3Rm aWxlcy0mbmJzcDsgc2VydmljZS10eXBlLjwvc3Bhbj48L2Rpdj48ZGl2PjxzcGFuIGNsYXNzPSJh ZGRyZXNzIj48YnI+PC9zcGFuPjwvZGl2PjxkaXY+PHNwYW4gY2xhc3M9ImFkZHJlc3MiPmNhbiB5 b3UgZ2l2ZSBhIHNpbXBsZSBleGFtcGxlo78gdGhhbmtzPGJyPjwvc3Bhbj48L2Rpdj48YnI+PGJy Pjxicj48YnI+PGRpdiBpZD0ic3BuRWRpdG9yU2lnbl9hcHAiPi0tPGJyPrei19TO0rXEzfjS19PK z+TK1rv61sfE3LDmPC9kaXY+PGJyPjxicj48YnI+1NogMjAyNC0wMS0yMiAwMTowNjoxOaOscGF1 bCZuYnNwOyZsdDtnb29kb2xkcGF1bEBhdXRpc3RpY2kub3JnJmd0OyDQtLXAo7o8YnI+IDxibG9j a3F1b3RlIGlkPSJpc1JlcGx5Q29udGVudCIgc3R5bGU9IlBBRERJTkctTEVGVDogMWV4OyBNQVJH SU46IDBweCAwcHggMHB4IDAuOGV4OyBCT1JERVItTEVGVDogI2NjYyAxcHggc29saWQiPgogIAog ICAgCiAgCiAgCiAgICA8cD5IZWxsbyA8c3BhbiBjbGFzcz0iYWRkcmVzcyI+RmVuZyBTaHUsPC9z cGFuPjwvcD4KICAgIDxwPjxzcGFuIGNsYXNzPSJhZGRyZXNzIj5BcG9sb2dpZXMgZm9yIHRoZSBk ZWxheS4gSSBmaXhlZCB0aGUgYnVnCiAgICAgICAgeW91IHBvaW50ZWQgb3V0IGZvciBzeW1saW5r cyBhbmQgc3BhY2VzIGluIGZpbGUgbmFtZXMuIFRoYW5rIHlvdQogICAgICAgIGZvciBjYXRjaGlu ZyB0aGVtITwvc3Bhbj48L3A+CiAgICA8cD48c3BhbiBjbGFzcz0iYWRkcmVzcyI+QWJvdXQgdGVt cGxhdGluZyBJIHdvdWxkIHN1Z2dlc3QgeW91IHRvIHVzZQogICAgICAgIG1peGVkLXRleHQtZmls ZSBvciBjb21wdXRlZCBmaWxlIGZyb20gKGd1aXggZ2V4cCkgYW5kIHBhc3MgdGhlbQogICAgICAg IGRpcmVjdGx5IHRvIHRoZW0gaG9tZS1maWxlcy1zZXJ2aWNlLXR5cGUuIEl0IGlzIHBvc3NpYmxl IHRvIHVzZQogICAgICAgIGl0IHRvZ2V0aGVyIHdpdGggaG9tZS1kb3RmaWxlcy1zZXJ2aWNlLXR5 cGUuPGJyPjwvc3Bhbj48L3A+PHA+PHNwYW4gY2xhc3M9ImFkZHJlc3MiPjxicj48L3NwYW4+PC9w PjxwPjxzcGFuIGNsYXNzPSJhZGRyZXNzIj48YnI+PC9zcGFuPjwvcD48cD48c3BhbiBjbGFzcz0i YWRkcmVzcyI+Z2lhY29tbzxicj4KICAgICAgPC9zcGFuPjwvcD4KICAKCjwvYmxvY2txdW90ZT4= ------=_Part_6799_361085714.1705882563083-- From debbugs-submit-bounces@debbugs.gnu.org Mon Jan 22 03:12:17 2024 Received: (at 60521) by debbugs.gnu.org; 22 Jan 2024 08:12:17 +0000 Received: from localhost ([127.0.0.1]:39837 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rRpPj-0005RS-Vs for submit@debbugs.gnu.org; Mon, 22 Jan 2024 03:12:17 -0500 Received: from confino.investici.org ([2a11:7980:1::2:0]:50835) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rRpPd-0005RC-VX for 60521@debbugs.gnu.org; Mon, 22 Jan 2024 03:12:14 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=autistici.org; s=stigmate; t=1705911122; bh=CERFDIuZ/GjGeypG3oTMqyVJ4QijFAQRjpysl4hNibg=; h=Date:From:To:CC:Subject:In-Reply-To:References:From; b=fpwlvlKeC6jYokxdrs6DaMhK+s1ttdmDE76Ov0iGrH5rdZRnOPzUJ4jpWLcWCiObi icbN7uEcBpmDMSEP0umkaXDPBBqTGNubXH/0lJ+cXShG2RTYrw82qGXcMCUop9cHhl CultYnRiXeVpsc7ozWmi2E68IFSQUIROUFk2rGUw= Received: from mx1.investici.org (unknown [127.0.0.1]) by confino.investici.org (Postfix) with ESMTP id 4TJNH66pKkz111m; Mon, 22 Jan 2024 08:12:02 +0000 (UTC) Received: from [93.190.126.19] (mx1.investici.org [93.190.126.19]) (Authenticated sender: goodoldpaul@autistici.org) by localhost (Postfix) with ESMTPSA id 4TJNH64YNdz10yy; Mon, 22 Jan 2024 08:12:02 +0000 (UTC) Date: Mon, 22 Jan 2024 09:12:00 +0100 From: Giacomo To: tumashu Subject: Re:Re: [60521] Add home-dotfiles-service-type - Rebased on master User-Agent: K-9 Mail for Android In-Reply-To: <1dfe3e4f.1d9.18d2e86320b.Coremail.tumashu@163.com> References: <0a34b882-cb82-cbb2-50fe-f85725acf024@autistici.org> <2882eccf-000b-3db4-b2da-2dcb5c68e8ff@autistici.org> <1dfe3e4f.1d9.18d2e86320b.Coremail.tumashu@163.com> Message-ID: <772A4BF6-A930-44D6-B0D5-44922FD7908C@autistici.org> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary=----1Y36047XOF8GAI6L4LXJWGKC759NTI Content-Transfer-Encoding: 7bit X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 60521 Cc: 60521@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) ------1Y36047XOF8GAI6L4LXJWGKC759NTI Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hello, This is what I tried in my configuration=2E It should work: (define mydpi "192") (home-environment [=2E=2E=2E] (services (list [=2E=2E=2E] (service home-files-service-type `(("=2EXresources" ,(mixed-text-file "Xresources" "xft=2E= dpi:" mydpi)))) (service home-dotfiles-service-type (home-dotfiles-configuration (directories (list "/home/myself/guix-conf/=2Edotfiles"))))))) Hope this helps, giacomo Il 22 gennaio 2024 01:16:03 CET, tumashu ha scritto: > It is possible to use it together with home-dotfiles- service-type= =2E > > >can you give a simple example=EF=BC=9F thanks > > > > > > >-- >=E5=8F=91=E8=87=AA=E6=88=91=E7=9A=84=E7=BD=91=E6=98=93=E9=82=AE=E7=AE=B1= =E6=89=8B=E6=9C=BA=E6=99=BA=E8=83=BD=E7=89=88 > > > >=E5=9C=A8 2024-01-22 01:06:19=EF=BC=8Cpaul = =E5=86=99=E9=81=93=EF=BC=9A > > >Hello Feng Shu, > >Apologies for the delay=2E I fixed the bug you pointed out for symlinks a= nd spaces in file names=2E Thank you for catching them! > >About templating I would suggest you to use mixed-text-file or computed f= ile from (guix gexp) and pass them directly to them home-files-service-type= =2E It is possible to use it together with home-dotfiles-service-type=2E > > > > > > > > >giacomo ------1Y36047XOF8GAI6L4LXJWGKC759NTI Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable
Hello,

This is what I tri= ed in my configuration=2E It should work:

(define mydpi "192")
(home-environment
[=2E=2E=2E]
(services
=C2=A0 (list
=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 [=2E=2E=2E]
=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0 (service home-files-service-type
=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0 `(("=2EXresources" ,(mixed-text-file "Xresources" "xft=2Edpi:" mydpi= ))))
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (service home-dotfiles-s= ervice-type
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (home-dotfiles-configuration
=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0 (directories
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (l= ist "/home/myself/guix-conf/=2Edotfiles")))))))

Hope this helps,
=
giacomo


Il 22= gennaio 2024 01:16:03 CET, tumashu <tumashu@163=2Ecom> ha scritto:
      It is possible= to use it together with home-dotfiles-  service-type=2E

can you give a simple example=EF=BC=9F thanks



--
=E5=8F=91=E8=87=AA=E6=88=91= =E7=9A=84=E7=BD=91=E6=98=93=E9=82=AE=E7=AE=B1=E6=89=8B=E6=9C=BA=E6=99=BA=E8= =83=BD=E7=89=88



=E5=9C=A8 2024-01-22 01:06:19=EF=BC=8Cpaul=  <goodoldpaul@autistici=2Eorg> =E5=86=99=E9=81=93=EF=BC=9A
<= blockquote id=3D"isReplyContent" style=3D"PADDING-LEFT: 1ex; MARGIN: 0px 0p= x 0px 0=2E8ex; BORDER-LEFT: #ccc 1px solid">

Hello Feng Shu,

Ap= ologies for the delay=2E I fixed the bug you pointed out for symlin= ks and spaces in file names=2E Thank you for catching them!<= /p>

About templating I would suggest you to = use mixed-text-file or computed file from (guix gexp) and pass them= directly to them home-files-service-type=2E It is possible to use = it together with home-dotfiles-service-type=2E



<= /p>

giacomo

------1Y36047XOF8GAI6L4LXJWGKC759NTI-- From debbugs-submit-bounces@debbugs.gnu.org Mon Jan 22 07:37:15 2024 Received: (at 60521) by debbugs.gnu.org; 22 Jan 2024 12:37:15 +0000 Received: from localhost ([127.0.0.1]:40023 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rRtYA-0007ND-P2 for submit@debbugs.gnu.org; Mon, 22 Jan 2024 07:37:15 -0500 Received: from m16.mail.163.com ([220.197.31.4]:50960) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rRtY5-0007My-TC for 60521@debbugs.gnu.org; Mon, 22 Jan 2024 07:37:13 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:Subject:Date:Message-ID:MIME-Version: Content-Type; bh=Ul4zVhwV/FJm1CM0LmgdXzb1g+gg4/PBZa/zaVQ4b7c=; b=XWzxfuP1oFjt/3gI2RxdFRrrasthThouIdoqPL9qAfD2WsPIAE2/R/CMPmVSTW brTQIXT2/o8QIMT2bcQBAhV9+H+p0tS1MzCXK40QhXgxiEH8Koc0lLhkVCbfk4ml 9bDWf9ixTz9gNr0d4QW7vQdOzvALg6HgzwkhXoZbnh7js= Received: from Guix (unknown [49.88.118.123]) by gzga-smtp-mta-g0-0 (Coremail) with SMTP id _____wBHT6FdYa5lZ6ZlAQ--.38250S2; Mon, 22 Jan 2024 20:36:46 +0800 (CST) From: Feng Shu To: paul Subject: Re: [60521] Add home-dotfiles-service-type - Rebased on master In-Reply-To: <2882eccf-000b-3db4-b2da-2dcb5c68e8ff@autistici.org> (paul's message of "Sun, 21 Jan 2024 18:06:19 +0100") References: <0a34b882-cb82-cbb2-50fe-f85725acf024@autistici.org> <2882eccf-000b-3db4-b2da-2dcb5c68e8ff@autistici.org> Date: Mon, 22 Jan 2024 20:36:45 +0800 Message-ID: <87zfwxzgrm.fsf@163.com> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-CM-TRANSID: _____wBHT6FdYa5lZ6ZlAQ--.38250S2 X-Coremail-Antispam: 1Uf129KBjvdXoW7Gr1xKw4fKw1UtFW8XF1kKrg_yoW3CwbE9F 9ava9Fyr1UXa1rGa17Cr4xtFZxJasxJFyrAw4Y9rnIv34SqrZxKF4ktrnYq3y7JrW2kr15 uFs3Xr15twn0vjkaLaAFLSUrUUUUjb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUvcSsGvfC2KfnxnUUI43ZEXa7xRHOJrtUUUUU== X-Originating-IP: [49.88.118.123] X-CM-SenderInfo: 5wxpt2lkx6il2tof0z/1tbiLx9t1GVOBca8GwAAsG X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 60521 Cc: 60521@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) paul writes: > Hello Feng Shu, > > Apologies for the delay. I fixed the bug you pointed out for symlinks and= spaces in file names. Thank you for > catching them! I have tested symlinks like below: =20 feng@Guix ~/geeguix/geehome/dotfiles/rime/.emacs.d$ ls -al drwxr-xr-x 2 feng users 4096 1=E6=9C=8822=E6=97=A5 20:26 ./ drwxr-xr-x 5 feng users 4096 11=E6=9C=88 6=E6=97=A5 19:20 ../ lrwxrwxrwx 1 feng users 20 1=E6=9C=8822=E6=97=A5 20:26 rime -> ../.c= onfig/ibus/rime and ../.config/ibus/rime is a directory, show error: guix home: error: regular file expected > > About templating I would suggest you to use mixed-text-file or computed f= ile from (guix gexp) and pass them > directly to them home-files-service-type. It is possible to use it togeth= er with home-dotfiles-service-type. > > giacomo --=20 From debbugs-submit-bounces@debbugs.gnu.org Mon Jan 22 11:46:01 2024 Received: (at 60521) by debbugs.gnu.org; 22 Jan 2024 16:46:01 +0000 Received: from localhost ([127.0.0.1]:41650 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rRxQu-0000sn-M2 for submit@debbugs.gnu.org; Mon, 22 Jan 2024 11:46:01 -0500 Received: from confino.investici.org ([93.190.126.19]:40907) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rRxQs-0000sU-0K for 60521@debbugs.gnu.org; Mon, 22 Jan 2024 11:46:00 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=autistici.org; s=stigmate; t=1705941951; bh=WyGQe4ktI0bjd4z9SMOB4JNbZmiqWYe5oa/MjyGHfsE=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=B329+JT+8bUbwZ57ki1TKCeM2w1CJsX8Jw4OFUv96wQCoAtwer7DNLTA6LzQX7+ni 2JZMfd1rTrt1DqH5492J672Yqy5QLybh20Yzt7E/7noOAGuNSytIyd6NyhDgG5Pf5l B2fEkyCW6teAE6SrU0fzAsGlDxNf3OV+cEPsHwGE= Received: from mx1.investici.org (unknown [127.0.0.1]) by confino.investici.org (Postfix) with ESMTP id 4TJbgz70hyz111m; Mon, 22 Jan 2024 16:45:51 +0000 (UTC) Received: from [93.190.126.19] (mx1.investici.org [93.190.126.19]) (Authenticated sender: goodoldpaul@autistici.org) by localhost (Postfix) with ESMTPSA id 4TJbgz6CdZz10w9; Mon, 22 Jan 2024 16:45:51 +0000 (UTC) Content-Type: multipart/mixed; boundary="------------wPi2I4chHi7ITwSf4fNnjpYj" Message-ID: <151fb78b-ed1a-e2c0-036d-c927d6c7429d@autistici.org> Date: Mon, 22 Jan 2024 17:45:51 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.15.0 Subject: Re: [60521] Add home-dotfiles-service-type - Rebased on master To: Feng Shu References: <0a34b882-cb82-cbb2-50fe-f85725acf024@autistici.org> <2882eccf-000b-3db4-b2da-2dcb5c68e8ff@autistici.org> <87zfwxzgrm.fsf@163.com> Content-Language: en-US From: paul In-Reply-To: <87zfwxzgrm.fsf@163.com> X-Spam-Score: -3.1 (---) X-Debbugs-Envelope-To: 60521 Cc: 60521@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -4.1 (----) This is a multi-part message in MIME format. --------------wPi2I4chHi7ITwSf4fNnjpYj Content-Type: multipart/alternative; boundary="------------w1pWSecrc2lT96H9jfFVclwN" --------------w1pWSecrc2lT96H9jfFVclwN Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Hello, the following works for me with the attached configuration. $ tree -a . . └── guix-home-project     ├── .dotfiles     │   └── rime     │       ├── .config     │       │   └── ibus     │       └── .emacs.d     └── test-config.scm 7 directories, 1 file $ echo hello > guix-home-project/.dotfiles/rime/.config/ibus/rime $ cd guix-home-project/.dotfiles/rime/.emacs.d/ && ln -s ../.config/ibus/rime ./ $ ls -al total 4 drwxr-xr-x 1 paul users  8 Jan 22 17:37 ./ drwxr-xr-x 1 paul users 30 Jan 22 17:31 ../ lrwxrwxrwx 1 paul users 20 Jan 22 17:37 rime -> ../.config/ibus/rime  $ cd ../.. && guix home container --share=`pwd`/..=$HOME test-config.scm WARNING: (guile-user): imported module (guix build utils) overrides core binding `delete' WARNING: (guile-user): imported module (guix build utils) overrides core binding `delete' Cleaning up symlinks from previous home at /gnu/store/hpnywydkrfygcl2qplxwgypqqwny16x5-home. Removing /home/paul/.profile... done Removing /home/paul/.emacs.d/rime... done Removed /home/paul/.emacs.d. Removing /home/paul/.config/fontconfig/fonts.conf... done Removed /home/paul/.config/fontconfig. Removing /home/paul/.config/ibus/rime... done Removed /home/paul/.config/ibus. Removed /home/paul/.config. Cleanup finished. Symlinking /home/paul/.profile -> /gnu/store/l27r8vj94ggr3na9pb1snizsmvh0zrxl-shell-profile... done Symlinking /home/paul/.emacs.d/rime -> /gnu/store/05v76y32j495v8dw6aaknp91k0371q34-home-dotfiles-.emacs.d-rime... done Symlinking /home/paul/.config/fontconfig/fonts.conf -> /gnu/store/sfj8h6zbacaz3y3gqzxqsbz3621nq4jv-fonts.conf... done Symlinking /home/paul/.config/ibus/rime -> /gnu/store/lfw0i01pmwzaia6f7lb9c4p84y357pbd-home-dotfiles-.config-ibus-rime... done  done Finished updating symlinks. Comparing /gnu/store/hpnywydkrfygcl2qplxwgypqqwny16x5-home/profile/share/fonts and           /gnu/store/hpnywydkrfygcl2qplxwgypqqwny16x5-home/profile/share/fonts... done (same) Evaluating on-change gexps. On-change gexps evaluation finished. warning: XDG_RUNTIME_DIR doesn't exists, on-first-login script won't execute anything.  You can check if xdg runtime directory exists, XDG_RUNTIME_DIR variable is set to appropriate value and manually execute the -bash-5.1$  cat .emacs.d/rimex-home/on-first-login'-bash-5.1$  cat .emacs.d/rime hello -bash-5.1$ ls -al .emacs.d/ total 4 drwxr-xr-x 1 paul users   8 Jan 22 16:42 . drwxr-xr-x 1 paul users 234 Jan 22 16:42 .. lrwxrwxrwx 1 paul users  71 Jan 22 16:42 rime -> /gnu/store/05v76y32j495v8dw6aaknp91k0371q34-home-dotfiles-.emacs.d-rime -bash-5.1$ Hope this helps, giacomo --------------w1pWSecrc2lT96H9jfFVclwN Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 8bit

Hello,

the following works for me with the attached configuration.

$ tree -a .
.
└── guix-home-project
    ├── .dotfiles
    │   └── rime
    │       ├── .config
    │       │   └── ibus
    │       └── .emacs.d
    └── test-config.scm
7 directories, 1 file
$ echo hello > guix-home-project/.dotfiles/rime/.config/ibus/rime
$ cd guix-home-project/.dotfiles/rime/.emacs.d/ && ln -s ../.config/ibus/rime ./
$ ls -al 
total 4
drwxr-xr-x 1 paul users  8 Jan 22 17:37 ./
drwxr-xr-x 1 paul users 30 Jan 22 17:31 ../
lrwxrwxrwx 1 paul users 20 Jan 22 17:37 rime -> ../.config/ibus/rime
 $ cd ../.. && guix home container --share=`pwd`/..=$HOME test-config.scm 
WARNING: (guile-user): imported module (guix build utils) overrides core binding `delete'
WARNING: (guile-user): imported module (guix build utils) overrides core binding `delete'
Cleaning up symlinks from previous home at /gnu/store/hpnywydkrfygcl2qplxwgypqqwny16x5-home.

Removing /home/paul/.profile... done
Removing /home/paul/.emacs.d/rime... done
Removed /home/paul/.emacs.d.
Removing /home/paul/.config/fontconfig/fonts.conf... done
Removed /home/paul/.config/fontconfig.
Removing /home/paul/.config/ibus/rime... done
Removed /home/paul/.config/ibus.
Removed /home/paul/.config.
Cleanup finished.

Symlinking /home/paul/.profile -> /gnu/store/l27r8vj94ggr3na9pb1snizsmvh0zrxl-shell-profile... done
Symlinking /home/paul/.emacs.d/rime -> /gnu/store/05v76y32j495v8dw6aaknp91k0371q34-home-dotfiles-.emacs.d-rime... done
Symlinking /home/paul/.config/fontconfig/fonts.conf -> /gnu/store/sfj8h6zbacaz3y3gqzxqsbz3621nq4jv-fonts.conf... done
Symlinking /home/paul/.config/ibus/rime -> /gnu/store/lfw0i01pmwzaia6f7lb9c4p84y357pbd-home-dotfiles-.config-ibus-rime... done
 done
Finished updating symlinks.

Comparing /gnu/store/hpnywydkrfygcl2qplxwgypqqwny16x5-home/profile/share/fonts and
          /gnu/store/hpnywydkrfygcl2qplxwgypqqwny16x5-home/profile/share/fonts... done (same)
Evaluating on-change gexps.

On-change gexps evaluation finished.

warning: XDG_RUNTIME_DIR doesn't exists, on-first-login script
won't execute anything.  You can check if xdg runtime directory exists,
XDG_RUNTIME_DIR variable is set to appropriate value and manually execute the
-bash-5.1$  cat .emacs.d/rimex-home/on-first-login'-bash-5.1$  cat .emacs.d/rime
hello
-bash-5.1$ ls -al .emacs.d/    
total 4
drwxr-xr-x 1 paul users   8 Jan 22 16:42 .
drwxr-xr-x 1 paul users 234 Jan 22 16:42 ..
lrwxrwxrwx 1 paul users  71 Jan 22 16:42 rime -> /gnu/store/05v76y32j495v8dw6aaknp91k0371q34-home-dotfiles-.emacs.d-rime
-bash-5.1$

Hope this helps,

giacomo

--------------w1pWSecrc2lT96H9jfFVclwN-- --------------wPi2I4chHi7ITwSf4fNnjpYj Content-Type: text/x-scheme; charset=UTF-8; name="test-config.scm" Content-Disposition: attachment; filename="test-config.scm" Content-Transfer-Encoding: base64 KHVzZS1tb2R1bGVzIChnbnUgaG9tZSkKICAgICAgICAgICAgIChnbnUgaG9tZSBzZXJ2aWNl cykKICAgICAgICAgICAgIChzbWFsbC1ndWl4IGhvbWUgc2VydmljZXMgZG90ZmlsZXMtdjIp CiAgICAgICAgICAgICAoZ3VpeCB1dGlscykpCgooaG9tZS1lbnZpcm9ubWVudAogKHNlcnZp Y2VzCiAgKGxpc3QgKHNlcnZpY2UgaG9tZS1kb3RmaWxlcy1zZXJ2aWNlLXR5cGUKICAgICAg ICAgICAgICAgICAoaG9tZS1kb3RmaWxlcy1jb25maWd1cmF0aW9uCiAgICAgICAgICAgICAg ICAgIChkaXJlY3RvcmllcwogICAgICAgICAgICAgICAgICAgKGxpc3QgKHN0cmluZy1hcHBl bmQgKGN1cnJlbnQtc291cmNlLWRpcmVjdG9yeSkgIi8uZG90ZmlsZXMiKSkpKSkpKSkK --------------wPi2I4chHi7ITwSf4fNnjpYj-- From debbugs-submit-bounces@debbugs.gnu.org Tue Jan 23 07:14:54 2024 Received: (at 60521) by debbugs.gnu.org; 23 Jan 2024 12:14:54 +0000 Received: from localhost ([127.0.0.1]:42380 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rSFg5-0001ba-Qt for submit@debbugs.gnu.org; Tue, 23 Jan 2024 07:14:54 -0500 Received: from m16.mail.163.com ([220.197.31.2]:59440) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rSFg1-0001bG-M5 for 60521@debbugs.gnu.org; Tue, 23 Jan 2024 07:14:52 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:Subject:Date:Message-ID:MIME-Version: Content-Type; bh=4IzgS504xDPVCJIHH6ETPWyNlzKXPfuMBxZGsnAWz3Y=; b=NRtvdN5o9cGBhT+MB2gaBHaM41TzC6YAvBRTz/1XkWBQJqmIXoTQnOUJISw5y+ HUb7wsvtGffB1uOfD/SmdBDEtM0Fli9cxGPtlhecf8ia0vT5wArqLzHNvTzx+/mA 1pGMpYCfDgD8jRe+uhMM0QoFiN/xfzKQqFpvHyHivgjS8= Received: from Guix (unknown [49.88.118.123]) by gzga-smtp-mta-g0-0 (Coremail) with SMTP id _____wCHL6Cdra9lPDIBAg--.54121S2; Tue, 23 Jan 2024 20:14:22 +0800 (CST) From: Feng Shu To: paul Subject: Re: [60521] Add home-dotfiles-service-type - Rebased on master In-Reply-To: <151fb78b-ed1a-e2c0-036d-c927d6c7429d@autistici.org> (paul's message of "Mon, 22 Jan 2024 17:45:51 +0100") References: <0a34b882-cb82-cbb2-50fe-f85725acf024@autistici.org> <2882eccf-000b-3db4-b2da-2dcb5c68e8ff@autistici.org> <87zfwxzgrm.fsf@163.com> <151fb78b-ed1a-e2c0-036d-c927d6c7429d@autistici.org> Date: Tue, 23 Jan 2024 20:14:21 +0800 Message-ID: <87sf2o9rhe.fsf@163.com> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-CM-TRANSID: _____wCHL6Cdra9lPDIBAg--.54121S2 X-Coremail-Antispam: 1Uf129KBjvJXoWxAFW3Jw1kZFyfZFyDKFW8Crg_yoW5Aw1fpa 1rur13Ga4rZFnYvryvvF18GF1rJw1fXwsrXan3Jr40vryYg3s5KrsrtF1Yqa9IvasxJry8 XFW3KFW7Xa4DA3DanT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x0zNXd1wUUUUU= X-Originating-IP: [49.88.118.123] X-CM-SenderInfo: 5wxpt2lkx6il2tof0z/1tbiShBu1GVOA8eGvwAAs2 X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 60521 Cc: 60521@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) paul writes: > Hello, > > the following works for me with the attached configuration. > > $ tree -a . > . > =E2=94=94=E2=94=80=E2=94=80 guix-home-project > =E2=94=9C=E2=94=80=E2=94=80 .dotfiles > =E2=94=82 =E2=94=94=E2=94=80=E2=94=80 rime > =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 ibus > =E2=94=82 =E2=94=94=E2=94=80=E2=94=80 .emacs.d > =E2=94=94=E2=94=80=E2=94=80 test-config.scm > > 7 directories, 1 file > $ echo hello > guix-home-project/.dotfiles/rime/.config/ibus/rime In my machine, rime is a directory and not a file. If this situation is hard to support, maybe we should add note to document. > $ cd guix-home-project/.dotfiles/rime/.emacs.d/ && ln -s ../.config/ibus/= rime ./ > $ ls -al=20 > total 4 > drwxr-xr-x 1 paul users 8 Jan 22 17:37 ./ > drwxr-xr-x 1 paul users 30 Jan 22 17:31 ../ > lrwxrwxrwx 1 paul users 20 Jan 22 17:37 rime -> ../.config/ibus/rime > $ cd ../.. && guix home container --share=3D`pwd`/..=3D$HOME test-config= .scm=20 > WARNING: (guile-user): imported module (guix build utils) overrides core = binding `delete' > WARNING: (guile-user): imported module (guix build utils) overrides core = binding `delete' > Cleaning up symlinks from previous home at /gnu/store/hpnywydkrfygcl2qplx= wgypqqwny16x5-home. > > Removing /home/paul/.profile... done > Removing /home/paul/.emacs.d/rime... done > Removed /home/paul/.emacs.d. > Removing /home/paul/.config/fontconfig/fonts.conf... done > Removed /home/paul/.config/fontconfig. > Removing /home/paul/.config/ibus/rime... done > Removed /home/paul/.config/ibus. > Removed /home/paul/.config. > Cleanup finished. > > Symlinking /home/paul/.profile -> /gnu/store/l27r8vj94ggr3na9pb1snizsmvh0= zrxl-shell-profile... done > Symlinking /home/paul/.emacs.d/rime -> /gnu/store/05v76y32j495v8dw6aaknp9= 1k0371q34-home-dotfiles-.emacs.d-rime... done > Symlinking /home/paul/.config/fontconfig/fonts.conf -> /gnu/store/sfj8h6z= bacaz3y3gqzxqsbz3621nq4jv-fonts.conf... done > Symlinking /home/paul/.config/ibus/rime -> /gnu/store/lfw0i01pmwzaia6f7lb= 9c4p84y357pbd-home-dotfiles-.config-ibus-rime... done > done > Finished updating symlinks. > > Comparing /gnu/store/hpnywydkrfygcl2qplxwgypqqwny16x5-home/profile/share/= fonts and > /gnu/store/hpnywydkrfygcl2qplxwgypqqwny16x5-home/profile/share/= fonts... done (same) > Evaluating on-change gexps. > > On-change gexps evaluation finished. > > warning: XDG_RUNTIME_DIR doesn't exists, on-first-login script > won't execute anything. You can check if xdg runtime directory exists, > XDG_RUNTIME_DIR variable is set to appropriate value and manually execute= the > -bash-5.1$ cat .emacs.d/rimex-home/on-first-login'-bash-5.1$ cat .emacs= .d/rime > hello > -bash-5.1$ ls -al .emacs.d/=20=20=20=20 > total 4 > drwxr-xr-x 1 paul users 8 Jan 22 16:42 . > drwxr-xr-x 1 paul users 234 Jan 22 16:42 .. > lrwxrwxrwx 1 paul users 71 Jan 22 16:42 rime -> /gnu/store/05v76y32j495v= 8dw6aaknp91k0371q34-home-dotfiles-.emacs.d-rime > -bash-5.1$ > > Hope this helps, > > giacomo > --=20 From debbugs-submit-bounces@debbugs.gnu.org Wed Jan 24 06:58:35 2024 Received: (at 60521) by debbugs.gnu.org; 24 Jan 2024 11:58:35 +0000 Received: from localhost ([127.0.0.1]:44621 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rSbtq-0007kk-Be for submit@debbugs.gnu.org; Wed, 24 Jan 2024 06:58:34 -0500 Received: from m16.mail.163.com ([220.197.31.4]:39714) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rSbtj-0007kH-5u for 60521@debbugs.gnu.org; Wed, 24 Jan 2024 06:58:31 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:Subject:Date:Message-ID:MIME-Version: Content-Type; bh=3Re3cFu4+E8eyNrOvxycbWi/4CD0x7yDYmYlzCnQM/k=; b=YXgoPJMzoCWUw+iCuNHiDAabpNSqB+8c1q9WPb+VBed6oSiuEYL/igWXm1lOV3 OdgGb9+qz9SLTelxWZrjvAQDHpZEh//fyDm1G79zyJpVxnIvy4E+RMZzdfv2mZyZ Vm0D0h/V4H89nd6L1zu6X2uMz7OstiGBkjGcSf+MSkilQ= Received: from Guix (unknown [49.88.118.123]) by gzga-smtp-mta-g0-5 (Coremail) with SMTP id _____wD3P_pQ+7BlsS+hAg--.8038S2; Wed, 24 Jan 2024 19:58:09 +0800 (CST) From: Feng Shu To: paul Subject: Re: [60521] Add home-dotfiles-service-type - Rebased on master In-Reply-To: <2882eccf-000b-3db4-b2da-2dcb5c68e8ff@autistici.org> (paul's message of "Sun, 21 Jan 2024 18:06:19 +0100") References: <0a34b882-cb82-cbb2-50fe-f85725acf024@autistici.org> <2882eccf-000b-3db4-b2da-2dcb5c68e8ff@autistici.org> Date: Wed, 24 Jan 2024 19:58:08 +0800 Message-ID: <871qa7kkof.fsf@163.com> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-CM-TRANSID: _____wD3P_pQ+7BlsS+hAg--.8038S2 X-Coremail-Antispam: 1Uf129KBjvJXoWxXF1fJF18tF43XFWrCF4kJFb_yoW7JryDpF Waga4Sy3yrJF1kCrs3ZFy8GryxXr93Cr45ZFZxZF10qr1DCrWqkrWak3yS9FWrJay8J3yj qay0qry7WryUZrJanT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x0zNXd1wUUUUU= X-Originating-IP: [49.88.118.123] X-CM-SenderInfo: 5wxpt2lkx6il2tof0z/1tbiLxNv1GVOBftvqAAAsV X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 60521 Cc: 60521@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) paul writes: > Hello Feng Shu, > > Apologies for the delay. I fixed the bug you pointed out for symlinks and spaces in file names. Thank you for > catching them! > > About templating I would suggest you to use mixed-text-file or computed file from (guix gexp) and pass them > directly to them home-files-service-type. It is possible to use it together with home-dotfiles-service-type. At the moment, I use the below code, seem to work well: (service home-dotfiles-service-type (home-dotfiles-configuration (directories (list (string-append (current-source-directory) "/dotfiles"))) (template-config '((".home-dotfiles-template" ("var1" . "hello") ("var2" . "world")))))) ---------------------------------------------------------- (define-module (gee home services) #:use-module (gnu home services) #:use-module (guix build utils) #:use-module (guix gexp) #:use-module (guix records) #:use-module (srfi srfi-1) #:use-module (ice-9 ftw) #:use-module (ice-9 regex) #:use-module (ice-9 string-fun) #:use-module (ice-9 textual-ports) #:export (home-dotfiles-service-type home-dotfiles-configuration home-dotfiles-configuration? home-dotfiles-configuration-directories home-dotfiles-configuration-excluded)) (define %home-dotfiles-excluded '(".*~" ".*\\.swp" "\\.git" "\\.gitignore")) (define-record-type* home-dotfiles-configuration make-home-dotfiles-configuration home-dotfiles-configuration? (directories home-dotfiles-configuration-directories ;list of strings (default '())) (excluded home-dotfiles-configuration-excluded ;list of strings (default %home-dotfiles-excluded)) (template-config home-dotfiles-configuration-template-config (default '()))) (define* (import-dotfiles directory excluded template-config) "Return a list of objects compatible with @code{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 DIRECTORY and mapping its contents to the user's home directory, excluding files that match any of the patterns in EXCLUDED." (define filtered (find-files directory (lambda (file stat) (not (string-match (string-append "^.*(" (string-join excluded "|") ")$") file))))) (define (strip file) (string-drop file (+ 1 (string-length directory)))) (define (resolve file) (if (eq? 'symlink (stat:type (lstat file))) (let ((resolved (readlink file))) (with-directory-excursion (dirname file) (canonicalize-path resolved))) file)) (define (format file) (let* ((without-spaces (string-replace-substring file " " "_")) (without-slashes-and-spaces (string-replace-substring without-spaces "/" "-"))) (string-append "home-dotfiles-" without-slashes-and-spaces))) (map (lambda (file) (let* ((stripped (strip file)) (template-vars (assoc-ref template-config stripped))) (list stripped (if template-vars (plain-file (format stripped) (template-generate (resolve file) template-vars)) (local-file (resolve file) (format stripped)))))) filtered)) (define (template-generate template-file template-variables) (let ((string (call-with-input-file template-file get-string-all))) (map (lambda (x) (let ((var (string-append "{{{" (car x) "}}}")) (value (cdr x))) (set! string (string-replace-substring string var value)))) template-variables) string)) (define (home-dotfiles-configuration->files config) "Return a list of objects compatible with @code{home-files-service-type}'s value, generated following GNU Stow's algorithm for each of the directories in CONFIG, excluding files that match any of the patterns configured." (define (directory-contents directories) (append-map (lambda (directory) (map (lambda (content) (with-directory-excursion directory (canonicalize-path content))) (scandir directory (lambda (name) (not (member name '("." ".."))))))) directories)) (append-map (lambda (app) (import-dotfiles app (home-dotfiles-configuration-excluded config) (home-dotfiles-configuration-template-config config))) (directory-contents (home-dotfiles-configuration-directories config)))) (define-public home-dotfiles-service-type (service-type (name 'home-dotfiles) (extensions (list (service-extension home-files-service-type home-dotfiles-configuration->files))) (default-value (home-dotfiles-configuration)) (description "Files that will be put in the user's home directory following GNU Stow's algorithm, and further processed during activation."))) > > giacomo -- From debbugs-submit-bounces@debbugs.gnu.org Fri Jan 26 12:47:36 2024 Received: (at 60521) by debbugs.gnu.org; 26 Jan 2024 17:47:36 +0000 Received: from localhost ([127.0.0.1]:52731 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rTQIi-0005MK-C5 for submit@debbugs.gnu.org; Fri, 26 Jan 2024 12:47:36 -0500 Received: from confino.investici.org ([2a11:7980:1::2:0]:22251) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rTQIe-0005M4-VN for 60521@debbugs.gnu.org; Fri, 26 Jan 2024 12:47:35 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=autistici.org; s=stigmate; t=1706291242; bh=yGey7meVuw9jG1bG/PMpv2NgfdcQ8hvLwl74TLrEk6M=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=n2i5wwqxHTxP0jAQ9DLx/kJXw2/Naucb9L2FqjkVJLpKxrpW62C5k0IRuRm0xxi6d naEe4Hh1QrHrgjcffm6w4mRf4SUQQBT6dS4xMfHlzcCB55ogefBI74XGWaA4Yljuto x/9mEvJA7fSdZxDoGaxrlvIiUdcjXo7MtEhaICAg= Received: from mx1.investici.org (unknown [127.0.0.1]) by confino.investici.org (Postfix) with ESMTP id 4TM4s61FlCz11DR; Fri, 26 Jan 2024 17:47:22 +0000 (UTC) Received: from [93.190.126.19] (mx1.investici.org [93.190.126.19]) (Authenticated sender: goodoldpaul@autistici.org) by localhost (Postfix) with ESMTPSA id 4TM4s60P2Rz11BM; Fri, 26 Jan 2024 17:47:21 +0000 (UTC) Message-ID: <4fa19dc8-dc0b-5fc0-c762-ea2805c14f0d@autistici.org> Date: Fri, 26 Jan 2024 18:47:21 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.15.0 Subject: Re: [60521] Add home-dotfiles-service-type - Rebased on master To: Feng Shu References: <0a34b882-cb82-cbb2-50fe-f85725acf024@autistici.org> <2882eccf-000b-3db4-b2da-2dcb5c68e8ff@autistici.org> <871qa7kkof.fsf@163.com> Content-Language: en-US From: paul In-Reply-To: <871qa7kkof.fsf@163.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: -3.1 (---) X-Debbugs-Envelope-To: 60521 Cc: 60521@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -4.1 (----) Hi, On 1/24/24 12:58, Feng Shu wrote: > At the moment, I use the below code, seem to work well: I understand it's possible but it's really more easy and consistent to use gexp, for longer files you can import them with local-file and process them inside computed-file for example with substitute* from (guix build utils) i believe. But I should have fixed the bug for symlinks for real this time :) I'm sending an updated patchset, please let me know if v6 works for your use case. giacomo From debbugs-submit-bounces@debbugs.gnu.org Fri Jan 26 12:49:18 2024 Received: (at 60521) by debbugs.gnu.org; 26 Jan 2024 17:49:18 +0000 Received: from localhost ([127.0.0.1]:52735 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rTQKL-0005Ua-PA for submit@debbugs.gnu.org; Fri, 26 Jan 2024 12:49:18 -0500 Received: from confino.investici.org ([2a11:7980:1::2:0]:47351) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rTQKI-0005UR-QN for 60521@debbugs.gnu.org; Fri, 26 Jan 2024 12:49:15 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=autistici.org; s=stigmate; t=1706291347; bh=OO6uB7ICnyJWdwpQfs1DauiIrsyUjnHyBC8tI4ewndg=; h=From:To:Cc:Subject:Date:From; b=G8hxG8+jcb0QNquQ2uq83iBxPAFL+q3c3GcW70SKSRKkN2kmKV8L7X9B1UIkfbqT1 9pn/FHmDf2xA+bRiT3DIF6C3Ok4ISlFgOSBxF8mdlIlGuFUX0htCNJz0+x/P6Q2hlG aIiXunoL7v2mbLw2WePzaOgs74kchGgPpryFz/Mw= Received: from mx1.investici.org (unknown [127.0.0.1]) by confino.investici.org (Postfix) with ESMTP id 4TM4v73YxHz11Sm; Fri, 26 Jan 2024 17:49:07 +0000 (UTC) Received: from [93.190.126.19] (mx1.investici.org [93.190.126.19]) (Authenticated sender: goodoldpaul@autistici.org) by localhost (Postfix) with ESMTPSA id 4TM4v72cmPz11KF; Fri, 26 Jan 2024 17:49:07 +0000 (UTC) From: Giacomo Leidi To: 60521@debbugs.gnu.org Subject: [PATCH v6] home: Add home-dotfiles-service. Date: Fri, 26 Jan 2024 18:48:41 +0100 Message-ID: <20240126174850.9671-1-goodoldpaul@autistici.org> X-Mailer: git-send-email 2.41.0 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 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) * gnu/home/services.scm (dotfiles-for-app): New variable; (home-dotfiles-configuration): new variable; (home-dotfiles-service-type): new variable. * doc/guix.texi: Document it. --- doc/guix.texi | 108 ++++++++++++++++++++++++++++++++++++++++++ gnu/home/services.scm | 89 ++++++++++++++++++++++++++++++++++ 2 files changed, 197 insertions(+) diff --git a/doc/guix.texi b/doc/guix.texi index db0c751ded..a555900f07 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -44204,6 +44204,114 @@ to use alternative services to implement more advanced use cases like read-only home. Feel free to experiment and share your results. @end defvar +It is often the case that Guix Home users already have a setup for versioning +their user configuration files (also known as @emph{dotfiles}) in a single +directory, and some way of automatically deploy changes to their user home. + +The @code{home-dotfiles-service-type} is designed to ease the way into using +Guix Home for this kind of users, allowing them to point the service to their +dotfiles directory, which must follow the layout suggested by +@uref{https://www.gnu.org/software/stow/, GNU Stow}, +and have their dotfiles automatically deployed to their user home, without +migrating them to Guix native configurations. + +The dotfiles directory layout is expected to be structured as follows. Please +keep in mind that it is advisable to keep your dotfiles directories under +version control, for example in the same repository where you'd track your +Guix Home configuration. + +@example +~$ tree -a .dotfiles/ +.dotfiles/ +├── git +│ └── .gitconfig +├── gpg +│ └── .gnupg +│ ├── gpg-agent.conf +│ └── gpg.conf +├── guile +│ └── .guile +├── guix +│ └── .config +│ └── guix +│ └── channels.scm +├── nix +│ ├── .config +│ │ └── nixpkgs +│ │ └── config.nix +│ └── .nix-channels +├── tmux +│ └── .tmux.conf +└── vim + └── .vimrc + +13 directories, 10 files +@end example + +For an informal specification please refer to the Stow manual +(@pxref{Top,,, stow, Introduction}). A suitable configuration would then +be: + +@lisp +(use-modules (guix utils)) + +(home-environment + + [...] + + (services + (service home-dotfiles-service-type + (home-dotfiles-configuration + (directories + (list (string-append (current-source-directory) + "/.dotfiles"))))))) +@end lisp + +The expected home directory state would be: + +@example +. +├── .config +│ ├── guix +│ │ └── channels.scm +│ └── nixpkgs +│ └── config.nix +├── .gitconfig +├── .gnupg +│ ├── gpg-agent.conf +│ └── gpg.conf +├── .guile +├── .nix-channels +├── .tmux.conf +└── .vimrc +@end example + +@defvar home-dotfiles-service-type +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 users that already track their dotfiles under some kind of version +control. This service allows users to point Guix Home to their dotfiles +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. +@end defvar + +@deftp {Data Type} home-dotfiles-configuration +Available @code{home-dotfiles-configuration} fields are: + +@table @asis +@item @code{directories} (type: list-of-strings) +The list of dotfiles directories where @code{home-dotfiles-service-type} will +look for application dotfiles. + +@item @code{exclude} (default: @code{'(".*~" ".*\\.swp" "\\.git" "\\.gitignore")}) +The list of file patterns @code{home-dotfiles-service-type} will exclude while +visiting each one of the @code{directories}. + +@end table + +@end deftp + @defvar home-xdg-configuration-files-service-type The service is very similar 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 44f585aff5..3e925c07c8 100644 --- a/gnu/home/services.scm +++ b/gnu/home/services.scm @@ -3,6 +3,7 @@ ;;; Copyright © 2021 Xinglu Chen ;;; Copyright © 2022-2023 Ludovic Courtès ;;; Copyright © 2023 Carlo Zancanaro +;;; Copyright © 2023 Giacomo Leidi ;;; ;;; This file is part of GNU Guix. ;;; @@ -23,6 +24,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) @@ -35,15 +37,24 @@ (define-module (gnu home services) #:use-module (guix i18n) #:use-module (guix modules) #:use-module (guix memoization) + #:use-module (guix records) #:use-module (srfi srfi-1) #:use-module (srfi srfi-9) + #:use-module (ice-9 ftw) #:use-module (ice-9 match) + #:use-module (ice-9 regex) + #: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-dotfiles-service-type + home-dotfiles-configuration + home-dotfiles-configuration? + home-dotfiles-configuration-directories + home-dotfiles-configuration-excluded home-xdg-configuration-files-service-type home-xdg-data-files-service-type home-run-on-first-login-service-type @@ -355,6 +366,84 @@ (define home-files-service-type (description "Files that will be put in @file{~/.guix-home/files}, and further processed during activation."))) +(define %home-dotfiles-excluded + '(".*~" + ".*\\.swp" + "\\.git" + "\\.gitignore")) + +(define-record-type* + home-dotfiles-configuration make-home-dotfiles-configuration + home-dotfiles-configuration? + (directories home-dotfiles-configuration-directories ;list of strings + (default '())) + (excluded home-dotfiles-configuration-excluded ;list of strings + (default %home-dotfiles-excluded))) + +(define* (import-dotfiles directory excluded) + "Return a list of objects compatible with @code{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 DIRECTORY and mapping its contents to the +user's home directory, excluding files that match any of the patterns in EXCLUDED." + (define filtered + (find-files directory + (lambda (file stat) + (not (string-match + (string-append + "^.*(" (string-join excluded "|") ")$") file))))) + (define (strip file) + (string-drop file (+ 1 (string-length directory)))) + (define (resolve file) + (if (eq? 'symlink (stat:type (lstat file))) + (let ((resolved (readlink file))) + (with-directory-excursion (dirname file) + (canonicalize-path resolved))) + file)) + (define (format file) + (let* ((without-spaces + (string-replace-substring file " " "_")) + (without-slashes-and-spaces + (string-replace-substring without-spaces "/" "-"))) + (string-append "home-dotfiles-" without-slashes-and-spaces))) + + (map (lambda (file) + (let* ((stripped (strip file))) + (list stripped + (local-file (resolve file) (format stripped) + #:recursive? #t)))) + filtered)) + +(define (home-dotfiles-configuration->files config) + "Return a list of objects compatible with @code{home-files-service-type}'s +value, generated following GNU Stow's algorithm for each of the +directories in CONFIG, excluding files that match any of the patterns configured." + (define (directory-contents directories) + (append-map + (lambda (directory) + (map + (lambda (content) + (with-directory-excursion directory + (canonicalize-path content))) + (scandir directory + (lambda (name) + (not (member name '("." ".."))))))) + directories)) + (append-map + (lambda (app) + (import-dotfiles app (home-dotfiles-configuration-excluded config))) + (directory-contents + (home-dotfiles-configuration-directories config)))) + +(define-public home-dotfiles-service-type + (service-type (name 'home-dotfiles) + (extensions + (list (service-extension home-files-service-type + home-dotfiles-configuration->files))) + (default-value (home-dotfiles-configuration)) + (description "Files that will be put in the user's home directory +following GNU Stow's algorithm, and further processed during activation."))) + (define xdg-configuration-files-directory ".config") (define (xdg-configuration-files files) base-commit: 8ae8b9804fa4aef23d4028563559bf7bec52fec2 -- 2.41.0 From debbugs-submit-bounces@debbugs.gnu.org Fri Jan 26 21:55:14 2024 Received: (at 60521) by debbugs.gnu.org; 27 Jan 2024 02:55:15 +0000 Received: from localhost ([127.0.0.1]:53170 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rTYqg-0003f5-Jy for submit@debbugs.gnu.org; Fri, 26 Jan 2024 21:55:14 -0500 Received: from m16.mail.163.com ([220.197.31.3]:48264) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rTYqc-0003er-Ng for 60521@debbugs.gnu.org; Fri, 26 Jan 2024 21:55:13 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:Subject:Date:Message-ID:MIME-Version: Content-Type; bh=qQ4dGD8vd/cc1a9E4dN+ICJjrfwOpsI4FSTtUxHHoHM=; b=YjR2m17KnvqLs+tFu+sfeP6hjLJBYzMLgliJfmpd7JYzvkgFP3yS01x0ik3wIJ 1BEYgjCuNXrj4mtW/P35mssG04LJm79ysqemwbZvr+k3ET8NF2W5OhxHvlwfMH/p XvNdanmKDzdV6ja669Va6nupWoMo+eeS4l6Uid+gXg06M= Received: from Guix (unknown [49.88.118.123]) by gzga-smtp-mta-g1-0 (Coremail) with SMTP id _____wD3_wF1cLRlxCIgBA--.22123S2; Sat, 27 Jan 2024 10:54:46 +0800 (CST) From: Feng Shu To: paul Subject: Re: [60521] Add home-dotfiles-service-type - Rebased on master In-Reply-To: <4fa19dc8-dc0b-5fc0-c762-ea2805c14f0d@autistici.org> (paul's message of "Fri, 26 Jan 2024 18:47:21 +0100") References: <0a34b882-cb82-cbb2-50fe-f85725acf024@autistici.org> <2882eccf-000b-3db4-b2da-2dcb5c68e8ff@autistici.org> <871qa7kkof.fsf@163.com> <4fa19dc8-dc0b-5fc0-c762-ea2805c14f0d@autistici.org> Date: Sat, 27 Jan 2024 10:54:45 +0800 Message-ID: <87cytn7afe.fsf@163.com> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-CM-TRANSID: _____wD3_wF1cLRlxCIgBA--.22123S2 X-Coremail-Antispam: 1Uf129KBjDUn29KB7ZKAUJUUUUU529EdanIXcx71UUUUU7v73 VFW2AGmfu7bjvjm3AaLaJ3UbIYCTnIWIevJa73UjIFyTuYvj4idHUWDUUUU X-Originating-IP: [49.88.118.123] X-CM-SenderInfo: 5wxpt2lkx6il2tof0z/1tbiLxdy1GVOBjDHsQAAs1 X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 60521 Cc: 60521@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) paul writes: > Hi, > > On 1/24/24 12:58, Feng Shu wrote: >> At the moment, I use the below code, seem to work well: > > I understand it's possible but it's really more easy and consistent to > use gexp, for longer files you can import them with local-file and > process them inside computed-file for example with substitute* from > (guix build utils) i believe. I will try gexp approach in the future. > > But I should have fixed the bug for symlinks for real this time :) I'm > sending an updated patchset, please let me know if v6 works for your > use case. Works, thanks! > > giacomo > -- From debbugs-submit-bounces@debbugs.gnu.org Sat Jan 27 15:27:16 2024 Received: (at 60521) by debbugs.gnu.org; 27 Jan 2024 20:27:17 +0000 Received: from localhost ([127.0.0.1]:55999 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rTpGm-0004Ds-Hl for submit@debbugs.gnu.org; Sat, 27 Jan 2024 15:27:16 -0500 Received: from mail-wr1-x430.google.com ([2a00:1450:4864:20::430]:56596) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rTpGg-0004Da-F2 for 60521@debbugs.gnu.org; Sat, 27 Jan 2024 15:27:14 -0500 Received: by mail-wr1-x430.google.com with SMTP id ffacd0b85a97d-33ae42033e2so602358f8f.1 for <60521@debbugs.gnu.org>; Sat, 27 Jan 2024 12:27:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sarg.org.ru; s=google; t=1706387217; x=1706992017; darn=debbugs.gnu.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:user-agent:from:to:cc:subject:date:message-id:reply-to; bh=dz3PnU5LDT/YaVXLc/3RRLm4GQC2pogDKR0SxX1X7tU=; b=iTGYwPQ4rc9gMFay5ARL05ZeVIhzALZLbvLrJ62kAqphLxRtHP2sP+wGyGYNBKp0dY d3VfFVzzZA9KB6DouAJEGXZussFUskJcW6IDYTNXixeNqZ5xtl+knRNKbdklIoeEsoO/ lzYfdxWWA2RnwfJxR81IHEbSVmAvdn1XB54FY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706387217; x=1706992017; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:user-agent:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=dz3PnU5LDT/YaVXLc/3RRLm4GQC2pogDKR0SxX1X7tU=; b=dMajBIRMVSz/tzbEbSC0ylv8C/vQLgMlGUKh1B1c+VKSKCRx1kRqpizxMhullNsF1D RoJVV96bbzIvtP14mi8w63zUEaOOy5JB2Bi8+z2j5Bnc9dOMXEWgwtZYSgHJjaH1I/JE tJyXeE2Q3bCo7x55eOZ1t0H4U2XO+RTJX+gXqSkKVsCIYnycCJUuKWC0K91pJw0JPXlX sc90qX4CKMY0RMnQsnOOi+HzG9oeSNNBvSV6clLTZjdtyj7wSX1da21t3fElyjIheQtq 1/KtxJY8qLbp3/HHXBnVW3mYeDiq5OaSOM01MiUEgQl+Y8Cc+RoAuSsPdmXarJgI/4Yi I79w== X-Gm-Message-State: AOJu0YxinDgSJzvmulQkKRE9admqetRWZPOHmLiOrbsaN+NOkHBhSc9d l7fdy0TkR6e3Wj4psOya0iM8+OCdv9einR2OYjVDb190zFWL7wUBny5aQiqKa2A= X-Google-Smtp-Source: AGHT+IG2hGg8s6nL9h9dkAhx8Xjid2xwy79h/zFBvcT/49Yb+AhM+rte6c/1CpHqRwGMsChkdiC0og== X-Received: by 2002:adf:f8d0:0:b0:33a:e2f4:7d06 with SMTP id f16-20020adff8d0000000b0033ae2f47d06mr1583209wrq.34.1706387217336; Sat, 27 Jan 2024 12:26:57 -0800 (PST) Received: from localhost ([2a02:2454:a09d:d000:3f1e:a87:ccd2:4aec]) by smtp.gmail.com with ESMTPSA id un3-20020a170907cb8300b00a3516240ab3sm1558043ejc.215.2024.01.27.12.26.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 27 Jan 2024 12:26:57 -0800 (PST) User-agent: mu4e 1.10.8; emacs 29.1 From: Sergey Trofimov To: Ludovic =?utf-8?Q?Court=C3=A8s?= Subject: Re: [bug#60521] [PATCH] home: Add home-stow-migration-service. Date: Sat, 27 Jan 2024 21:21:02 +0100 Message-ID: <87h6iy7ca7.fsf@sarg.org.ru> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Score: 0.7 (/) X-Debbugs-Envelope-To: 60521 Cc: Giacomo Leidi , andrew@trop.in, 60521@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.3 (/) Ludovic Courtès writes: > Hi! > > Giacomo Leidi 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! > Does it really warrant a new service, when what's needed is a procedure which traverses a directory recursively and returns a list of file-likes. I have this in my home.scm: --8<---------------cut here---------------start------------->8--- (define (del-prefix p str) (if (string-prefix? p str) (substring/shared str (string-length p)) str)) (define* (as-local-files dir #:optional (trim-prefix dir)) (let ((absolute-dir (string-append (getcwd) "/" dir)) (to-trim (string-append (getcwd) "/" trim-prefix "/"))) (map (lambda (fn) (list (del-prefix to-trim fn) (local-file (canonicalize-path fn) (del-prefix "." (basename fn)) #:recursive? #t))) (find-files absolute-dir)))) (simple-service 'configs home-files-service-type append! (with-directory-excursion (current-source-directory) `(,@(as-local-files "../backup") ,@(as-local-files "../android") ,@(as-local-files "../email") ,@(as-local-files "../xsession") ,@(as-local-files "../git") ,@(as-local-files "../qutebrowser") ,@(as-local-files "../desktop")))) --8<---------------cut here---------------end--------------->8--- And the only need for this snippet is because there are filenames starting with dot and they can't be put in store as is. From debbugs-submit-bounces@debbugs.gnu.org Sat Jan 27 15:27:40 2024 Received: (at 60521) by debbugs.gnu.org; 27 Jan 2024 20:27:41 +0000 Received: from localhost ([127.0.0.1]:56005 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rTpHA-0004Ei-Hq for submit@debbugs.gnu.org; Sat, 27 Jan 2024 15:27:40 -0500 Received: from mail-lf1-x12d.google.com ([2a00:1450:4864:20::12d]:48443) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rTpH8-0004EV-Fi for 60521@debbugs.gnu.org; Sat, 27 Jan 2024 15:27:39 -0500 Received: by mail-lf1-x12d.google.com with SMTP id 2adb3069b0e04-510133ed214so2291562e87.1 for <60521@debbugs.gnu.org>; Sat, 27 Jan 2024 12:27:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sarg.org.ru; s=google; t=1706387245; x=1706992045; darn=debbugs.gnu.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:user-agent:from:to:cc:subject:date:message-id:reply-to; bh=fvJvVYonZVVTPrqur6e/oKKvaRgmLeDz5fObmz0K1qU=; b=I2EOlQb5J2MK24KWUA2lsOeo4i72JW0kKaMsK44LJqt5SMJ+c8w9CCmeA6u/iAiqy/ ukSJYEX5FCz+a1S3idpMHPkCULmW5OptF3uJJ3zGjJRrtjCILv1G56FmbtN2xIUyQV46 ka+/zKRU9v/iOLdFB7DwzV4QKrBL1jjXBl8Dc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706387245; x=1706992045; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:user-agent:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=fvJvVYonZVVTPrqur6e/oKKvaRgmLeDz5fObmz0K1qU=; b=AOZcMfpzXN3JCvMOLWiZrGjApxYdQV39KZZV54pd6XnPe95jzlC6pJpLCilav5IDMl 60dYCs5ER/CKNARmLw6Uy09bibPCTTV4x90lcniUSwvnp5soCvhJrfdJFdp2ORs9f8xI qqijQP257fOihlGESgNi5ToApD9l0+TC+ElokEYYWpjH/Urye2okE6IHpqfF0ZLjypnc RhSXafVzGNplZb7bbLt3G2BCdnY7lVnrGJc5MylHL4QPu5k6HDbZt4HtB/3fdOm3IQkt h7vy6dHHixZfVzP5aaixaNS3P0PAHNKsyXxQJGQ6kQy//nzH4CN62xY9g10NUAlvDkvz ozcg== X-Gm-Message-State: AOJu0YwJmr3hGI8oUnqm1GOjJoA++jsflx5ES3NemhxT2R0drVO4iG4B /tJOoVXqxs0BP5iWR195l4vpDCnjIdoMekfA7gyixZPUllmAxReduwaPNogc3/Y= X-Google-Smtp-Source: AGHT+IFK8j1en4KpV9+OFR89m2kYoEGHMtS50pCMHflCjU/B+x/DLqkQNWTByoTQOV3ukVMwg/u8Tg== X-Received: by 2002:ac2:563b:0:b0:510:323d:6403 with SMTP id b27-20020ac2563b000000b00510323d6403mr849419lff.41.1706387245062; Sat, 27 Jan 2024 12:27:25 -0800 (PST) Received: from localhost ([2a02:2454:a09d:d000:3f1e:a87:ccd2:4aec]) by smtp.gmail.com with ESMTPSA id wn9-20020a170907068900b00a2c869c2fe8sm2051966ejb.161.2024.01.27.12.27.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 27 Jan 2024 12:27:24 -0800 (PST) User-agent: mu4e 1.10.8; emacs 29.1 From: Sergey Trofimov To: Ludovic =?utf-8?Q?Court=C3=A8s?= Subject: Re: [bug#60521] [PATCH] home: Add home-stow-migration-service. Date: Sat, 27 Jan 2024 21:21:02 +0100 Message-ID: <87ede27c9f.fsf@sarg.org.ru> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Score: 0.7 (/) X-Debbugs-Envelope-To: 60521 Cc: Giacomo Leidi , andrew@trop.in, 60521@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.3 (/) Ludovic Courtès writes: > Hi! > > Giacomo Leidi 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! > Does it really warrant a new service, when what's needed is a procedure which traverses a directory recursively and returns a list of file-likes? I have this in my home.scm: --8<---------------cut here---------------start------------->8--- (define (del-prefix p str) (if (string-prefix? p str) (substring/shared str (string-length p)) str)) (define* (as-local-files dir #:optional (trim-prefix dir)) (let ((absolute-dir (string-append (getcwd) "/" dir)) (to-trim (string-append (getcwd) "/" trim-prefix "/"))) (map (lambda (fn) (list (del-prefix to-trim fn) (local-file (canonicalize-path fn) (del-prefix "." (basename fn)) #:recursive? #t))) (find-files absolute-dir)))) (simple-service 'configs home-files-service-type append! (with-directory-excursion (current-source-directory) `(,@(as-local-files "../backup") ,@(as-local-files "../android") ,@(as-local-files "../email") ,@(as-local-files "../xsession") ,@(as-local-files "../git") ,@(as-local-files "../qutebrowser") ,@(as-local-files "../desktop")))) --8<---------------cut here---------------end--------------->8--- And the only need for this snippet is because there are filenames starting with dot and they can't be put in store as is. From debbugs-submit-bounces@debbugs.gnu.org Sat Jan 27 17:56:51 2024 Received: (at 60521) by debbugs.gnu.org; 27 Jan 2024 22:56:51 +0000 Received: from localhost ([127.0.0.1]:56104 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rTrbW-0008Uu-KF for submit@debbugs.gnu.org; Sat, 27 Jan 2024 17:56:51 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:55036) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rTrbS-0008Ud-D3 for 60521@debbugs.gnu.org; Sat, 27 Jan 2024 17:56:49 -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 ) id 1rTrbE-0007d0-JB; Sat, 27 Jan 2024 17:56:32 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:Date:References:In-Reply-To:Subject:To: From; bh=A82hvVvcDyeZchOQHjvdveHMAe+ko0dgZlUWe7sMIdU=; b=E3C2/miZdMZKMcp5h153 lwAiMO8GUMO0fVwtPcUSxBf577OkEXxGwdittVZQXvlWW2Em1ohecHq/BqrkSGQqVZf6gLmc6iB+3 J/Gbt6wqkosxAZNui5W0DYfTGmcHLtHhyh/hqVj/tlkqo9WSYhqR8q2ztwTvMyaCv0qRCmg5sMIoT QfW8wrYe9T+03/F6iDAHTdaf7WRTiLBCLVuXkhwZ64ESS3XUNcUrc0fT3imVKFV66prZHH2BAp3mE aHzSrV/syGP3F7UHpKapPuZEVFzldaw797Pp5dmIxj3eLF94lKSspIdrWiKs4d7g+iFNjeYkVaYz/ 7ht/VdukmfmE+A==; From: =?utf-8?Q?Ludovic_Court=C3=A8s?= To: Giacomo Leidi Subject: Re: [bug#60521] [PATCH v6] home: Add home-dotfiles-service. In-Reply-To: <20240126174850.9671-1-goodoldpaul@autistici.org> (Giacomo Leidi's message of "Fri, 26 Jan 2024 18:48:41 +0100") References: <0a8d7bce31856292baa06a08260494c0@autistici.org> <20240126174850.9671-1-goodoldpaul@autistici.org> Date: Sat, 27 Jan 2024 23:56:29 +0100 Message-ID: <874jeyjsgy.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 60521 Cc: 60521@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hi Giacomo, Giacomo Leidi skribis: > * gnu/home/services.scm (dotfiles-for-app): New variable; > (home-dotfiles-configuration): new variable; > (home-dotfiles-service-type): new variable. > * doc/guix.texi: Document it. Apologies again for the long delay. The patch looks great to me and I think the functionality is there. I gave it a try for my own config, and that has led me to make the attached changes, which can be summarized as follows: =E2=80=A2 The dotfile directories are resolved relative the source locati= on where =E2=80=98home-dotfiles-configuration=E2=80=99 appears. The advan= tage is that users do not need to fiddle with (current-source-directory). =E2=80=A2 As a consequence, all =E2=80=98with-directory-excursion=E2=80= =99 and =E2=80=98canonicalize-path=E2=80=99 calls are gone. (Those should only= be used with great care.) =E2=80=A2 The dotfile directories are traversed only once, using =E2=80= =98find-files=E2=80=99. =E2=80=A2 The exclusion regexp is compiled only once (with =E2=80=98make-= regexp=E2=80=99) and then reused (with =E2=80=98regexp-exec=E2=80=99 calls), which is more e= fficient than repeated =E2=80=98string-match=E2=80=99 calls. =E2=80=A2 Use =E2=80=98string-map=E2=80=99 instead of =E2=80=98string-rep= lace-substring=E2=80=99 (it=E2=80=99s simpler and more efficient). If that=E2=80=99s fine with you, please feel free to apply these changes. One last thing I should have suggested earlier: how about moving it to (gnu home services dotfiles)? That would keep the scope of (gnu home services) limited to essential services. Please send one last version when you=E2=80=99re ready; I=E2=80=99m eager t= o use it for my own config actually. :-) Thank you! Ludo=E2=80=99. --=-=-= Content-Type: text/x-patch; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable diff --git a/doc/guix.texi b/doc/guix.texi index 3d764e6021..a796d9c8f8 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -44265,18 +44265,12 @@ Essential Home Services be: =20 @lisp -(use-modules (guix utils)) - (home-environment - - [...] - + ;; @dots{} (services (service home-dotfiles-service-type (home-dotfiles-configuration - (directories - (list (string-append (current-source-directory) - "/.dotfiles"))))))) + (directories (list "./dot-files")))))) @end lisp =20 The expected home directory state would be: diff --git a/gnu/home/services.scm b/gnu/home/services.scm index 3e925c07c8..c7379c93c7 100644 --- a/gnu/home/services.scm +++ b/gnu/home/services.scm @@ -1,7 +1,7 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright =C2=A9 2021-2023 Andrew Tropin ;;; Copyright =C2=A9 2021 Xinglu Chen -;;; Copyright =C2=A9 2022-2023 Ludovic Court=C3=A8s +;;; Copyright =C2=A9 2022-2024 Ludovic Court=C3=A8s ;;; Copyright =C2=A9 2023 Carlo Zancanaro ;;; Copyright =C2=A9 2023 Giacomo Leidi ;;; @@ -24,7 +24,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) + #:autoload (guix build utils) (find-files) #:use-module (guix channels) #:use-module (guix monads) #:use-module (guix store) @@ -32,6 +32,7 @@ (define-module (gnu home services) #:use-module (guix profiles) #:use-module (guix sets) #:use-module (guix ui) + #:use-module ((guix utils) #:select (current-source-directory)) #:use-module (guix discovery) #:use-module (guix diagnostics) #:use-module (guix i18n) @@ -43,7 +44,6 @@ (define-module (gnu home services) #:use-module (ice-9 ftw) #:use-module (ice-9 match) #:use-module (ice-9 regex) - #:use-module (ice-9 string-fun) #:use-module (ice-9 vlist) =20 #:export (home-service-type @@ -375,65 +375,69 @@ (define %home-dotfiles-excluded (define-record-type* home-dotfiles-configuration make-home-dotfiles-configuration home-dotfiles-configuration? + (source-directory home-dotfiles-configuration-source-directory + (default (current-source-directory)) + (innate)) (directories home-dotfiles-configuration-directories ;list o= f strings (default '())) (excluded home-dotfiles-configuration-excluded ;list o= f strings (default %home-dotfiles-excluded))) =20 -(define* (import-dotfiles directory excluded) +(define (import-dotfiles directory files) "Return a list of objects compatible with @code{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 DIRECTORY and mapping its contents to the user's home directory, excluding files that match any of the patterns in E= XCLUDED." - (define filtered - (find-files directory - (lambda (file stat) - (not (string-match - (string-append - "^.*(" (string-join excluded "|") ")$") file))))) (define (strip file) - (string-drop file (+ 1 (string-length directory)))) - (define (resolve file) - (if (eq? 'symlink (stat:type (lstat file))) - (let ((resolved (readlink file))) - (with-directory-excursion (dirname file) - (canonicalize-path resolved))) - file)) + (string-drop file (+ 1 (string-length directory)))) + (define (format file) - (let* ((without-spaces - (string-replace-substring file " " "_")) - (without-slashes-and-spaces - (string-replace-substring without-spaces "/" "-"))) - (string-append "home-dotfiles-" without-slashes-and-spaces))) + ;; Remove from FILE characters that cannot be used in the store. + (string-append + "home-dotfiles-" + (string-map (lambda (chr) + (if (and (char-set-contains? char-set:ascii chr) + (char-set-contains? char-set:graphic chr) + (not (memv chr '(#\. #\/)))) + chr + #\-)) + file))) =20 (map (lambda (file) - (let* ((stripped (strip file))) + (let ((stripped (strip file))) (list stripped - (local-file (resolve file) (format stripped) + (local-file file (format stripped) #:recursive? #t)))) - filtered)) + files)) =20 (define (home-dotfiles-configuration->files config) - "Return a list of objects compatible with @code{home-files-service-type= }'s + "Return a list of objects compatible with @code{home-files-service-type}= 's value, generated following GNU Stow's algorithm for each of the directories in CONFIG, excluding files that match any of the patterns conf= igured." - (define (directory-contents directories) - (append-map - (lambda (directory) - (map - (lambda (content) - (with-directory-excursion directory - (canonicalize-path content))) - (scandir directory - (lambda (name) - (not (member name '("." ".."))))))) - directories)) - (append-map - (lambda (app) - (import-dotfiles app (home-dotfiles-configuration-excluded config))) - (directory-contents - (home-dotfiles-configuration-directories config)))) + (define excluded + (home-dotfiles-configuration-excluded config)) + (define exclusion-rx + (make-regexp (string-append "^.*(" (string-join excluded "|") ")$"))) + + (define (directory-contents directory) + (find-files directory + (lambda (file stat) + (not (regexp-exec exclusion-rx + (basename file)))))) + + (define (resolve directory) + ;; Resolve DIRECTORY relative to the 'source-directory' field of CONFI= G. + (if (string-prefix? "/" directory) + directory + (in-vicinity (home-dotfiles-configuration-source-directory config) + directory))) + + (append-map (lambda (directory) + (let* ((directory (resolve directory)) + (contents (directory-contents directory))) + (import-dotfiles directory contents))) + (home-dotfiles-configuration-directories config))) =20 (define-public home-dotfiles-service-type (service-type (name 'home-dotfiles) --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Sun Jan 28 10:37:04 2024 Received: (at 60521) by debbugs.gnu.org; 28 Jan 2024 15:37:04 +0000 Received: from localhost ([127.0.0.1]:58197 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rU7DT-0008UU-S8 for submit@debbugs.gnu.org; Sun, 28 Jan 2024 10:37:04 -0500 Received: from confino.investici.org ([2a11:7980:1::2:0]:41671) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rU7DR-0008U0-JG for 60521@debbugs.gnu.org; Sun, 28 Jan 2024 10:37:02 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=autistici.org; s=stigmate; t=1706456210; bh=ujeKZMkqLcXRpGdfk6wBL+mZadGE1QN9FRUSKBYB9tU=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=hvvHVLp5lJ2QO3d8ZBomLOYPyjvI8Yl182FvuqqT4EcyUpFq+bF92YudCIjQVl7m6 /YvUTkey22PAQJD9g2mYWOgyjRcSz3JAFO738cR1CzERTxGAULuX+RmGsZ0/RFLZD+ 9lKbmg29DF3mENKxJ0JW7qrmlj/QIqM6o9LxYcuU= Received: from mx1.investici.org (unknown [127.0.0.1]) by confino.investici.org (Postfix) with ESMTP id 4TNFsZ5X1Rz10wb; Sun, 28 Jan 2024 15:36:50 +0000 (UTC) Received: from [93.190.126.19] (mx1.investici.org [93.190.126.19]) (Authenticated sender: goodoldpaul@autistici.org) by localhost (Postfix) with ESMTPSA id 4TNFsZ4tW9z10wN; Sun, 28 Jan 2024 15:36:50 +0000 (UTC) Message-ID: Date: Sun, 28 Jan 2024 16:36:50 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.15.0 Subject: Re: [bug#60521] [PATCH v6] home: Add home-dotfiles-service. To: =?UTF-8?Q?Ludovic_Court=c3=a8s?= References: <0a8d7bce31856292baa06a08260494c0@autistici.org> <20240126174850.9671-1-goodoldpaul@autistici.org> <874jeyjsgy.fsf@gnu.org> Content-Language: en-US From: paul In-Reply-To: <874jeyjsgy.fsf@gnu.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Score: -3.1 (---) X-Debbugs-Envelope-To: 60521 Cc: 60521@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -4.1 (----) Hi Ludo’ , Thank you for your help and nice explanations , I often try and figure out things from other examples in the code base but it's often difficult to understand why certain choices were made. I applied your patch manually because it wouldn't apply somehow with git apply -3 file.patch , am I doing something wrong? Anyway I'm sending a patch integrating all your work, thank you! giacomo From debbugs-submit-bounces@debbugs.gnu.org Sun Jan 28 10:38:02 2024 Received: (at 60521) by debbugs.gnu.org; 28 Jan 2024 15:38:02 +0000 Received: from localhost ([127.0.0.1]:58200 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rU7EP-0008Vn-8C for submit@debbugs.gnu.org; Sun, 28 Jan 2024 10:38:02 -0500 Received: from confino.investici.org ([93.190.126.19]:23815) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rU7EM-0008Ve-U6 for 60521@debbugs.gnu.org; Sun, 28 Jan 2024 10:38:00 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=autistici.org; s=stigmate; t=1706456270; bh=FcEDQey+E3FAcp4H5tQF4JT4WyMR/8JM0AvYIrDcnv0=; h=From:To:Cc:Subject:Date:From; b=Phrtxtcc1qEG8TvNDhIVHxiEpknijwk9ZI3PBkXCu00P7X6cmUlWsHKqr4TpPsuhp Fx9pJIfV4Ce8h4d/eGaERTkAPX+vYoZyvfbDdUhVIN/ATc6eZ9Taf4It7VZNzlTwCR ZWNAPqcFWlPjzblUyGtl/uuDWiu9y2tOZuZbupaM= Received: from mx1.investici.org (unknown [127.0.0.1]) by confino.investici.org (Postfix) with ESMTP id 4TNFtk2mrcz10wK; Sun, 28 Jan 2024 15:37:50 +0000 (UTC) Received: from [93.190.126.19] (mx1.investici.org [93.190.126.19]) (Authenticated sender: goodoldpaul@autistici.org) by localhost (Postfix) with ESMTPSA id 4TNFtk1k2tz10wB; Sun, 28 Jan 2024 15:37:50 +0000 (UTC) From: Giacomo Leidi To: 60521@debbugs.gnu.org Subject: [PATCH v7] home: Add home-dotfiles-service. Date: Sun, 28 Jan 2024 16:37:16 +0100 Message-ID: <20240128153716.20514-1-goodoldpaul@autistici.org> X-Mailer: git-send-email 2.41.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 60521 Cc: Giacomo Leidi , =?UTF-8?q?Ludovic=20Court=C3=A8s?= X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) * gnu/home/services.scm: New file; (dotfiles-for-app): new variable; (home-dotfiles-configuration): new variable; (home-dotfiles-service-type): new variable. * gnu/local.mk (GNU_SYSTEM_MODULES): Add it. * po/guix/POTFILES.in: Add it. * doc/guix.texi: Document it. Change-Id: I6769169cfacefc3842faa5b31bee081c56c28743 Co-authored-by: Ludovic Courtès --- doc/guix.texi | 108 +++++++++++++++++++++++++++++ gnu/home/services/dotfiles.scm | 120 +++++++++++++++++++++++++++++++++ gnu/local.mk | 1 + po/guix/POTFILES.in | 1 + 4 files changed, 230 insertions(+) create mode 100644 gnu/home/services/dotfiles.scm diff --git a/doc/guix.texi b/doc/guix.texi index db0c751ded..c723631abe 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -44204,6 +44204,114 @@ to use alternative services to implement more advanced use cases like read-only home. Feel free to experiment and share your results. @end defvar +It is often the case that Guix Home users already have a setup for versioning +their user configuration files (also known as @emph{dotfiles}) in a single +directory, and some way of automatically deploy changes to their user home. + +The @code{home-dotfiles-service-type} from @code{(gnu home services dotfiles)} +is designed to ease the way into using Guix Home for this kind of users, +allowing them to point the service to their dotfiles directory, which must +follow the layout suggested by +@uref{https://www.gnu.org/software/stow/, GNU Stow}, +and have their dotfiles automatically deployed to their user home, without +migrating them to Guix native configurations. + +The dotfiles directory layout is expected to be structured as follows. Please +keep in mind that it is advisable to keep your dotfiles directories under +version control, for example in the same repository where you'd track your +Guix Home configuration. + +@example +~$ tree -a ./dotfiles/ +dotfiles/ +├── git +│ └── .gitconfig +├── gpg +│ └── .gnupg +│ ├── gpg-agent.conf +│ └── gpg.conf +├── guile +│ └── .guile +├── guix +│ └── .config +│ └── guix +│ └── channels.scm +├── nix +│ ├── .config +│ │ └── nixpkgs +│ │ └── config.nix +│ └── .nix-channels +├── tmux +│ └── .tmux.conf +└── vim + └── .vimrc + +13 directories, 10 files +@end example + +For an informal specification please refer to the Stow manual +(@pxref{Top,,, stow, Introduction}). A suitable configuration would then +be: + +@lisp +(home-environment + ;; @dots{} + (services + (service home-dotfiles-service-type + (home-dotfiles-configuration + (directories (list "./dotfiles")))))) +@end lisp + +The expected home directory state would then be: + +@example +. +├── .config +│ ├── guix +│ │ └── channels.scm +│ └── nixpkgs +│ └── config.nix +├── .gitconfig +├── .gnupg +│ ├── gpg-agent.conf +│ └── gpg.conf +├── .guile +├── .nix-channels +├── .tmux.conf +└── .vimrc +@end example + +@defvar home-dotfiles-service-type +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 users that already track their dotfiles under some kind of version +control. This service allows users to point Guix Home to their dotfiles +directory and have their files automatically deployed to their home directory +just like Stow would, without migrating all of their dotfiles to Guix native +configurations. +@end defvar + +@deftp {Data Type} home-dotfiles-configuration +Available @code{home-dotfiles-configuration} fields are: + +@table @asis +@item @code{source-directory} (default: @code{(current-source-directory)}) +The path where dotfile directories are resolved. By default dotfile directories +are resolved relative the source location where +@code{home-dotfiles-configuration} appears. + +@item @code{directories} (type: list-of-strings) +The list of dotfiles directories where @code{home-dotfiles-service-type} will +look for application dotfiles. + +@item @code{exclude} (default: @code{'(".*~" ".*\\.swp" "\\.git" "\\.gitignore")}) +The list of file patterns @code{home-dotfiles-service-type} will exclude while +visiting each one of the @code{directories}. + +@end table + +@end deftp + @defvar home-xdg-configuration-files-service-type The service is very similar 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/dotfiles.scm b/gnu/home/services/dotfiles.scm new file mode 100644 index 0000000000..7226b6bcff --- /dev/null +++ b/gnu/home/services/dotfiles.scm @@ -0,0 +1,120 @@ +;;; GNU Guix --- Functional package management for GNU +;;; Copyright © 2024 Ludovic Courtès +;;; Copyright © 2024 Giacomo Leidi +;;; +;;; This file is part of GNU Guix. +;;; +;;; GNU Guix is free software; you can redistribute it and/or modify it +;;; under the terms of the GNU General Public License as published by +;;; the Free Software Foundation; either version 3 of the License, or (at +;;; your option) any later version. +;;; +;;; GNU Guix is distributed in the hope that it will be useful, but +;;; WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;;; GNU General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with GNU Guix. If not, see . + +(define-module (gnu home services dotfiles) + #:use-module (gnu home services) + #:use-module (gnu services) + #:autoload (guix build utils) (find-files) + #:use-module (guix gexp) + #:use-module (guix records) + #:use-module ((guix utils) #:select (current-source-directory)) + #:use-module (srfi srfi-1) + #:use-module (ice-9 ftw) + #:use-module (ice-9 regex) + #:export (home-dotfiles-service-type + home-dotfiles-configuration + home-dotfiles-configuration? + home-dotfiles-configuration-source-directory + home-dotfiles-configuration-directories + home-dotfiles-configuration-excluded)) + +(define %home-dotfiles-excluded + '(".*~" + ".*\\.swp" + "\\.git" + "\\.gitignore")) + +(define-record-type* + home-dotfiles-configuration make-home-dotfiles-configuration + home-dotfiles-configuration? + (source-directory home-dotfiles-configuration-source-directory + (default (current-source-directory)) + (innate)) + (directories home-dotfiles-configuration-directories ;list of strings + (default '())) + (excluded home-dotfiles-configuration-excluded ;list of strings + (default %home-dotfiles-excluded))) + +(define (import-dotfiles directory files) + "Return a list of objects compatible with @code{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 DIRECTORY and mapping its contents to the +user's home directory, excluding files that match any of the patterns in EXCLUDED." + (define (strip file) + (string-join + (cdr + (string-split (string-drop file (+ 1 (string-length directory))) + #\/)) + "/")) + (define (format file) + ;; Remove from FILE characters that cannot be used in the store. + (string-append + "home-dotfiles-" + (string-map (lambda (chr) + (if (and (char-set-contains? char-set:ascii chr) + (char-set-contains? char-set:graphic chr) + (not (memv chr '(#\. #\/ #\space)))) + chr + #\-)) + file))) + + (map (lambda (file) + (let ((stripped (strip file))) + (list stripped + (local-file file (format stripped) + #:recursive? #t)))) + files)) + +(define (home-dotfiles-configuration->files config) + "Return a list of objects compatible with @code{home-files-service-type}'s +value, generated following GNU Stow's algorithm for each of the +directories in CONFIG, excluding files that match any of the patterns configured." + (define excluded + (home-dotfiles-configuration-excluded config)) + (define exclusion-rx + (make-regexp (string-append "^.*(" (string-join excluded "|") ")$"))) + + (define (directory-contents directory) + (find-files directory + (lambda (file stat) + (not (regexp-exec exclusion-rx + (basename file)))))) + + (define (resolve directory) + ;; Resolve DIRECTORY relative to the 'source-directory' field of CONFIG. + (if (string-prefix? "/" directory) + directory + (in-vicinity (home-dotfiles-configuration-source-directory config) + directory))) + + (append-map (lambda (directory) + (let* ((directory (resolve directory)) + (contents (directory-contents directory))) + (import-dotfiles directory contents))) + (home-dotfiles-configuration-directories config))) + +(define-public home-dotfiles-service-type + (service-type (name 'home-dotfiles) + (extensions + (list (service-extension home-files-service-type + home-dotfiles-configuration->files))) + (default-value (home-dotfiles-configuration)) + (description "Files that will be put in the user's home directory +following GNU Stow's algorithm, and further processed during activation."))) diff --git a/gnu/local.mk b/gnu/local.mk index ab63bd5881..f11c65277e 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -96,6 +96,7 @@ GNU_SYSTEM_MODULES = \ %D%/home/services.scm \ %D%/home/services/desktop.scm \ %D%/home/services/dict.scm \ + %D%/home/services/dotfiles.scm \ %D%/home/services/symlink-manager.scm \ %D%/home/services/fontutils.scm \ %D%/home/services/gnupg.scm \ diff --git a/po/guix/POTFILES.in b/po/guix/POTFILES.in index 154ad4e530..d13e19619d 100644 --- a/po/guix/POTFILES.in +++ b/po/guix/POTFILES.in @@ -14,6 +14,7 @@ gnu/services/samba.scm gnu/services/version-control.scm gnu/home/services.scm gnu/home/services/desktop.scm +gnu/home/services/dotfiles.scm gnu/home/services/fontutils.scm gnu/home/services/gnupg.scm gnu/home/services/guix.scm base-commit: 8ae8b9804fa4aef23d4028563559bf7bec52fec2 -- 2.41.0 From debbugs-submit-bounces@debbugs.gnu.org Sun Jan 28 16:03:01 2024 Received: (at 60521-done) by debbugs.gnu.org; 28 Jan 2024 21:03:01 +0000 Received: from localhost ([127.0.0.1]:58434 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rUCIv-0000ss-23 for submit@debbugs.gnu.org; Sun, 28 Jan 2024 16:03:01 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:41308) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rUCIs-0000sg-MU for 60521-done@debbugs.gnu.org; Sun, 28 Jan 2024 16:02:59 -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 ) id 1rUCIe-0001f1-Mj; Sun, 28 Jan 2024 16:02:44 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:Date:References:In-Reply-To:Subject:To: From; bh=vfHwfg5bAL9wLKgJlgOShylGxP2dPPcVwm+z6iP5syU=; b=QLA4GiVdhb1kUIU073Sj dmiZOXV+pKcFYxWPMnPMn1mLOYTCxTkFfwL+obvAi8HhX77/0Lp3OZDcElMuogUb1e5v4IqoxCMAo gOCjpRyQjvPwdRC7AVs3jPPRgQqTwjlcPfNsB/BPmbxLDeMotIa4wMjNFjPWnBhmcRDPaSco0H2e5 MabkVsLoHCZh1MRg0+9zISNlxOvAzhlXBKNTqaIBBuhv2uP2+72s1ZeenO/BSULr1/eBXJoVG7Ykh mzwf49U5C+2Lw3YY/un3K3sq7czpXhp0FO7HCimsmi3DW+6qs968QaGDa3S0RlbrwMv5LlJNlvT50 U0WouOiGQYmSJQ==; From: =?utf-8?Q?Ludovic_Court=C3=A8s?= To: Giacomo Leidi Subject: Re: [bug#60521] [PATCH v7] home: Add home-dotfiles-service. In-Reply-To: <20240128153716.20514-1-goodoldpaul@autistici.org> (Giacomo Leidi's message of "Sun, 28 Jan 2024 16:37:16 +0100") References: <0a8d7bce31856292baa06a08260494c0@autistici.org> <20240128153716.20514-1-goodoldpaul@autistici.org> Date: Sun, 28 Jan 2024 22:02:31 +0100 Message-ID: <877cjtf9y0.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 60521-done Cc: 60521-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hi, Giacomo Leidi skribis: > * gnu/home/services.scm: New file; > (dotfiles-for-app): new variable; > (home-dotfiles-configuration): new variable; > (home-dotfiles-service-type): new variable. > * gnu/local.mk (GNU_SYSTEM_MODULES): Add it. > * po/guix/POTFILES.in: Add it. > * doc/guix.texi: Document it. > > Change-Id: I6769169cfacefc3842faa5b31bee081c56c28743 > Co-authored-by: Ludovic Court=C3=A8s Committed with the change below (perhaps a mistake I had introduced myself before) and with a slightly modified commit log. I=E2=80=99m switching my laptop=E2=80=99s config now. :-) Thanks for all the work, and thanks for your patience! Ludo=E2=80=99. --=-=-= Content-Type: text/x-patch Content-Disposition: inline diff --git a/gnu/home/services/dotfiles.scm b/gnu/home/services/dotfiles.scm index 7226b6bcff..6a740c42ce 100644 --- a/gnu/home/services/dotfiles.scm +++ b/gnu/home/services/dotfiles.scm @@ -58,11 +58,8 @@ (define (import-dotfiles directory files) generated by recursively visiting DIRECTORY and mapping its contents to the user's home directory, excluding files that match any of the patterns in EXCLUDED." (define (strip file) - (string-join - (cdr - (string-split (string-drop file (+ 1 (string-length directory))) - #\/)) - "/")) + (string-drop file (+ 1 (string-length directory)))) + (define (format file) ;; Remove from FILE characters that cannot be used in the store. (string-append --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Sun Jan 28 16:14:37 2024 Received: (at 60521-done) by debbugs.gnu.org; 28 Jan 2024 21:14:37 +0000 Received: from localhost ([127.0.0.1]:58440 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rUCU9-00019G-Et for submit@debbugs.gnu.org; Sun, 28 Jan 2024 16:14:37 -0500 Received: from confino.investici.org ([93.190.126.19]:36001) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rUCU7-000197-5d for 60521-done@debbugs.gnu.org; Sun, 28 Jan 2024 16:14:36 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=autistici.org; s=stigmate; t=1706476465; bh=39GJSskQk94im1DNZ4855QSYzBO0zaOfxL+5ZOS2gls=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=Z20gcyUwURdjhWSIoYzUl5rrCfw2SicoPDfXVAZ4NH1FahPsSwEiOkBbZr+wTbpEO 79hwPF5xiJoXDBLn2EbsZCw3IOCjmwrOtAxJC08y+CUH7yw2R4RPvhxEJ9GC8cETLG Oe1rCtJ4cFCbWoXzFIuJwASVvezA4aaZu8fLyiEQ= Received: from mx1.investici.org (unknown [127.0.0.1]) by confino.investici.org (Postfix) with ESMTP id 4TNPM56VS5z10x7; Sun, 28 Jan 2024 21:14:25 +0000 (UTC) Received: from [93.190.126.19] (mx1.investici.org [93.190.126.19]) (Authenticated sender: goodoldpaul@autistici.org) by localhost (Postfix) with ESMTPSA id 4TNPM54mYJz10x2; Sun, 28 Jan 2024 21:14:25 +0000 (UTC) Message-ID: <2f62f4fa-9a3e-ea69-54e3-0b5ddfbf3336@autistici.org> Date: Sun, 28 Jan 2024 22:14:24 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.15.0 Subject: Re: [bug#60521] [PATCH v7] home: Add home-dotfiles-service. To: =?UTF-8?Q?Ludovic_Court=c3=a8s?= References: <0a8d7bce31856292baa06a08260494c0@autistici.org> <20240128153716.20514-1-goodoldpaul@autistici.org> <877cjtf9y0.fsf@gnu.org> Content-Language: en-US From: paul In-Reply-To: <877cjtf9y0.fsf@gnu.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Score: -3.8 (---) X-Debbugs-Envelope-To: 60521-done Cc: 60521-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -4.8 (----) Hi Ludo' , that was an intentional fix I introduced after trying your code and having my home break :) . I just believe we are not aligned on the requirements. Does a tree -a call to your dotfiles directory resemble what is documented in the manual? We either need to change the manual or the code, I don't have a clear preference . At this point I'm just happy this is in Guix but right now the manual matches Stow's usual directory layout. The code in this state contradicts the documentation and does not take into account the additional "git" directory given dotfiles directory that looks like this:  tree -a dotfiles/ dotfiles/ └── git     └── .gitconfig 2 directories, 1 file Thank you for your time, giacomo From debbugs-submit-bounces@debbugs.gnu.org Sun Jan 28 16:22:42 2024 Received: (at 60521-done) by debbugs.gnu.org; 28 Jan 2024 21:22:42 +0000 Received: from localhost ([127.0.0.1]:58445 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rUCby-0001Lp-Fi for submit@debbugs.gnu.org; Sun, 28 Jan 2024 16:22:42 -0500 Received: from confino.investici.org ([93.190.126.19]:27437) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rUCbw-0001Lh-Uq for 60521-done@debbugs.gnu.org; Sun, 28 Jan 2024 16:22:41 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=autistici.org; s=stigmate; t=1706476952; bh=Mm0ftaNRbwAmEj5JGTofPoY980OPJ05jWxH+WV7/y7c=; h=Date:Subject:From:To:Cc:References:In-Reply-To:From; b=AWJDNdDEh/ahmjY3O/nKB+RQ9LRMQq5ubtv1RWF6v4WMI4mVuH259nXVih3/Md4Qi 9IA1OW3Uj2953fKJxgWQE2Vrz26fXYjPbR5QUtpclJyy6KYZAOvnyZ15pDItj21DJ3 zQ5EG5O5Scl73lPj5B+ECJaVTzAcOeNg3A9ngerA= Received: from mx1.investici.org (unknown [127.0.0.1]) by confino.investici.org (Postfix) with ESMTP id 4TNPXS3qKLz10wn; Sun, 28 Jan 2024 21:22:32 +0000 (UTC) Received: from [93.190.126.19] (mx1.investici.org [93.190.126.19]) (Authenticated sender: goodoldpaul@autistici.org) by localhost (Postfix) with ESMTPSA id 4TNPXS1q9nz10v7; Sun, 28 Jan 2024 21:22:31 +0000 (UTC) Message-ID: <180136e2-75cb-79dc-54e7-44dd5ae1e41d@autistici.org> Date: Sun, 28 Jan 2024 22:22:31 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.15.0 Subject: Re: [bug#60521] [PATCH v7] home: Add home-dotfiles-service. Content-Language: en-US From: paul To: =?UTF-8?Q?Ludovic_Court=c3=a8s?= References: <0a8d7bce31856292baa06a08260494c0@autistici.org> <20240128153716.20514-1-goodoldpaul@autistici.org> <877cjtf9y0.fsf@gnu.org> <2f62f4fa-9a3e-ea69-54e3-0b5ddfbf3336@autistici.org> In-Reply-To: <2f62f4fa-9a3e-ea69-54e3-0b5ddfbf3336@autistici.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: -3.8 (---) X-Debbugs-Envelope-To: 60521-done Cc: 60521-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -4.8 (----) If I can add this is [0] the layout that is documented in the manual, that Stow suggests and that I'm trying to implement. If you have something else in mind could you please share your layout? Thank you giacomo [0]: https://gitlab.com/orang3/guix-home/-/tree/main/fishinthecalculator/etc From debbugs-submit-bounces@debbugs.gnu.org Mon Jan 29 08:20:55 2024 Received: (at 60521) by debbugs.gnu.org; 29 Jan 2024 13:20:55 +0000 Received: from localhost ([127.0.0.1]:59286 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rURZG-0003LM-Jb for submit@debbugs.gnu.org; Mon, 29 Jan 2024 08:20:54 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:54506) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rURZE-0003L3-MW for 60521@debbugs.gnu.org; Mon, 29 Jan 2024 08:20:53 -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 ) id 1rURYz-0003gn-3i; Mon, 29 Jan 2024 08:20:37 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:Date:References:In-Reply-To:Subject:To: From; bh=d/Xga8amFmoc7VoXu6+Qi2jAJ3Nh+vSnQysYb7NMuZ4=; b=IFdMw25vIhEasYfEkCZc 6tzzCMrl5WdA0fUyEg4SNyi3ZScnErELKkbG4u8jon6hS20OGp0SMbR01aqgyXHC+qksmPOCvs1jj nnLrOq5JGAVnUC8XBdTdPzyB5iNy/X8637KNvgPROg3B8Sb69HvUoTRmTt2I2u8aMk/6OSfpEKOvI 8RQQ0g+3LB8pH49u6pN3hCdTjV4L/6KuqUttPUB8SO15eLPWPkeuXSTVaGfzw+zedpwVdVUFy9sBU utWDurJgExm6i9Ajwvl9hVzaw5mMmt2SS1zvbpdAdLncp/GjFK1iWN6QXqaiYq+f1bHxs0raw6VKA E+CrMFo0nbzwcQ==; From: =?utf-8?Q?Ludovic_Court=C3=A8s?= To: Sergey Trofimov Subject: Re: [bug#60521] [PATCH] home: Add home-stow-migration-service. In-Reply-To: <87ede27c9f.fsf@sarg.org.ru> (Sergey Trofimov's message of "Sat, 27 Jan 2024 21:21:02 +0100") References: <87ede27c9f.fsf@sarg.org.ru> X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: =?utf-8?Q?D=C3=A9cadi?= 10 =?utf-8?Q?Pluvi=C3=B4se?= an 232 de la =?utf-8?Q?R=C3=A9volution=2C?= jour de la =?utf-8?Q?Cogn=C3=A9e?= 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, 29 Jan 2024 14:20:10 +0100 Message-ID: <87a5ooqnsl.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -1.6 (-) X-Debbugs-Envelope-To: 60521 Cc: Giacomo Leidi , andrew@trop.in, 60521@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.6 (--) Sergey Trofimov skribis: > (define* (as-local-files dir #:optional (trim-prefix dir)) > (let ((absolute-dir (string-append (getcwd) "/" dir)) > (to-trim (string-append (getcwd) "/" trim-prefix "/"))) > (map (lambda (fn) > (list > (del-prefix to-trim fn) > (local-file (canonicalize-path fn) (del-prefix "."=20 > (basename fn)) #:recursive? #t))) > (find-files absolute-dir)))) As you saw, I proposed a different solution: capturing (current-source-directory) in =E2=80=98home-dotfiles-configuration=E2=80=99= and using that to compute absolute file names (without ever calling =E2=80=98canonicalize-path=E2=80=99). Using =E2=80=98getcwd=E2=80=99 would be incorrect or at least surprising: i= t would resolve file names relative to the current directory instead of relative to the directory that contains the source file. Ludo=E2=80=99. From debbugs-submit-bounces@debbugs.gnu.org Mon Jan 29 08:56:20 2024 Received: (at 60521) by debbugs.gnu.org; 29 Jan 2024 13:56:20 +0000 Received: from localhost ([127.0.0.1]:59334 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rUS7Y-0007I7-Dv for submit@debbugs.gnu.org; Mon, 29 Jan 2024 08:56:20 -0500 Received: from mail-ej1-x62d.google.com ([2a00:1450:4864:20::62d]:54276) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rUS7V-0007Hq-DY for 60521@debbugs.gnu.org; Mon, 29 Jan 2024 08:56:19 -0500 Received: by mail-ej1-x62d.google.com with SMTP id a640c23a62f3a-a35e65df2d8so69085266b.0 for <60521@debbugs.gnu.org>; Mon, 29 Jan 2024 05:56:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sarg.org.ru; s=google; t=1706536563; x=1707141363; darn=debbugs.gnu.org; h=content-transfer-encoding:mime-version:message-id:in-reply-to:date :subject:cc:to:from:user-agent:references:from:to:cc:subject:date :message-id:reply-to; bh=rC8XRiGY4pSyKkxQ0tjDZaDMn4PZgDVNKG/AuM0DD/k=; b=HwkXoqFPLq9n1aTjcYNUKJJ7ssX9IUI+eFb5nuXwka02fvunWCciSSFasQDxPUs11K mCHYDUL6u5LGHrWvK2dXYfJU+Clz3FTKbqadpUewG/XypE88gI33xqeopHgI7LO/+1ni /oUPShsrDtB+VJnbH+lTJ6EhsCYN6oQsvzA04= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706536563; x=1707141363; h=content-transfer-encoding:mime-version:message-id:in-reply-to:date :subject:cc:to:from:user-agent:references:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=rC8XRiGY4pSyKkxQ0tjDZaDMn4PZgDVNKG/AuM0DD/k=; b=N99ch9xI1296gNvuebsmECBJERpu0wRuf7e/vvPXXO60X5FGXIsXn4eI/He89cd8vY 4IGmefQBAZj1hQbJTHe66C1Qxma5o016QH3n9dZzZ8A3faXloCwTplAMWjtjgHsA1ZbK 0zFPKZGjp8fiE9TARfGDPqC/EZPiIOSgAiM2SnNfI4ONdTIQ/McfQERyrCquMbK7K9s9 ANLqkrnZ9aQ+tg8uPqkV0U11bZrAQvB7ZDw56DPixwr5qF1VIiQV+pBYEbh4hHA9yXwb zhkdXdDAiTetUDKtjN+SFuRRB/OAXEthJQo5rX03KYM6NqJwkokiFCbT5ipCL1wR4fNw Gesg== X-Gm-Message-State: AOJu0YwSruSDD32qr+HJnPlbhYmStmyTGc2j6klulXXHVKWqOh05OxxV sWXoSD8l/O8O6AfqgE1jinp7EDQaKS/qQJkthNKcEw/yFXQkubWKsqFhtFAdvWA= X-Google-Smtp-Source: AGHT+IGMAUP39DejBh05yLSqf18RCmwMnioP6A567LW2mCWsRYl3W+O2zvWJLCfUcdkPcGoybyz4sQ== X-Received: by 2002:a17:906:6d44:b0:a35:4664:8830 with SMTP id a4-20020a1709066d4400b00a3546648830mr4063552ejt.0.1706536562673; Mon, 29 Jan 2024 05:56:02 -0800 (PST) Received: from localhost ([2a02:2454:a09d:d000:3f1e:a87:ccd2:4aec]) by smtp.gmail.com with ESMTPSA id ss6-20020a170907c00600b00a3535b76c42sm3009317ejc.15.2024.01.29.05.56.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Jan 2024 05:56:02 -0800 (PST) References: <87ede27c9f.fsf@sarg.org.ru> <87a5ooqnsl.fsf@gnu.org> User-agent: mu4e 1.10.8; emacs 29.1 From: Sergey Trofimov To: Ludovic =?utf-8?Q?Court=C3=A8s?= Subject: Re: [bug#60521] [PATCH] home: Add home-stow-migration-service. Date: Mon, 29 Jan 2024 14:40:29 +0100 In-reply-to: <87a5ooqnsl.fsf@gnu.org> Message-ID: <878r48451r.fsf@sarg.org.ru> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Score: 0.7 (/) X-Debbugs-Envelope-To: 60521 Cc: Giacomo Leidi , andrew@trop.in, 60521@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.3 (/) Ludovic Courtès writes: > Sergey Trofimov skribis: > >> (define* (as-local-files dir #:optional (trim-prefix dir)) >> (let ((absolute-dir (string-append (getcwd) "/" dir)) >> (to-trim (string-append (getcwd) "/" trim-prefix "/"))) >> (map (lambda (fn) >> (list >> (del-prefix to-trim fn) >> (local-file (canonicalize-path fn) (del-prefix "." >> (basename fn)) #:recursive? #t))) >> (find-files absolute-dir)))) > > As you saw, I proposed a different solution: capturing > (current-source-directory) in ‘home-dotfiles-configuration’ and > using > that to compute absolute file names (without ever calling > ‘canonicalize-path’). > > Using ‘getcwd’ would be incorrect or at least surprising: it > would > resolve file names relative to the current directory instead of > relative > to the directory that contains the source file. > Sure, in my config I use `with-directory-excursion`, so `getcwd` returns correct values. Anyway, the reason I replied was that I am also a former Stow user and in my eyes we should've extended existing `home-files-service-type` instead of making a specialized new one. If you check `stow` manual (https://www.gnu.org/software/stow/manual/html_node/Invoking-Stow.html#Invoking-Stow), it should be invoked with the names of packages to be installed/removed. `home-dotfiles-service` doesn't have a parameter for the list of packages and assumes that everything in the specified directory should be installed, a limitation that prevents me to start using it. In my dotfiles I have optional packages which I install depending on OS or machine's purpose. Sure the service could be amended with the said parameter, but why adding a new service when a more generic one exists and is fitting the use case? From debbugs-submit-bounces@debbugs.gnu.org Mon Jan 29 09:23:20 2024 Received: (at 60521) by debbugs.gnu.org; 29 Jan 2024 14:23:20 +0000 Received: from localhost ([127.0.0.1]:59356 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rUSXf-0007zk-Ug for submit@debbugs.gnu.org; Mon, 29 Jan 2024 09:23:20 -0500 Received: from confino.investici.org ([93.190.126.19]:36789) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rUSXe-0007zb-58 for 60521@debbugs.gnu.org; Mon, 29 Jan 2024 09:23:19 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=autistici.org; s=stigmate; t=1706538187; bh=gD5UMfp9+kxcMy94bJK6wKurBiBu0n95WxCnb2qNpH0=; h=Date:From:To:CC:Subject:In-Reply-To:References:From; b=C07jY+/UQ1T/gwRe68nNkWotvg0D8fGQBfUR21vrGoyCBrWadrHP8mHquFjRwShmZ aJ+15ygbOxknY74mgsPUm5Xc9NzbCjWMwTvxVCVGYzLOSqGBHR+r5r4a4h8IpVQ/6L cFM68C9Enuq6Jnd/6xjA1fjGDmICD+euvDlbW9yk= Received: from mx1.investici.org (unknown [127.0.0.1]) by confino.investici.org (Postfix) with ESMTP id 4TNrB36ZzJz10ww; Mon, 29 Jan 2024 14:23:07 +0000 (UTC) Received: from [93.190.126.19] (mx1.investici.org [93.190.126.19]) (Authenticated sender: goodoldpaul@autistici.org) by localhost (Postfix) with ESMTPSA id 4TNrB35Pq1z10wr; Mon, 29 Jan 2024 14:23:07 +0000 (UTC) Date: Mon, 29 Jan 2024 15:23:07 +0100 From: Giacomo To: Sergey Trofimov , =?ISO-8859-1?Q?Ludovic_Court=E8s?= Subject: Re: [bug#60521] [PATCH] home: Add home-stow-migration-service. User-Agent: K-9 Mail for Android In-Reply-To: <878r48451r.fsf@sarg.org.ru> References: <87ede27c9f.fsf@sarg.org.ru> <87a5ooqnsl.fsf@gnu.org> <878r48451r.fsf@sarg.org.ru> Message-ID: MIME-Version: 1.0 Content-Type: multipart/alternative; boundary=----4F1YR40U3ETF7PWM8RH0ITC9DLMLAK Content-Transfer-Encoding: 7bit X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 60521 Cc: andrew@trop.in, 60521@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) ------4F1YR40U3ETF7PWM8RH0ITC9DLMLAK Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hi Ludo' and Sergey, I'm not sure my previous emails reached you since I sent them to the -done= address of the bug=2E I'm pasting The code that was reverted was an intentional fix I introduced after tryin= g the latest revision and having my home break :) =2E I just believe we are= not aligned on the requirements=2E Ludo': does a tree -a call to your dotf= iles directory resemble what is documented in the manual? We either need to change the manual or the code, I don't have a clear pref= erence =2E At this point I'm just happy this is in Guix but right now the m= anual matches Stow's usual directory layout=2E The code in this state contr= adicts the documentation and does not take into account the additional "git= " directory given dotfiles directory that looks like this: tree -a dotfiles/ dotfiles/ =E2=94=94=E2=94=80=E2=94=80 git =E2=94=94=E2=94=80=E2=94=80 =2Egitconfig 2 directories, 1 file this is [0] the layout that is documented in the manual, that Stow suggest= s and that I'm trying to implement=2E If you have something else in mind co= uld you please share your layout? Thank you giacomo [0]: https://gitlab=2Ecom/orang3/guix-home/-/tree/main/fishinthecalculator= /etc ------4F1YR40U3ETF7PWM8RH0ITC9DLMLAK Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable
Hi Ludo' and Sergey,
I'm no= t sure my previous emails reached you since I sent them to the -done addres= s of the bug=2E I'm pasting

The code that was reverted was an intent= ional fix I introduced after trying the latest revision and having my home = break :) =2E I just believe we are not aligned on the requirements=2E Ludo'= : does a tree -a call to your dotfiles directory resemble what is documente= d in the manual?

We either need to change the manual or the code, I = don't have a clear preference =2E At this point I'm just happy this is in G= uix but right now the manual matches Stow's usual directory layout=2E The c= ode in this state contradicts the documentation and does not take into acco= unt the additional "git" directory given dotfiles directory that looks like= this:

tree -a dotfiles/
dotfiles/
=E2=94=94=E2=94=80=E2=94= =80 git
=E2=94=94=E2=94=80=E2=94=80 =2Egitconfig

2 directories, = 1 file

this is [0] the layout that is documented in the manual, that= Stow suggests and that I'm trying to implement=2E If you have something el= se in mind could you please share your layout?

Thank you

giac= omo


[0]: https://gitlab=2Ecom/orang3/guix-home/-/tree= /main/fishinthecalculator/etc
------4F1YR40U3ETF7PWM8RH0ITC9DLMLAK-- From debbugs-submit-bounces@debbugs.gnu.org Mon Jan 29 10:42:10 2024 Received: (at 60521) by debbugs.gnu.org; 29 Jan 2024 15:42:10 +0000 Received: from localhost ([127.0.0.1]:33268 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rUTlx-00028m-TM for submit@debbugs.gnu.org; Mon, 29 Jan 2024 10:42:10 -0500 Received: from mail-ej1-x62b.google.com ([2a00:1450:4864:20::62b]:61469) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rUTlu-00028K-OV for 60521@debbugs.gnu.org; Mon, 29 Jan 2024 10:42:08 -0500 Received: by mail-ej1-x62b.google.com with SMTP id a640c23a62f3a-a2a17f3217aso402947366b.2 for <60521@debbugs.gnu.org>; Mon, 29 Jan 2024 07:41:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sarg.org.ru; s=google; t=1706542912; x=1707147712; darn=debbugs.gnu.org; h=content-transfer-encoding:mime-version:message-id:in-reply-to:date :subject:cc:to:from:user-agent:references:from:to:cc:subject:date :message-id:reply-to; bh=7ki8s2XwdrC69DjiLq4Kvz/3fFnfNPOFjuxNWAUzjAc=; b=UCmFaT3yczbVBcVul6eAsOF74WrPY3CO8+SOcmQxhXlhd/OE1Ny9qm3Tchrt3AMVmJ jch9s1kMNYjEeFTzwPtNDpFxVgVhPbI7iFr4Xs24vPsaSsWv3Sc09Q53vk+bUbwmqPyn FvQi695/QtvuFDN//U9R4dvEtg6dG/rlmtJ1Q= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706542912; x=1707147712; h=content-transfer-encoding:mime-version:message-id:in-reply-to:date :subject:cc:to:from:user-agent:references:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=7ki8s2XwdrC69DjiLq4Kvz/3fFnfNPOFjuxNWAUzjAc=; b=qGvkNch7v7rob1DRhxqPBRSyBlw0QhXJ5DFjoCqqQA3ECaN4HrumXJAfyLnjACK3oW OsljlFm/i6ZKYUgxBixPs/V4wTIJURbIAZFfby1UyzDBGCNr6yZTzQHKmpV5tTdfskpd SZ0WYoUxqjsqwXJ/97r3z075ppEUzu0Tn0KC+GW06Zaknb7FHt+U1AYMyg96zUeZBBdv TByFsfH42SwknYltTdDLVukGSuTApXdyO52olQJaOMrO4SuR0D4u//VVII778wr29dYl fLFbmpsycdFXhbn8i0fILNOz2ZtloJeJBaCf+i9eoZ/9r94kNjWOItMAgRcQjWnP7t8y iZnw== X-Gm-Message-State: AOJu0YzdMAf0aYE6AMLjV2iF3GFwkMT4JUg+PSMZ/QEuBNA4ZhWkZpTe RglcwG4u7YvHimOf00GFp+VU7MUxYyM2uBnYGeFeIjyKtTsDkIOy3zsfbolqbFI= X-Google-Smtp-Source: AGHT+IEXVS49S2LKyFH9/n6N44X+4Z0FRSGb8nlClQ5JJb56pnikOugf/FUqSFW/cq1S6d7vKo5huQ== X-Received: by 2002:a17:906:1c55:b0:a28:7fe8:8b29 with SMTP id l21-20020a1709061c5500b00a287fe88b29mr5604544ejg.68.1706542912450; Mon, 29 Jan 2024 07:41:52 -0800 (PST) Received: from localhost ([2a02:2454:a09d:d000:3f1e:a87:ccd2:4aec]) by smtp.gmail.com with ESMTPSA id vb7-20020a170907d04700b00a34d0a865ecsm3965413ejc.163.2024.01.29.07.41.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Jan 2024 07:41:51 -0800 (PST) References: <87ede27c9f.fsf@sarg.org.ru> <87a5ooqnsl.fsf@gnu.org> <878r48451r.fsf@sarg.org.ru> User-agent: mu4e 1.10.8; emacs 29.1 From: Sergey Trofimov To: Giacomo Subject: Re: [bug#60521] [PATCH] home: Add home-stow-migration-service. Date: Mon, 29 Jan 2024 16:19:49 +0100 In-reply-to: Message-ID: <874jew405c.fsf@sarg.org.ru> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Score: 0.7 (/) X-Debbugs-Envelope-To: 60521 Cc: Ludovic =?utf-8?Q?Court=C3=A8s?= , andrew@trop.in, 60521@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.3 (/) Giacomo writes: > Hi Ludo' and Sergey, > I'm not sure my previous emails reached you since I sent them to > the -done address of the bug. I'm pasting > > We either need to change the manual or the code, I don't have a > clear preference . At this point I'm just happy this is in Guix > but > right now the manual matches Stow's usual directory layout. The > code in this state contradicts the documentation and does not > take > into account the additional "git" directory given dotfiles > directory that looks like this: > > tree -a dotfiles/ > dotfiles/ > └── git > └── .gitconfig > > 2 directories, 1 file > > this is [0] the layout that is documented in the manual, that > Stow suggests and that I'm trying to implement. I don't think stow suggests any layout. I wasn't able to find that in the manual. > If you have something else in mind could you please share your > layout? My dotfiles are at https://github.com/sarg/dotfiles/ Previously I've used `stow -d ~/.dotfiles zsh awesome git vim ...` to create the symlinks. Just to emphasize - package list is a mandatory parameter to `stow`. It should be supported by the home-dotfiles-service if it is intended as a replacement for `stow`. From debbugs-submit-bounces@debbugs.gnu.org Mon Jan 29 11:09:16 2024 Received: (at 60521) by debbugs.gnu.org; 29 Jan 2024 16:09:16 +0000 Received: from localhost ([127.0.0.1]:33282 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rUUCC-0002yv-1x for submit@debbugs.gnu.org; Mon, 29 Jan 2024 11:09:16 -0500 Received: from confino.investici.org ([2a11:7980:1::2:0]:23851) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rUUCA-0002yl-5b for 60521@debbugs.gnu.org; Mon, 29 Jan 2024 11:09:15 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=autistici.org; s=stigmate; t=1706544542; bh=V0YMA4iuQsROGA4spGoRDLdX6Jm3NkgtJfvsbxAUNYY=; h=Date:From:To:CC:Subject:In-Reply-To:References:From; b=d7ZH2+a/efX/iFxd+6vG03USciu7+0y7+0oGoNS6e0myb6516wHel2EHVAxozhQrl DCk2xLPN/QkF5hNQKtkPC1rlkBtgq9TxX4NWVncgNsOhaoJQuh3tGBOL8dYOdLyPsF 0SEH9R0uj1M5G2FOV7AMciPpc+PcuA8UNFLj5ykU= Received: from mx1.investici.org (unknown [127.0.0.1]) by confino.investici.org (Postfix) with ESMTP id 4TNtXG601Nz10yx; Mon, 29 Jan 2024 16:09:02 +0000 (UTC) Received: from [93.190.126.19] (mx1.investici.org [93.190.126.19]) (Authenticated sender: goodoldpaul@autistici.org) by localhost (Postfix) with ESMTPSA id 4TNtXG4lQSz10yr; Mon, 29 Jan 2024 16:09:02 +0000 (UTC) Date: Mon, 29 Jan 2024 17:09:02 +0100 From: Giacomo To: Sergey Trofimov Subject: Re: [bug#60521] [PATCH] home: Add home-stow-migration-service. User-Agent: K-9 Mail for Android In-Reply-To: <874jew405c.fsf@sarg.org.ru> References: <87ede27c9f.fsf@sarg.org.ru> <87a5ooqnsl.fsf@gnu.org> <878r48451r.fsf@sarg.org.ru> <874jew405c.fsf@sarg.org.ru> Message-ID: MIME-Version: 1.0 Content-Type: multipart/alternative; boundary=----K2KJPIHHI894MALBIQ2P4I5O4SAMS2 Content-Transfer-Encoding: 7bit X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 60521 Cc: =?ISO-8859-1?Q?Ludovic_Court=E8s?= , andrew@trop.in, 60521@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) ------K2KJPIHHI894MALBIQ2P4I5O4SAMS2 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hi Sergey , Whether the stow manual mandates/suggests a given layout was analyzed here= [0]=2E The workflow you describe is not the only one possible and the app list is= not mandatory=2E Only when -d is used, please look at my e-mail=2E Anyway, if the current implementation works with your directory layout cou= ld you please share your home-dotfiles-configuration? I don't seem to be able to make this implementation work with my layout=2E Thank you, giacomo [0]: https://issues=2Eguix=2Egnu=2Eorg/60521#13 ------K2KJPIHHI894MALBIQ2P4I5O4SAMS2 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable
Hi Sergey ,

Whether the= stow manual mandates/suggests a given layout was analyzed here [0]=2E
<= br>The workflow you describe is not the only one possible and the app list = is not mandatory=2E Only when -d is used, please look at my e-mail=2E
Anyway, if the current implementation works with your directory layout co= uld you please share your home-dotfiles-configuration?

I don't seem = to be able to make this implementation work with my layout=2E

Thank = you,

giacomo

[0]: https://issues=2Eguix=2Egnu=2Eorg/60521#13
------K2KJPIHHI894MALBIQ2P4I5O4SAMS2-- From debbugs-submit-bounces@debbugs.gnu.org Mon Jan 29 11:10:30 2024 Received: (at 60521) by debbugs.gnu.org; 29 Jan 2024 16:10:31 +0000 Received: from localhost ([127.0.0.1]:33287 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rUUDO-00030y-IR for submit@debbugs.gnu.org; Mon, 29 Jan 2024 11:10:30 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:45230) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rUUDM-00030m-Dc for 60521@debbugs.gnu.org; Mon, 29 Jan 2024 11:10:29 -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 ) id 1rUUD6-0002bP-Tt; Mon, 29 Jan 2024 11:10:13 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:Date:References:In-Reply-To:Subject:To: From; bh=bzcq2DcAgc2qbkZNR6sjxYHMnPOwsS9kurDdOMqmZG8=; b=HfLFBQP16a/h9gevOEro 0eoW4RwG9ZHK2jA1dnWrLfi2OyZPlJQOfnhC0DaCKHWkFtHZxOUkYX8p2EkQ5XrTAmks3P7fyyEIc /D84XGQ0cuDvEo7/2K/7tNGQNHLPvDawkLyGTIA9iwvwbsNMlqGu6BY4HWn5Uyjd6CZyp7zQEEhI2 RgFoSHxTGSLzT5uEHB+Lvx1NhQ/FNixmmwpkDO9oT01+2lXVIzT3B7DW7SEKu/Pb9Mh7L94uz9ign /7YfpdpSv4bJ9svgMvN37shjvQaPqct2ufIuAS/o+0Ye0Z3q+Hly8ZzvpAxiUI9B7FIric+BKF2Wq b5tmaD8mszWV4w==; From: =?utf-8?Q?Ludovic_Court=C3=A8s?= To: Sergey Trofimov Subject: Re: [bug#60521] [PATCH] home: Add home-stow-migration-service. In-Reply-To: <878r48451r.fsf@sarg.org.ru> (Sergey Trofimov's message of "Mon, 29 Jan 2024 14:40:29 +0100") References: <87ede27c9f.fsf@sarg.org.ru> <87a5ooqnsl.fsf@gnu.org> <878r48451r.fsf@sarg.org.ru> X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: =?utf-8?Q?D=C3=A9cadi?= 10 =?utf-8?Q?Pluvi=C3=B4se?= an 232 de la =?utf-8?Q?R=C3=A9volution=2C?= jour de la =?utf-8?Q?Cogn=C3=A9e?= 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, 29 Jan 2024 17:10:10 +0100 Message-ID: <87a5oonmsd.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -1.6 (-) X-Debbugs-Envelope-To: 60521 Cc: Giacomo Leidi , andrew@trop.in, 60521@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.6 (--) Hi, Sergey Trofimov skribis: > Anyway, the reason I replied was that I am also a former Stow user and > in my eyes we should've extended existing `home-files-service-type` > instead of making a specialized new one. =E2=80=98home-dotfiles-service-type=E2=80=99 technically does extend =E2=80=98home-files-service-type=E2=80=99. > If you check `stow` manual > (https://www.gnu.org/software/stow/manual/html_node/Invoking-Stow.html#In= voking-Stow), > it should be invoked with the names of packages to be > installed/removed. `home-dotfiles-service` doesn't have a parameter > for the list of packages and assumes that everything in the specified > directory should be installed, a limitation that prevents me to start > using it. In my dotfiles I have optional packages which I install > depending on OS or machine's purpose. Sure the service could be > amended with the said parameter, but why adding a new service when a > more generic one exists and is fitting the use case? The way I see it, =E2=80=98home-dotfiles-service-type=E2=80=99 makes it eas= ier to do what one could have done with raw =E2=80=98home-files-service-type=E2=80=99= . The interface is nice IMO. Now, we can still change the implementation as we see fit, and for instance allow users to specify a predicate in the =E2=80=98excluded=E2=80= =99 field, or anything that would help address your use case. WDYT? Ludo=E2=80=99. From debbugs-submit-bounces@debbugs.gnu.org Mon Jan 29 13:43:49 2024 Received: (at 60521) by debbugs.gnu.org; 29 Jan 2024 18:43:50 +0000 Received: from localhost ([127.0.0.1]:33462 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rUWbl-0001ZI-Ge for submit@debbugs.gnu.org; Mon, 29 Jan 2024 13:43:49 -0500 Received: from mail-lf1-x129.google.com ([2a00:1450:4864:20::129]:51502) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rUWbi-0001Z3-Fy for 60521@debbugs.gnu.org; Mon, 29 Jan 2024 13:43:48 -0500 Received: by mail-lf1-x129.google.com with SMTP id 2adb3069b0e04-51032e62171so2773345e87.3 for <60521@debbugs.gnu.org>; Mon, 29 Jan 2024 10:43:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sarg.org.ru; s=google; t=1706553812; x=1707158612; darn=debbugs.gnu.org; h=mime-version:message-id:in-reply-to:date:subject:cc:to:from :user-agent:references:from:to:cc:subject:date:message-id:reply-to; bh=ZekFMyiitKc6as4C2YTv5e7MBP/Mhru059Me+ouN8Kk=; b=OjmtoqhzWx3BUXxC+q+9xGRNfDDzCN7dgMFziHmKqK+TxFCpgN/OtYSlfbhhps6Z01 mRHplNZt6eJ1J36OUFDPWj36BFCsGxjK5TqNE//OY0kql1jaZXIu8u5eUQSY+BNjGkbA JsSB7iITqtx7PJZa7doWp6rmVB554VjLMuWYM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706553812; x=1707158612; h=mime-version:message-id:in-reply-to:date:subject:cc:to:from :user-agent:references:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=ZekFMyiitKc6as4C2YTv5e7MBP/Mhru059Me+ouN8Kk=; b=O1UUrhP33hNQyQGKdYBXWEwu37zB6oOI+j5xVw4xKdOswrLupjTYbAeD8yBAlkaU4B jJX7A8yQlM6518X23U7zurceSfQYE4oNRM72vuUWr02wSfKYOexYv+a6dg7YE3zRY8ov t8aYnwFAe6LEXa7PAPpKVmUK/BvV8Y8ism/KGrbEj4dPg9fpW3OlREEIkOh9ekEHkYaC n7NafIvbaUk61pYeE0bfzHcNAFAHvA2R+8j+IiIE38JEk2jK42dY4VP+05I0ffDJnqQV DHndHL9mPY0UVP3IzqkuoWQlxYp5EpZZfugb5k3+Kr73jwLCSBe7gXOh7K5v749buoiE RNkQ== X-Gm-Message-State: AOJu0Yy9OWskCviQHt1W5bPlycLk/VguqB33sY2xSbThIg+mz5IK5Icl prndoypV+OS+i4lfDQy9pLvDteK1NqAJczoz2guU8slRPgyIxZexK4JWoK6lgcI= X-Google-Smtp-Source: AGHT+IH3adcc87/OF7YXZxZugnMaHkkliBqvraX8VBQJT7+PHmdpb85SyHzI1BqWuLnV5PgtadWeFA== X-Received: by 2002:a05:651c:150d:b0:2cd:6c0c:4c8b with SMTP id e13-20020a05651c150d00b002cd6c0c4c8bmr6178184ljf.46.1706553811829; Mon, 29 Jan 2024 10:43:31 -0800 (PST) Received: from localhost ([2a02:2454:a09d:d000:3f1e:a87:ccd2:4aec]) by smtp.gmail.com with ESMTPSA id ch19-20020a5d5d13000000b00337b47ae539sm8761615wrb.42.2024.01.29.10.43.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Jan 2024 10:43:31 -0800 (PST) References: <87ede27c9f.fsf@sarg.org.ru> <87a5ooqnsl.fsf@gnu.org> <878r48451r.fsf@sarg.org.ru> <874jew405c.fsf@sarg.org.ru> User-agent: mu4e 1.10.8; emacs 29.1 From: Sergey Trofimov To: Giacomo Subject: Re: [bug#60521] [PATCH] home: Add home-stow-migration-service. Date: Mon, 29 Jan 2024 19:34:57 +0100 In-reply-to: Message-ID: <87zfwo2d65.fsf@sarg.org.ru> MIME-Version: 1.0 Content-Type: text/plain; format=flowed X-Spam-Score: 0.7 (/) X-Debbugs-Envelope-To: 60521 Cc: Ludovic =?utf-8?Q?Court=C3=A8s?= , andrew@trop.in, 60521@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.3 (/) Giacomo writes: > Hi Sergey , > > Whether the stow manual mandates/suggests a given layout was > analyzed here [0]. > > The workflow you describe is not the only one possible and the > app list is not mandatory. Only when -d is used, please look at > my > e-mail. I might be missing it, but how can I make stow do its job without specifying which packages to install? --8<---------------cut here---------------start------------->8--- stow (GNU Stow) version 2.3.1 SYNOPSIS: stow [OPTION ...] [-D|-S|-R] PACKAGE ... [-D|-S|-R] PACKAGE ... --8<---------------cut here---------------end--------------->8--- When I omit the package list from the command it returns "stow: No packages to stow or unstow" > > Anyway, if the current implementation works with your directory > layout could you please share your home-dotfiles-configuration? > Don't use it yet, because it only supports exlusions and I need "inclusions". This would work, but doesn't look pretty --8<---------------cut here---------------start------------->8--- (service home-dotfiles-service-type (home-dotfiles-configuration (directories (list "..")) (excluded (list "\\.git" "README.md" "emacs" "xmonad" ...)))) --8<---------------cut here---------------end--------------->8--- This would be optimal: --8<---------------cut here---------------start------------->8--- (service home-dotfiles-service-type (home-dotfiles-configuration (packages (list "../backup" "../android" ...)))) --8<---------------cut here---------------end--------------->8--- From debbugs-submit-bounces@debbugs.gnu.org Wed Jan 31 07:32:06 2024 Received: (at 60521) by debbugs.gnu.org; 31 Jan 2024 12:32:06 +0000 Received: from localhost ([127.0.0.1]:37638 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rV9l8-00006T-Cg for submit@debbugs.gnu.org; Wed, 31 Jan 2024 07:32:06 -0500 Received: from confino.investici.org ([93.190.126.19]:26963) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rV9l6-00006I-6m for 60521@debbugs.gnu.org; Wed, 31 Jan 2024 07:32:05 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=autistici.org; s=stigmate; t=1706704313; bh=gwaKgJHN1PD3cxzVVCkyJhL/QcMM9KaeCNdsS08uarA=; h=Date:From:To:CC:Subject:In-Reply-To:References:From; b=ShgoBbgCA4c0ZuAzDBCd9jhK0GDmZ08KNCcleVThB1zLX3ziJonDtnq//BpLGVX/W /gUYZVkf6jEkhonuDhfYZaNuhTEk+q5Zvnc1oqfq/hFUd/gUS6wDL2fZsCjgPFPHF+ OGmtj/2IA5LqFEaoSSRf0CWqknMbAHqtjSjF3Ue4= Received: from mx1.investici.org (unknown [127.0.0.1]) by confino.investici.org (Postfix) with ESMTP id 4TQ1cn2Sddz118d; Wed, 31 Jan 2024 12:31:53 +0000 (UTC) Received: from [93.190.126.19] (mx1.investici.org [93.190.126.19]) (Authenticated sender: goodoldpaul@autistici.org) by localhost (Postfix) with ESMTPSA id 4TQ1cn1CSwz118c; Wed, 31 Jan 2024 12:31:53 +0000 (UTC) Date: Wed, 31 Jan 2024 13:31:52 +0100 From: Giacomo To: Janneke Nieuwenhuizen , bug-guix@gnu.org Subject: Re: New home-dotfiles-service-type creates extra toplevel directories User-Agent: K-9 Mail for Android In-Reply-To: <87cythy9wq.fsf@gnu.org> References: <87cythy9wq.fsf@gnu.org> Message-ID: MIME-Version: 1.0 Content-Type: multipart/alternative; boundary=----JZTR5UE2TAIT8I426Q70T1GBLJCCQL Content-Transfer-Encoding: 7bit X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 60521 Cc: ludo@gnu.org, sarg@sarg.org.ru, 60521@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) ------JZTR5UE2TAIT8I426Q70T1GBLJCCQL Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hi Janneke, thank you for the report=2E I already pointed out this at https= ://issues=2Eguix=2Egnu=2Eorg/60521 =2E there was a fix that was removed by = a misunderstanding on the requirements of the service since the code contra= dicts documentation as you pointed out =2E It should be pretty easy to appl= y the fix from 60521=2E Thank you Giacomo Il 31 gennaio 2024 13:17:25 CET, Janneke Nieuwenhuizen = ha scritto: >Hi, > >When I follow the documentation, and have > > dotfiles/guix/=2Econfig/guix/channels=2Escm > >that shows suing tree -a =2E/dotfiles > > dotfiles > =E2=94=94=E2=94=80=E2=94=80 guix > =E2=94=94=E2=94=80=E2=94=80 =2Econfig > =E2=94=94=E2=94=80=E2=94=80 guix > =E2=94=94=E2=94=80=E2=94=80 channels=2Escm > >similar to the documentaion, and using > > (service home-dotfiles-service-type > (home-dotfiles-configuration > (directories (list "=2E/dotfiles")))) > >creates > > ~/guix/=2Econfig/guix/channels=2Escm > >an extra toplevel `guix" directory! > >What gives? > >Greetings, >Janneke > >--=20 >Janneke Nieuwenhuizen | GNU LilyPond https://LilyPon= d=2Eorg >Freelance IT https://www=2EJoyOfSource=2Ecom | Avatar=C2=AE https://Avata= rAcademy=2Ecom ------JZTR5UE2TAIT8I426Q70T1GBLJCCQL Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable
Hi Janneke, thank you for the re= port=2E I already pointed out this at https://issues=2Eguix=2Egnu=2Eorg/60521=C2=A0=2E there w= as a fix that was removed by a misunderstanding on the requirements of the = service since the code contradicts documentation as you pointed out =2E It = should be pretty easy to apply the fix from 60521=2E

Thank you
Giacomo


Il 31 g= ennaio 2024 13:17:25 CET, Janneke Nieuwenhuizen <janneke@gnu=2Eorg> h= a scritto:
Hi,

When I follow the docum= entation, and have

dotfiles/guix/=2Econfig/guix/channels=2Escm
that shows suing tree -a =2E/dotfiles

dotfiles
=E2= =94=94=E2=94=80=E2=94=80 guix
=E2=94=94=E2=94=80=E2=94=80 =2Econ= fig
=E2=94=94=E2=94=80=E2=94=80 guix
=E2= =94=94=E2=94=80=E2=94=80 channels=2Escm

similar to the documentaion,= and using

(service home-dotfiles-service-type
(= home-dotfiles-configuration
(directories (list "=2E/dotfi= les"))))

creates

~/guix/=2Econfig/guix/channels=2Escm
=
an extra toplevel `guix" directory!

What gives?

Greetings= ,
Janneke

------JZTR5UE2TAIT8I426Q70T1GBLJCCQL-- From debbugs-submit-bounces@debbugs.gnu.org Wed Feb 07 17:17:31 2024 Received: (at 60521) by debbugs.gnu.org; 7 Feb 2024 22:17:31 +0000 Received: from localhost ([127.0.0.1]:58125 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rXqEV-0003Ql-9x for submit@debbugs.gnu.org; Wed, 07 Feb 2024 17:17:31 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:55808) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rXqET-0003QY-M1 for 60521@debbugs.gnu.org; Wed, 07 Feb 2024 17:17:30 -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 ) id 1rXqE6-0002Te-Pw; Wed, 07 Feb 2024 17:17:06 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:Date:References:In-Reply-To:Subject:To: From; bh=fzpYtCWFkN7w4azNncjGR5yLohbhh7MHlzHnIn60MNU=; b=OQ9v/aPylfy7m0qRaVwn AG0UjvqTE9gk45R2Zn12fAnTkzYXEF8hVWxXrKhQ7oUVR5AWoFd8Eq74qRxXySC68Wr9VSIciUyY0 76WJnBg+1sVKcT3T/1EPgvkQBmv9oRL/YGbQ7rirogWQAHZQfhIpSwNhmDteHjyTmwG541soRi7zT 2mtGDrmI++KR3Ma/pgOswl1bhdFtzZpLZH5kJROqcfqrIlGCPTybz6mI7GALu6OaYAwjKQZfEWo8S nHFThIT0eR6Z0XAJQ4ylVLP0njmrxvl+RN6R2fkU95azzZqe8wqPi5dX4hwRzA23QS3WNcuwtQhbD GF5A9daAncwB8g==; From: =?utf-8?Q?Ludovic_Court=C3=A8s?= To: Giacomo Subject: Dot file layout for =?utf-8?Q?=E2=80=98home-dotfiles-service?= =?utf-8?Q?=E2=80=99?= In-Reply-To: (Giacomo's message of "Mon, 29 Jan 2024 15:23:07 +0100") References: <87ede27c9f.fsf@sarg.org.ru> <87a5ooqnsl.fsf@gnu.org> <878r48451r.fsf@sarg.org.ru> Date: Wed, 07 Feb 2024 23:17:02 +0100 Message-ID: <87le7v3oo1.fsf_-_@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) 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: Sergey Trofimov , 60521@debbugs.gnu.org, andrew@trop.in X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Hi! Oops, my sincere apologies if I ended up =E2=80=9Cfixing=E2=80=9D something= that was in fact intentional, effectively breaking it. Giacomo skribis: > The code that was reverted was an intentional fix I introduced after tryi= ng the latest revision and having my home break :) . I just believe we are = not aligned on the requirements. Ludo': does a tree -a call to your dotfile= s directory resemble what is documented in the manual? > > We either need to change the manual or the code, I don't have a clear pre= ference . At this point I'm just happy this is in Guix but right now the ma= nual matches Stow's usual directory layout. The code in this state contradi= cts the documentation and does not take into account the additional "git" d= irectory given dotfiles directory that looks like this: > > tree -a dotfiles/ > dotfiles/ > =E2=94=94=E2=94=80=E2=94=80 git > =E2=94=94=E2=94=80=E2=94=80 .gitconfig > > 2 directories, 1 file Nope! --8<---------------cut here---------------start------------->8--- $ guix shell tree -- tree -a dot-files/ dot-files/ =E2=94=9C=E2=94=80=E2=94=80 .dico =E2=94=9C=E2=94=80=E2=94=80 .gitconfig =E2=94=9C=E2=94=80=E2=94=80 .gnupg =E2=94=82=C2=A0=C2=A0 =E2=94=9C=E2=94=80=E2=94=80 dirmngr.conf =E2=94=82=C2=A0=C2=A0 =E2=94=9C=E2=94=80=E2=94=80 gpa.conf =E2=94=82=C2=A0=C2=A0 =E2=94=9C=E2=94=80=E2=94=80 gpg.conf =E2=94=82=C2=A0=C2=A0 =E2=94=94=E2=94=80=E2=94=80 .gpg-v21-migrated =E2=94=9C=E2=94=80=E2=94=80 .Xdefaults =E2=94=94=E2=94=80=E2=94=80 .xsession --8<---------------cut here---------------end--------------->8--- So I guess I totally misunderstood the goal; sorry about that! Where do we go from here? Should we just adjust the manual to match this? Or the other way around, at the cost of breaking user config? Or adding an option to choose between these two layouts? Thanks, Ludo=E2=80=99. From debbugs-submit-bounces@debbugs.gnu.org Thu Feb 08 19:45:46 2024 Received: (at 60521) by debbugs.gnu.org; 9 Feb 2024 00:45:46 +0000 Received: from localhost ([127.0.0.1]:44163 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rYF1V-00069c-RJ for submit@debbugs.gnu.org; Thu, 08 Feb 2024 19:45:46 -0500 Received: from confino.investici.org ([93.190.126.19]:20581) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rYF1U-00069Q-9Q for 60521@debbugs.gnu.org; Thu, 08 Feb 2024 19:45:44 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=autistici.org; s=stigmate; t=1707439528; bh=gNysMcqA18aDQyQSk1XLvWdfBvDO2T63oUQj4HTc/sE=; h=Date:Subject:From:To:Cc:References:In-Reply-To:From; b=MtnPcKSQhZNwMm+l8SVfe66cEdDWKoAWPEF4sPCexlpH1YK0kHxhmtjLyvRGU9ZUM Ql+oHIXGevh89ky1HEsCsGv3WhM+EhGYLIlKv+z7i5YKK1QCieQUySITZmiD78wsae GMInfokmF96FWYEBL/ftXT67CYcIfwRw014DwVAA= Received: from mx1.investici.org (unknown [127.0.0.1]) by confino.investici.org (Postfix) with ESMTP id 4TWFWX4B60z115t; Fri, 9 Feb 2024 00:45:28 +0000 (UTC) Received: from [93.190.126.19] (mx1.investici.org [93.190.126.19]) (Authenticated sender: goodoldpaul@autistici.org) by localhost (Postfix) with ESMTPSA id 4TWFWX2ZFFz115n; Fri, 9 Feb 2024 00:45:28 +0000 (UTC) Content-Type: multipart/alternative; boundary="------------jcRi0mEPOwBeVOKd2yIJ7J2P" Message-ID: <440e04ac-2ab1-6dbe-6b3c-0ce5fcc43d9d@autistici.org> Date: Fri, 9 Feb 2024 01:45:28 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.15.0 Subject: =?UTF-8?Q?Re=3a_Dot_file_layout_for_=e2=80=98home-dotfiles-service?= =?UTF-8?B?4oCZ?= Content-Language: en-US From: paul To: =?UTF-8?Q?Ludovic_Court=c3=a8s?= References: <87ede27c9f.fsf@sarg.org.ru> <87a5ooqnsl.fsf@gnu.org> <878r48451r.fsf@sarg.org.ru> <87le7v3oo1.fsf_-_@gnu.org> In-Reply-To: X-Spam-Score: -3.8 (---) X-Debbugs-Envelope-To: 60521 Cc: janneke@gnu.org, Sergey Trofimov , 60521@debbugs.gnu.org, andrew@trop.in X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -4.8 (----) This is a multi-part message in MIME format. --------------jcRi0mEPOwBeVOKd2yIJ7J2P Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit I said I would include Janneke but obviously I didn't :) . Sorry for the noise On 2/9/24 01:44, paul wrote: > > Hi Ludo', > > On 2/7/24 23:17, Ludovic Courtès wrote: >> Hi! >> >> Oops, my sincere apologies if I ended up “fixing” something that was in >> fact intentional, effectively breaking it. > Don't worry I think there's been a misunderstanding from the beginning > and I was not able to explain myself . Sh*t happens :) >> Should we just adjust the manual to match >> this? > I think that doing so would defeat the original purpose of supporting > the de facto standard used by Stow users >> Or the other way around, at the cost of breaking user config? > This is really about what one means by breaking, we already received a > bug report at https://issues.guix.gnu.org/68848 which in my opinion > indicates that we give some expectations through the manual, which is > not met by the code (I'm adding Janneke to this thread so that we are > all aligned and can reach consensus). >> Or adding an option to choose between these two layouts? > This is the best option forward, in my opinion. It is flexible and > allows for a both for the current simplified layout (without the > per-application layer of directories typical of Stow) and the Stow > default one. > > If there's consensus my next steps would be: > > 1. Apply Janneke's stylistic suggestion at > https://issues.guix.gnu.org/68857 allowing us to close > https://issues.guix.gnu.org/68848 and align the code with the manual > > 2. Add a layout field to home-dotfiles-configuration that allows for > the simplified layout described by Ludo' in his last email, something > like this > > $ guix shell tree -- tree -a dot-files/ > dot-files/ > ├── .dico > ├── .gitconfig > ├── .gnupg > │   ├── dirmngr.conf > │   ├── gpa.conf > │   ├── gpg.conf > │   └── .gpg-v21-migrated > ├── .Xdefaults > └── .xsession > > the default would be the current layout but this would allow for more > flexibility in layouts in the future. > > 3. Possibly add an included-applications (the name is just a proposal) > to support Sergey's use case of selecting a subset of application > dotfiles to provision in the user's home > > what do you think about this plan? > > thank you all for your help and your time > > giacomo > --------------jcRi0mEPOwBeVOKd2yIJ7J2P Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 8bit

I said I would include Janneke but obviously I didn't :) . Sorry for the noise

On 2/9/24 01:44, paul wrote:

Hi Ludo',

On 2/7/24 23:17, Ludovic Courtès wrote:
Hi!

Oops, my sincere apologies if I ended up “fixing” something that was in
fact intentional, effectively breaking it.
Don't worry I think there's been a misunderstanding from the beginning and I was not able to explain myself . Sh*t happens :)
Should we just adjust the manual to match
this?
I think that doing so would defeat the original purpose of supporting the de facto standard used by Stow users
Or the other way around, at the cost of breaking user config?
This is really about what one means by breaking, we already received a bug report at https://issues.guix.gnu.org/68848 which in my opinion indicates that we give some expectations through the manual, which is not met by the code (I'm adding Janneke to this thread so that we are all aligned and can reach consensus).
 Or adding an option to choose between these two layouts?
This is the best option forward, in my opinion. It is flexible and allows for a both for the current simplified layout (without the per-application layer of directories typical of Stow) and the Stow default one.

If there's consensus my next steps would be:

1. Apply Janneke's stylistic suggestion at https://issues.guix.gnu.org/68857 allowing us to close https://issues.guix.gnu.org/68848 and align the code with the manual

2. Add a layout field to home-dotfiles-configuration that allows for the simplified layout described by Ludo' in his last email, something like this

$ guix shell tree -- tree -a dot-files/
dot-files/
├── .dico
├── .gitconfig
├── .gnupg
│   ├── dirmngr.conf
│   ├── gpa.conf
│   ├── gpg.conf
│   └── .gpg-v21-migrated
├── .Xdefaults
└── .xsession

the default would be the current layout but this would allow for more flexibility in layouts in the future.

3. Possibly add an included-applications (the name is just a proposal) to support Sergey's use case of selecting a subset of application dotfiles to provision in the user's home

what do you think about this plan?

thank you all for your help and your time

giacomo

--------------jcRi0mEPOwBeVOKd2yIJ7J2P-- From debbugs-submit-bounces@debbugs.gnu.org Thu Feb 08 19:55:16 2024 Received: (at 60521) by debbugs.gnu.org; 9 Feb 2024 00:55:16 +0000 Received: from localhost ([127.0.0.1]:44801 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rYFAh-0006fT-4o for submit@debbugs.gnu.org; Thu, 08 Feb 2024 19:55:16 -0500 Received: from confino.investici.org ([2a11:7980:1::2:0]:34353) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rYF0K-00065z-2a for 60521@debbugs.gnu.org; Thu, 08 Feb 2024 19:44:33 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=autistici.org; s=stigmate; t=1707439454; bh=hni34xdfaQyoQ2dmP3w3Ww4pWO3c+BGm8cFAauwg/c8=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=ELJOkXKsLKrrrkeDI0sKCFG6wf97OvcEJaDoYTgXhCJubCnzS1VHUyldg6FIK3bX5 Wl/INvVWrSFSVHqkhfSXeLwb2ehT1arvIvYfCiL56+jBwm1LsBnFsnfZ6wj5SyOao3 AVuZsWrDptZtzjnWztlZlrJI68hv8u+lfggASvFI= Received: from mx1.investici.org (unknown [127.0.0.1]) by confino.investici.org (Postfix) with ESMTP id 4TWFV60rTVz115t; Fri, 9 Feb 2024 00:44:14 +0000 (UTC) Received: from [93.190.126.19] (mx1.investici.org [93.190.126.19]) (Authenticated sender: goodoldpaul@autistici.org) by localhost (Postfix) with ESMTPSA id 4TWFV56XPTz115n; Fri, 9 Feb 2024 00:44:13 +0000 (UTC) Content-Type: multipart/alternative; boundary="------------DJVpt0TtCuKYEKbWPqru5cX8" Message-ID: Date: Fri, 9 Feb 2024 01:44:13 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.15.0 Subject: =?UTF-8?Q?Re=3a_Dot_file_layout_for_=e2=80=98home-dotfiles-service?= =?UTF-8?B?4oCZ?= To: =?UTF-8?Q?Ludovic_Court=c3=a8s?= References: <87ede27c9f.fsf@sarg.org.ru> <87a5ooqnsl.fsf@gnu.org> <878r48451r.fsf@sarg.org.ru> <87le7v3oo1.fsf_-_@gnu.org> Content-Language: en-US From: paul In-Reply-To: <87le7v3oo1.fsf_-_@gnu.org> X-Spam-Score: -3.1 (---) X-Debbugs-Envelope-To: 60521 Cc: Sergey Trofimov , 60521@debbugs.gnu.org, andrew@trop.in X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -4.1 (----) This is a multi-part message in MIME format. --------------DJVpt0TtCuKYEKbWPqru5cX8 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Hi Ludo', On 2/7/24 23:17, Ludovic Courtès wrote: > Hi! > > Oops, my sincere apologies if I ended up “fixing” something that was in > fact intentional, effectively breaking it. Don't worry I think there's been a misunderstanding from the beginning and I was not able to explain myself . Sh*t happens :) > Should we just adjust the manual to match > this? I think that doing so would defeat the original purpose of supporting the de facto standard used by Stow users > Or the other way around, at the cost of breaking user config? This is really about what one means by breaking, we already received a bug report at https://issues.guix.gnu.org/68848 which in my opinion indicates that we give some expectations through the manual, which is not met by the code (I'm adding Janneke to this thread so that we are all aligned and can reach consensus). > Or adding an option to choose between these two layouts? This is the best option forward, in my opinion. It is flexible and allows for a both for the current simplified layout (without the per-application layer of directories typical of Stow) and the Stow default one. If there's consensus my next steps would be: 1. Apply Janneke's stylistic suggestion at https://issues.guix.gnu.org/68857 allowing us to close https://issues.guix.gnu.org/68848 and align the code with the manual 2. Add a layout field to home-dotfiles-configuration that allows for the simplified layout described by Ludo' in his last email, something like this $ guix shell tree -- tree -a dot-files/ dot-files/ ├── .dico ├── .gitconfig ├── .gnupg │   ├── dirmngr.conf │   ├── gpa.conf │   ├── gpg.conf │   └── .gpg-v21-migrated ├── .Xdefaults └── .xsession the default would be the current layout but this would allow for more flexibility in layouts in the future. 3. Possibly add an included-applications (the name is just a proposal) to support Sergey's use case of selecting a subset of application dotfiles to provision in the user's home what do you think about this plan? thank you all for your help and your time giacomo --------------DJVpt0TtCuKYEKbWPqru5cX8 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 8bit

Hi Ludo',

On 2/7/24 23:17, Ludovic Courtès wrote:
Hi!

Oops, my sincere apologies if I ended up “fixing” something that was in
fact intentional, effectively breaking it.
Don't worry I think there's been a misunderstanding from the beginning and I was not able to explain myself . Sh*t happens :)
Should we just adjust the manual to match
this?
I think that doing so would defeat the original purpose of supporting the de facto standard used by Stow users
Or the other way around, at the cost of breaking user config?
This is really about what one means by breaking, we already received a bug report at https://issues.guix.gnu.org/68848 which in my opinion indicates that we give some expectations through the manual, which is not met by the code (I'm adding Janneke to this thread so that we are all aligned and can reach consensus).
 Or adding an option to choose between these two layouts?
This is the best option forward, in my opinion. It is flexible and allows for a both for the current simplified layout (without the per-application layer of directories typical of Stow) and the Stow default one.

If there's consensus my next steps would be:

1. Apply Janneke's stylistic suggestion at https://issues.guix.gnu.org/68857 allowing us to close https://issues.guix.gnu.org/68848 and align the code with the manual

2. Add a layout field to home-dotfiles-configuration that allows for the simplified layout described by Ludo' in his last email, something like this

$ guix shell tree -- tree -a dot-files/
dot-files/
├── .dico
├── .gitconfig
├── .gnupg
│   ├── dirmngr.conf
│   ├── gpa.conf
│   ├── gpg.conf
│   └── .gpg-v21-migrated
├── .Xdefaults
└── .xsession

the default would be the current layout but this would allow for more flexibility in layouts in the future.

3. Possibly add an included-applications (the name is just a proposal) to support Sergey's use case of selecting a subset of application dotfiles to provision in the user's home

what do you think about this plan?

thank you all for your help and your time

giacomo

--------------DJVpt0TtCuKYEKbWPqru5cX8-- From debbugs-submit-bounces@debbugs.gnu.org Sat Feb 10 05:04:05 2024 Received: (at 60521) by debbugs.gnu.org; 10 Feb 2024 10:04:05 +0000 Received: from localhost ([127.0.0.1]:57497 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rYkDN-0002LZ-0e for submit@debbugs.gnu.org; Sat, 10 Feb 2024 05:04:05 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:34202) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rYkDL-0002L0-5j for 60521@debbugs.gnu.org; Sat, 10 Feb 2024 05:04:03 -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 ) id 1rYkCw-0007Rj-LC; Sat, 10 Feb 2024 05:03:38 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:Date:References:In-Reply-To:Subject:To: From; bh=SL1eMp0uN5sh+lpmxQLN4AiRgfaXYX/4QqliOxeapAc=; b=KMkN6sNLKuiKl9wbBo22 tLx9uJdeKMdkBB4gHWF30U/AuBMOp4JzMcwDFudXrLjjeMYULijXej6NNtnyC6VvRnZmxspWuK+cU h2fkXhW1MF0OqbdN+nzqsbW8vePWWqPzt8BRhxfBa21OlyZIOz4xLNRg+RtIqqMB08hOGPceFO849 lMU1lvnbexvKztV6TPhvoxGz4Fpgz87fIiS6eC2EbnAN9Q66nTkwILCrhsInpga8DanaOwFm5QaQN e4TPBUpkVo/+CnHiLIz5gJhmVjKc/f/8WMvSIx+tdsJycal6UB6ukozDS9DebOb4dumjTe0HTDZWr WRJbwEzT3Lsatw==; From: =?utf-8?Q?Ludovic_Court=C3=A8s?= To: paul Subject: Re: Dot file layout for =?utf-8?Q?=E2=80=98home-dotfiles-service?= =?utf-8?Q?=E2=80=99?= In-Reply-To: (paul's message of "Fri, 9 Feb 2024 01:44:13 +0100") References: <87ede27c9f.fsf@sarg.org.ru> <87a5ooqnsl.fsf@gnu.org> <878r48451r.fsf@sarg.org.ru> <87le7v3oo1.fsf_-_@gnu.org> X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: Duodi 22 =?utf-8?Q?Pluvi=C3=B4se?= an 232 de la =?utf-8?Q?R=C3=A9volution=2C?= jour du =?utf-8?Q?Thymel=C3=A9?= 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: Sat, 10 Feb 2024 11:03:36 +0100 Message-ID: <87a5o8k553.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) 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: Janneke Nieuwenhuizen , Sergey Trofimov , 60521@debbugs.gnu.org, andrew@trop.in X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Hi, paul skribis: > On 2/7/24 23:17, Ludovic Court=C3=A8s wrote: >> Hi! >> >> Oops, my sincere apologies if I ended up =E2=80=9Cfixing=E2=80=9D someth= ing that was in >> fact intentional, effectively breaking it. > Don't worry I think there's been a misunderstanding from the beginning > and I was not able to explain myself . Sh*t happens :) >> Should we just adjust the manual to match >> this? > I think that doing so would defeat the original purpose of supporting > the de facto standard used by Stow users >> Or the other way around, at the cost of breaking user config? > This is really about what one means by breaking, we already received a > bug report at https://issues.guix.gnu.org/68848 which in my opinion > indicates that we give some expectations through the manual, which is > not met by the code (I'm adding Janneke to this thread so that we are > all aligned and can reach consensus). >> Or adding an option to choose between these two layouts? > This is the best option forward, in my opinion. It is flexible and > allows for a both for the current simplified layout (without the > per-application layer of directories typical of Stow) and the Stow > default one. > > If there's consensus my next steps would be: > > 1. Apply Janneke's stylistic suggestion at > https://issues.guix.gnu.org/68857 allowing us to close > https://issues.guix.gnu.org/68848 and align the code with the manual > > 2. Add a layout field to home-dotfiles-configuration that allows for > the simplified layout described by Ludo' in his last email, something > like this > > $ guix shell tree -- tree -a dot-files/ > dot-files/ > =E2=94=9C=E2=94=80=E2=94=80 .dico > =E2=94=9C=E2=94=80=E2=94=80 .gitconfig > =E2=94=9C=E2=94=80=E2=94=80 .gnupg > =E2=94=82=C2=A0=C2=A0 =E2=94=9C=E2=94=80=E2=94=80 dirmngr.conf > =E2=94=82=C2=A0=C2=A0 =E2=94=9C=E2=94=80=E2=94=80 gpa.conf > =E2=94=82=C2=A0=C2=A0 =E2=94=9C=E2=94=80=E2=94=80 gpg.conf > =E2=94=82=C2=A0=C2=A0 =E2=94=94=E2=94=80=E2=94=80 .gpg-v21-migrated > =E2=94=9C=E2=94=80=E2=94=80 .Xdefaults > =E2=94=94=E2=94=80=E2=94=80 .xsession > > the default would be the current layout but this would allow for more > flexibility in layouts in the future. Thinking about it, either we add a =E2=80=98layout=E2=80=99 field (the defa= ult should probably be the same as it is now, to user=E2=80=99s config will still work= the same). > 3. Possibly add an included-applications (the name is just a proposal) > to support Sergey's use case of selecting a subset of application > dotfiles to provision in the user's home I=E2=80=99m not sure I understand but maybe this part can be addressed late= r. Thanks, Ludo=E2=80=99. From debbugs-submit-bounces@debbugs.gnu.org Sat Feb 10 05:47:38 2024 Received: (at 60521) by debbugs.gnu.org; 10 Feb 2024 10:47:38 +0000 Received: from localhost ([127.0.0.1]:59700 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rYktW-000448-4A for submit@debbugs.gnu.org; Sat, 10 Feb 2024 05:47:38 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:60712) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rYktT-00043q-SK for 60521@debbugs.gnu.org; Sat, 10 Feb 2024 05:47:36 -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 ) id 1rYkt0-0006eX-Ke; Sat, 10 Feb 2024 05:47:11 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:Date:References:In-Reply-To:Subject:To: From; bh=5RWQrDxDOP7hXE3iFszm0SIdeCP61O+AgbB+LN+oj/s=; b=kZ6MeyRQNsurBl63SEHN e6EPDJHdOL3GZd5soPXFlKUn7OOs380pzWzSNuZm9fxZ8yZ4Fy/MVub9w8jWH6CwTII7TOKVsiU43 PodPfKKHoquHGAdPGXe60UlP5cg4VQIk1drLQJxEl7jKvz1eUJ3oDSglhiEtRDFQYsPxV520fvHZg LyoYyBkAxEgaMqjhngrX9mSmKEY7nhC4V1jO6A+uudH7OgI5uZmaNieOmMQQ0BTvCYrvfX97PZjFF AwGOMSfVlV5D3yAjUA5KqpJbMZExnTYwQ/ejWgu78rbzqpmpq0SN6M6JYSesZrd3Mno5x1IuZrrfy RDKVw/Y6hf6IeQ==; From: Janneke Nieuwenhuizen To: Ludovic =?utf-8?Q?Court=C3=A8s?= Subject: Re: Dot file layout for =?utf-8?Q?=E2=80=98home-dotfiles-service?= =?utf-8?Q?=E2=80=99?= In-Reply-To: <87a5o8k553.fsf@gnu.org> ("Ludovic =?utf-8?Q?Court=C3=A8s=22'?= =?utf-8?Q?s?= message of "Sat, 10 Feb 2024 11:03:36 +0100") Organization: AvatarAcademy.nl References: <87ede27c9f.fsf@sarg.org.ru> <87a5ooqnsl.fsf@gnu.org> <878r48451r.fsf@sarg.org.ru> <87le7v3oo1.fsf_-_@gnu.org> <87a5o8k553.fsf@gnu.org> X-Url: http://AvatarAcademy.nl Date: Sat, 10 Feb 2024 11:47:02 +0100 Message-ID: <87il2w7g0p.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) 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: paul , Sergey Trofimov , 60521@debbugs.gnu.org, andrew@trop.in X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Ludovic Court=C3=A8s writes: Hi, > paul skribis: > >> On 2/7/24 23:17, Ludovic Court=C3=A8s wrote: >>> Hi! >>> >>> Oops, my sincere apologies if I ended up =E2=80=9Cfixing=E2=80=9D somet= hing that was in >>> fact intentional, effectively breaking it. [..] >> $ guix shell tree -- tree -a dot-files/ >> dot-files/ >> =E2=94=9C=E2=94=80=E2=94=80 .dico >> =E2=94=9C=E2=94=80=E2=94=80 .gitconfig >> =E2=94=9C=E2=94=80=E2=94=80 .gnupg >> =E2=94=82=C2=A0=C2=A0 =E2=94=9C=E2=94=80=E2=94=80 dirmngr.conf >> =E2=94=82=C2=A0=C2=A0 =E2=94=9C=E2=94=80=E2=94=80 gpa.conf >> =E2=94=82=C2=A0=C2=A0 =E2=94=9C=E2=94=80=E2=94=80 gpg.conf >> =E2=94=82=C2=A0=C2=A0 =E2=94=94=E2=94=80=E2=94=80 .gpg-v21-migrated >> =E2=94=9C=E2=94=80=E2=94=80 .Xdefaults >> =E2=94=94=E2=94=80=E2=94=80 .xsession >> >> the default would be the current layout but this would allow for more >> flexibility in layouts in the future. > > Thinking about it, either we add a =E2=80=98layout=E2=80=99 field (the de= fault should > probably be the same as it is now, to user=E2=80=99s config will still wo= rk the > same). +1 Having a layout 'default (or 'plain) vs 'stow makes sense to me. I can understand how using this stow layout is nice for stow users, but the extra "package-name" directory that I had to add makes little sense to me. I added it because this is what the documentation prescribed, but I would probably be removing those extra "pacage-name" directories. Greetings, Janneke --=20 Janneke Nieuwenhuizen | GNU LilyPond https://LilyPond.org Freelance IT https://www.JoyOfSource.com | Avatar=C2=AE https://AvatarAcade= my.com From unknown Sun Jun 22 08:11:16 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Sat, 09 Mar 2024 12:24:06 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator