From patchwork Fri Jun 24 10:26:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Andrew Tropin X-Patchwork-Id: 40285 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id D423127BBEA; Fri, 24 Jun 2022 11:28:42 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,SPF_HELO_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 2F22C27BBE9 for ; Fri, 24 Jun 2022 11:28:42 +0100 (BST) Received: from localhost ([::1]:58052 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o4gYL-0005T1-71 for patchwork@mira.cbaines.net; Fri, 24 Jun 2022 06:28:41 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39102) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o4gWp-0005E2-3r for guix-patches@gnu.org; Fri, 24 Jun 2022 06:27:07 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:47049) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o4gWk-0008KY-Gl for guix-patches@gnu.org; Fri, 24 Jun 2022 06:27:06 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1o4gWk-0002QO-CB for guix-patches@gnu.org; Fri, 24 Jun 2022 06:27:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#53603] [PATCH v2] doc: Add files, xdg-configuration and symlink-manager home services. Resent-From: Andrew Tropin Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 24 Jun 2022 10:27:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 53603 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Ludovic =?utf-8?q?Court=C3=A8s?= Cc: 53603@debbugs.gnu.org, nick@const.fun Received: via spool by 53603-submit@debbugs.gnu.org id=B53603.16560663939247 (code B ref 53603); Fri, 24 Jun 2022 10:27:02 +0000 Received: (at 53603) by debbugs.gnu.org; 24 Jun 2022 10:26:33 +0000 Received: from localhost ([127.0.0.1]:40932 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o4gWG-0002P4-Va for submit@debbugs.gnu.org; Fri, 24 Jun 2022 06:26:33 -0400 Received: from relay2-d.mail.gandi.net ([217.70.183.194]:55305) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o4gWF-0002Or-MC for 53603@debbugs.gnu.org; Fri, 24 Jun 2022 06:26:32 -0400 Received: (Authenticated sender: andrew@trop.in) by mail.gandi.net (Postfix) with ESMTPSA id D939440017; Fri, 24 Jun 2022 10:26:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=trop.in; s=gm1; t=1656066385; 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=KkxiPTu3mQNR4L+AyAUWPgeFQbUWUjRDsmAiWASGG4c=; b=honnqa03YNu2lkRWRzDiNAt6Nu1uOGJsEQ9hF+zlsldPLQsZuokAFzBrrB6OTh9RqcXU1+ Kad4pUYH/ZbFRKKeTrnEv2w/nfKVNc54VqYZHWG0zxTaFThiVnDJf8upC/dx8zorpBbSVv 2e9gVATGp6vuht99moVnRLeK4llZClF1E/UclQvxUPxl9bNaAdl5OeiZC6vgMxaUJpNwhA 0DhR8iquIs7GuRoONvQEl1Z4P6SkDFC3XNbKhVCZS9/Nmr4O75I86sroEUSnNteZaQZRPw ybgv+bMKkaPEkV1pO6BhXoqpTxBPAeN4TihDRS5brN2Wtj6UKm5QaZBF/PQDQg== From: Andrew Tropin In-Reply-To: <87a6a53rn5.fsf@gnu.org> References: <87zgngm5wm.fsf@trop.in> <87a6a53rn5.fsf@gnu.org> Date: Fri, 24 Jun 2022 13:26:21 +0300 Message-ID: <87h74abbn6.fsf@trop.in> MIME-Version: 1.0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches On 2022-06-22 12:43, Ludovic Courtès wrote: > Hi Andrew, > > Andrew Tropin skribis: > >> * doc/guix.texi (Essential Home Services): Add files and symlink-manager home >> services. >> --- >> doc/guix.texi | 65 +++++++++++++++++++++++++++++++++++++++++++++++++++ >> 1 file changed, 65 insertions(+) >> >> diff --git a/doc/guix.texi b/doc/guix.texi >> index c94f85589f..2edea2c943 100644 >> --- a/doc/guix.texi >> +++ b/doc/guix.texi >> @@ -37500,12 +37500,77 @@ users @emph{should not} use this service, in most cases it's better to extend >> the required command using the appropriate service type. >> @end defvr >> >> +@defvr {Scheme Variable} home-files-service-type >> +The service of this type allows to specify a list of files, which will >> +go to @file{~/.guix-home/files}, usually it contains configuration files >> +(to be more precise it contains symlinks to files in @file{/gnu/store}), >> +which should be placed in @file{$XDG_CONFIG_DIR} or in rare cases in >> +@file{$HOME}. It accepts extension values in the following format: >> + >> +@lisp >> +`(("config/sway/config" ,sway-file-like-object) >> + ("config/tmux/tmux.conf" ,(local-file "./tmux.conf"))) >> +@end lisp > > I think you wrote it shortly before ‘home-files-service-type’ was > changed to not prepend a dot to file names. > > Would you like to update it and resubmit? That’d be a welcome addition. Sure. Here we go: From 7190711d98687973c6b75d6e3b75dbc466282801 Mon Sep 17 00:00:00 2001 From: Andrew Tropin Date: Fri, 28 Jan 2022 14:52:12 +0300 Subject: [PATCH v2] doc: Add files, xdg-configuration and symlink-manager home services. * doc/guix.texi (Essential Home Services): Add files, xdg-configuration-files and symlink-manager home services. --- doc/guix.texi | 83 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 83 insertions(+) diff --git a/doc/guix.texi b/doc/guix.texi index 43a5fc85bd..d099e6bf61 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -39411,12 +39411,95 @@ users @emph{should not} use this service, in most cases it's better to extend the required command using the appropriate service type. @end defvr +@defvr {Scheme Variable} home-files-service-type +The service of this type allows to specify a list of files, which will +go to @file{~/.guix-home/files}, usually this directory contains +configuration files (to be more precise it contains symlinks to files in +@file{/gnu/store}), which should be placed in @file{$XDG_CONFIG_DIR} or +in rare cases in @file{$HOME}. It accepts extension values in the +following format: + +@lisp +`((".sway/config" ,sway-file-like-object) + (".tmux.conf" ,(local-file "./tmux.conf"))) +@end lisp + +Each nested list contains two values: a subdirectory and file-like +object. After building a home environment @file{~/.guix-home/files} +will be populated with apropiate content and all nested directories will +be created accordingly, however, those files won't go any further until +some other service will do it. By default a +@code{home-symlink-manager-service-type}, which creates necessary +symlinks in home folder to files from @file{~/.guix-home/files} and +backs up already existing, but clashing configs and other things, is a +part of essential home services (enabled by default), but it's possible +to use alternative services to implement more advanced use cases like +read-only home. Feel free to experiment and share your results. +@end defvr + +@defvr {Scheme Variable} home-xdg-configuration-files-service-type +The service is very similiar to @code{home-files-service-type} (and +actually extends it), but used for defining files, which will go to +@file{~/.guix-home/files/.config}, which will be symlinked to +@file{$XDG_CONFIG_DIR} by @code{home-symlink-manager-service-type} (for +example) during activation. It accepts extension values in the +following format: + +@lisp +`(("sway/config" ,sway-file-like-object) + ;; -> ~/.guix-home/files/.config/sway/config + ;; -> $XDG_CONFIG_DIR/sway/config (by symlink-manager) + ("tmux/tmux.conf" ,(local-file "./tmux.conf"))) +@end lisp +@end defvr + @defvr {Scheme Variable} home-activation-service-type The service of this type generates a guile script, which runs on every @command{guix home reconfigure} invocation or any other action, which leads to the activation of the home environment. @end defvr +@defvr {Scheme Variable} home-symlink-manager-service-type +The service of this type generates a guile script, which will be +executed during activation of home environment, and do a few following +steps: + +@enumerate +@item +Reads the content of @file{files/} directory of current and pending home +environments. + +@item +Cleans up all symlinks created by symlink-manager on previous +activation. Also, sub-directories, which become empty also will be +cleaned up. + +@item +Creates new symlinks the following way: It looks @file{files/} directory +(usually defined with @code{home-files-service-type}, +@code{home-xdg-configuration-files-service-type} and maybe some others), +takes the files from @file{files/.config/} subdirectory and put +respective links in @env{XDG_CONFIG_DIR}. For example symlink for +@file{files/.config/sway/config} will end up in +@file{$XDG_CONFIG_DIR/sway/config}. The rest files in @file{files/} +outside of @file{files/.config/} subdirectory will be treated slightly +different: symlink will just go to @file{$HOME}. +@file{files/.some-program/config} will end up in +@file{$HOME/.some-program/config}. + +@item +If some sub-directories are missing, they will be created. + +@item +If there is a clashing files on the way, they will be backed up. + +@end enumerate + +symlink-manager is a part of essential home services and is enabled and +used by default. +@end defvr + + @node Shells Home Services @subsection Shells -- 2.36.1