From patchwork Fri Jan 28 11:52:12 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Tropin X-Patchwork-Id: 36856 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 4B32B27BBEA; Fri, 28 Jan 2022 13:15:11 +0000 (GMT) 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,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL, SPF_HELO_PASS 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 C1E4927BBE9 for ; Fri, 28 Jan 2022 13:15:10 +0000 (GMT) Received: from localhost ([::1]:48294 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nDR5p-0004Bt-Qt for patchwork@mira.cbaines.net; Fri, 28 Jan 2022 08:15:09 -0500 Received: from eggs.gnu.org ([209.51.188.92]:33436) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nDPrG-0005GW-TL for guix-patches@gnu.org; Fri, 28 Jan 2022 06:56:03 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:36515) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nDPrG-00049W-IU for guix-patches@gnu.org; Fri, 28 Jan 2022 06:56:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nDPrG-0006LA-HM for guix-patches@gnu.org; Fri, 28 Jan 2022 06:56:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#53603] [PATCH] doc: Add files and symlink-manager home services. Resent-From: Andrew Tropin Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 28 Jan 2022 11:56:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 53603 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 53603@debbugs.gnu.org Cc: nick@const.fun X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.164337091824303 (code B ref -1); Fri, 28 Jan 2022 11:56:02 +0000 Received: (at submit) by debbugs.gnu.org; 28 Jan 2022 11:55:18 +0000 Received: from localhost ([127.0.0.1]:57651 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nDPqX-0006Ju-NI for submit@debbugs.gnu.org; Fri, 28 Jan 2022 06:55:17 -0500 Received: from lists.gnu.org ([209.51.188.17]:41096) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nDPqW-0006Jl-0Y for submit@debbugs.gnu.org; Fri, 28 Jan 2022 06:55:17 -0500 Received: from eggs.gnu.org ([209.51.188.92]:33376) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nDPqU-0002wW-4s for guix-patches@gnu.org; Fri, 28 Jan 2022 06:55:15 -0500 Received: from [2a00:1450:4864:20::22f] (port=42679 helo=mail-lj1-x22f.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nDPqR-0003sc-W9 for guix-patches@gnu.org; Fri, 28 Jan 2022 06:55:13 -0500 Received: by mail-lj1-x22f.google.com with SMTP id a25so8641100lji.9 for ; Fri, 28 Jan 2022 03:55:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=trop-in.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version; bh=0QJH52hDggkwWpxbQEOG6mYlDlh2LRhPqQRZYVkVc30=; b=CsVyRQl6ZpKuSNzebV+i+QQLUfMxw5NPpJbkYxaiei3vXIMNQu8KTvtAtY3oKdajlJ SSwSQ9C2uFtEHgXPNY3HIUa+0GxOTn4jNxz6H1WoNXsVzYaJM2JhndYnxHW5Etn4dI8t oWPFHnEBU8WYNXJKL78EsqVHqmJf3wTM9YorYUwz2wRjfkZFE/RuChAzrTlsNxNta2he IMrEnMvL1YjmCd+nn/4ZynhgAHWzZ2A91A8SItDD8NS9Dp/GrzNbgkXX1kdncMkhlt8T ttnFrg2jwHaAZbW4cczWGj7BSQBI5n9LeZX9NjS8wOYn0gHY2XSHGNpPQ59SlVBXJKZL qhbw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version; bh=0QJH52hDggkwWpxbQEOG6mYlDlh2LRhPqQRZYVkVc30=; b=Ynzi/4U25qBZ+2L5omAQWv28PAj5Q1bTmPfd1QQkCkl70Lx4oL4KtPdsVvM8gThu+9 Q4tYHPoTkBMtEI1Dy7j1GbbOS0pa5yWjDYX1MCwvePhg31IC9z8bwoqD6+K/9AdJR5Gy qoyXMz5PDy1l+6EoR06oYV4ZplCTZ75OU1g1DTllhWf+8NIoq9ahoLQcVhr1tynQ0s68 fB4ab0wC9L5YakCx7Yqb68ahB30NyL9NpZl55CowK4gpK9/xDvT/Om6q7L+gzitual6N yhJr0KUHnrjPq9/WlXcfyUVmp0iJljozq9+pyuUiCWbN9wdNEGbisv0s9ThhFWbbP7ox tmmw== X-Gm-Message-State: AOAM533gKocVfu+xdbia3KKpYgKdfkuAk8PyXLzskF9uUlTbHdrdJy3f GBY/2D56fRUrv7B7QkNGgi50yHsJU86dxg== X-Google-Smtp-Source: ABdhPJyHtExSV4Ok3ql5kLf1kX3p22Dj6IJUnVLfmJMv2Y4WhKyl1dWSouKKOF1jy1+LXmgHrytPQQ== X-Received: by 2002:a2e:9bd4:: with SMTP id w20mr5731566ljj.324.1643370909448; Fri, 28 Jan 2022 03:55:09 -0800 (PST) Received: from localhost (109-252-135-33.dynamic.spd-mgts.ru. [109.252.135.33]) by smtp.gmail.com with ESMTPSA id a24sm424309lff.97.2022.01.28.03.55.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Jan 2022 03:55:08 -0800 (PST) From: Andrew Tropin Date: Fri, 28 Jan 2022 14:52:12 +0300 Message-ID: <87zgngm5wm.fsf@trop.in> MIME-Version: 1.0 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a00:1450:4864:20::22f (failed) Received-SPF: none client-ip=2a00:1450:4864:20::22f; envelope-from=andrew@trop.in; helo=mail-lj1-x22f.google.com X-Spam_score_int: -10 X-Spam_score: -1.1 X-Spam_bar: - X-Spam_report: (-1.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, PDS_HP_HELO_NORDNS=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action 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 * doc/guix.texi (Essential Home Services): Add files and symlink-manager home services. --- doc/guix.texi | 65 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) diff --git a/doc/guix.texi b/doc/guix.texi index c94f85589f..2edea2c943 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -37500,12 +37500,77 @@ users @emph{should not} use this service, in most cases it's better to extend the required command using the appropriate service type. @end defvr +@defvr {Scheme Variable} home-files-service-type +The service of this type allows to specify a list of files, which will +go to @file{~/.guix-home/files}, usually it contains configuration files +(to be more precise it contains symlinks to files in @file{/gnu/store}), +which should be placed in @file{$XDG_CONFIG_DIR} or in rare cases in +@file{$HOME}. It accepts extension values in the following format: + +@lisp +`(("config/sway/config" ,sway-file-like-object) + ("config/tmux/tmux.conf" ,(local-file "./tmux.conf"))) +@end lisp + +Each nested list contains two values: a subdirectory and file-like +object. After building a home environment @file{~/.guix-home/files} +will be populated with apropiate content and all nested directories will +be created accordingly, however, those files won't go any further until +some other service will do it. By default a +@code{home-symlink-manager-service-type}, which creates necessary +symlinks to files from @file{~/.guix-home/files} in home folder, backs +up already existing, but clashing configs and other things, is a part of +essential home services (enabled by default), but it's possible to use +alternative services to implement more advanced use cases like read-only +home. Feel free to experiment and share your results. +@end defvr + @defvr {Scheme Variable} home-activation-service-type The service of this type generates a guile script, which runs on every @command{guix home reconfigure} invocation or any other action, which leads to the activation of the home environment. @end defvr +@defvr {Scheme Variable} home-symlink-manager-service-type +The service of this type generates a guile script, which will be +executed during activation of home environment, and do a few following +steps: + +@enumerate +@item +Reads the content of @file{files/} directory of current and pending home +environments. + +@item +Cleans up all symlinks created by symlink-manager on previous +activation. Also, sub-directories, which will become empty also will be +cleaned up. + +@item +Creates new symlinks the following way: It looks @file{files/} directory +(usually generated with @code{home-files-service-type}), takes the files +from @file{files/config/} subdirectory and put respective links in +@env{XDG_CONFIG_DIR}. For example symlink for +@file{files/config/sway/config} will end up in +@file{$XDG_CONFIG_DIR/sway/config}. The rest files in @file{files/} +outside of @file{files/config/} subdirectory will be treated slightly +different: symlink will go to @file{$HOME} and the dot will be appended. +@file{files/some-program/config} will end up in +@file{$HOME/.some-program/config}. + +@item +If some sub-directories are missing, they will be created. + +@item +If there is a clashing files on the way, they will be backed up. + +@end enumerate + +symlink-manager is a part of essential home services and is enabled and +used by default. +@end defvr + + @node Shells Home Services @subsection Shells