From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id MMXfJUqi1GCiUgEAgWs5BA (envelope-from ) for ; Thu, 24 Jun 2021 17:18:34 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id cBGyIUqi1GC5OAAAB5/wlQ (envelope-from ) for ; Thu, 24 Jun 2021 15:18:34 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id C85661567A for ; Thu, 24 Jun 2021 17:18:33 +0200 (CEST) Received: from localhost ([::1]:56528 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lwR7g-0008WS-OK for larch@yhetil.org; Thu, 24 Jun 2021 11:18:32 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43888) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lwR7M-0008Vr-4M for guix-devel@gnu.org; Thu, 24 Jun 2021 11:18:13 -0400 Received: from mail-lj1-x235.google.com ([2a00:1450:4864:20::235]:35398) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lwR7I-0004ys-3F for guix-devel@gnu.org; Thu, 24 Jun 2021 11:18:11 -0400 Received: by mail-lj1-x235.google.com with SMTP id u11so8246486ljh.2 for ; Thu, 24 Jun 2021 08:18:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=trop-in.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:in-reply-to:references:date:message-id :mime-version:content-transfer-encoding; bh=W71bFCeh1dWTv4q6FgwJOXVXOUfKlBT+C1ldM9z8kw0=; b=S7tUdvm9vVkbltUv3bDJpix8faJKTlDJRVRSR4J7FwBlKAlAw3Fgv7fzATo9p6hs1W 40GCgvV2kwM77ztdmd6QbHRRtmyyJ5MZm/cacHuEqdw2OpTrACVfnODBR7LIsiVpgviQ vNSO1cBvbXVWdMlunyr3oR3i+w/pC+DHMXHvaodBXmY4fnrJCTxMqvTRqtkoTYG7F4jE ezHGzc+LnyfSwuTIUfb+egB46WuTvxoJbqj47SATY35VNrJQi+I/2Aj6Riuf5KBRwZ7V MV4jzFVEjek2pNw1A0jYjhinUMcnDJH3aFNyeUAYaxU2evi7mG88OgP9u8JuNH51Atw+ PoiQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:in-reply-to:references:date :message-id:mime-version:content-transfer-encoding; bh=W71bFCeh1dWTv4q6FgwJOXVXOUfKlBT+C1ldM9z8kw0=; b=uGmhh0HhocwLf4GUh5oXQm1JgDCgjczPik1nNVqaCuceNSWR+2SMJe1Pzo7Gc0TnI9 i1Kzs4ROsRAUNr2XHI0QBa857zHmlZbyCxa8AZsBP12IQbLJNvnmcAwMpl374ahMO8+f 75XrSl1eR3Q6jW4XUAAoMRnm/wLCe8+cZVN1IJSUejah96y9V0tjArYn4OCotmu33QDD VkZVhydwS4rZ68odTc5437r+MfTfRjaxwhF00cqC6onjRRLqb0O29vMdhDielNWPtUmC 4xhb+yC7+Y5mnW8dGFM3+O8WaDcDWTbrnrg0rfQxfLL95zPi7Nbf2KmSq5gOwR6u+GCe s5XA== X-Gm-Message-State: AOAM5313dWHr7FXeYBBDT9S0WWRCDUNedS3cZjjrIO3Z3pwzc5vTlqM0 zmyttBM7O9tSOm2IGoykMRWak10Aeb5XDQ== X-Google-Smtp-Source: ABdhPJxtkBUSMt8+BuKbLfujeIpXP1L+yl//BB6yJ0+Yhju1MMYdYHrN4TFvxHWiebiBHoaB6JaKLQ== X-Received: by 2002:a05:651c:111b:: with SMTP id d27mr1773560ljo.387.1624547885960; Thu, 24 Jun 2021 08:18:05 -0700 (PDT) Received: from ixy (109-252-117-164.nat.spd-mgts.ru. [109.252.117.164]) by smtp.gmail.com with ESMTPSA id l20sm312675ljb.139.2021.06.24.08.18.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 24 Jun 2021 08:18:05 -0700 (PDT) From: Andrew Tropin To: Xinglu Chen , Ludovic =?utf-8?Q?Court=C3=A8s?= Subject: Re: Early feedback on Guix Home In-Reply-To: <87y2azr86k.fsf@yoctocell.xyz> References: <87tuloyb6n.fsf@gnu.org> <87y2azr86k.fsf@yoctocell.xyz> Date: Thu, 24 Jun 2021 18:18:02 +0300 Message-ID: <87lf6z2swl.fsf@trop.in> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Received-SPF: none client-ip=2a00:1450:4864:20::235; envelope-from=andrew@trop.in; helo=mail-lj1-x235.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: guix-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: guix-devel Errors-To: guix-devel-bounces+larch=yhetil.org@gnu.org Sender: "Guix-devel" X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1624547914; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=W71bFCeh1dWTv4q6FgwJOXVXOUfKlBT+C1ldM9z8kw0=; b=gvjDqIrxXRmIY36Ce2hcFV16+uBLuaJV4Pm3FzM2pla76mvYMq3qXCW9ohvCCvsazV500q c0mMWuoBJ/6Q56E6Ff0FSMVDMFym+EIQHEiwmN2Pl+vyNLPlvYtRLSjXlrloIPZ0xLA0wh FWEGjhb+tbGohJDGlJucAa0y5bH1dRdtSs07csNty/lsx2CRywXbOCFWyoyxquoX9VZyij JOEiUSwpZIWJuo+z7QdNVWicFO09OcTLv7+H2yQPN8PdT6XPYR3NVeI3lX4b/dHyJ9lAEk i6xjqEMssyAJC+Z8vndz9D4l++mcIGD+/h4eMAucc5pnut33dB52pCOrX1rs3g== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1624547914; a=rsa-sha256; cv=none; b=dPifX2mzR+pFt7C79RSiqBtIVFL+2axJzcJgS+MKKAIM2OpQigFL3WKowgmrn1PpE2YuG6 bDkIdVMK5z1Gung8Luq5am1QW8IzawTWsU841NUR8UAeGiIYlWGrgM1ISZBCa3OdpGj2Zm 580frGGnfy+CtQ+fFLZOOgercoPV2UBo+9iyyQH37g+A91IApHNcWrSiLjH2iOW5HXQ/s+ TJ77b3LlQhC6kPG+piDQ6f//uM530iIv3lnMSBSVbHuqpegBVrkVEo4YEqeNq2T1jHw2CT Tiwe2w52zWhwzMtyiqF1GKQ9vF6iGzSkdGhaNJuaHTvrp+BEkK14v4uIDQIuEg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=trop-in.20150623.gappssmtp.com header.s=20150623 header.b=S7tUdvm9; dmarc=none; spf=pass (aspmx1.migadu.com: domain of guix-devel-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-devel-bounces@gnu.org X-Migadu-Spam-Score: -2.63 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=trop-in.20150623.gappssmtp.com header.s=20150623 header.b=S7tUdvm9; dmarc=none; spf=pass (aspmx1.migadu.com: domain of guix-devel-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-devel-bounces@gnu.org X-Migadu-Queue-Id: C85661567A X-Spam-Score: -2.63 X-Migadu-Scanner: scn1.migadu.com X-TUID: nJWC8veb60Hw Xinglu Chen writes: > On Wed, Jun 23 2021, Ludovic Court=C3=A8s wrote: > >> Hello! >> >> As discussed on IRC a few days ago, I finally gave Guix Home a try and I >> like it! >> >> I thought I=E2=80=99d share my first impressions so we can try and addre= ss them >> in the process of getting it merged. >> >> First, I think one of the main reasons why it took me so long to try it >> out is that I was afraid of what would happen at =E2=80=9Cactivation tim= e=E2=80=9D (upon >> reconfigure). Were my dot files going to be deleted? If so, which ones >> exactly should I back up? That led me to look more closely at the code >> to better understand what was going to happen. I found >> =E2=80=98symlink-manager.scm=E2=80=99, which is what I was looking for, = but that code is >> fairly complex. >> >> Anyway, I backed up a bunch of files :-) and eventually gave it a try, >> just to notice that =E2=80=98guix home reconfigure=E2=80=99 was very car= eful about >> creating backups of any files it was going to overwrite, and it was also >> explicitly saying what it=E2=80=99s doing. Perfect. > > Yeah, the output is pretty verbose, which is good if someone is just > getting started with it, but there should probably also be an option to > make it less verbose. > >> I see two possible improvements: >> >> 1. Make the manual very upfront about that: don=E2=80=99t be afraid, c= onfig >> files are backed up at that location, etc. > > Yeah, the manual needs some more work, maybe we should add an =E2=80=98mi= grating > to Guix Home=E2=80=99 section? Yup, on my todo list. >> 2. Review =E2=80=98symlink-manager.scm=E2=80=99 and work on simplifyin= g it to make it >> easier to understand what=E2=80=99s going on. >> >> Second, the other thing that stopped me from getting started is the >> initial config. How could I move from all my undisciplined dotfiles to >> the single explicit config? Eventually, I found that starting with >> nothing but packages, =E2=80=98home-bash-service-type=E2=80=99, and >> =E2=80=98home-ssh-service-type=E2=80=99 was the most reasonable option t= o begin with. >> >> Unfortunately, even =E2=80=98home-ssh-service-type=E2=80=99 was difficul= t to handle: I >> have a long =E2=80=98.ssh/config=E2=80=99 file and I wasn=E2=80=99t goin= g to turn that into >> =E2=80=98ssh-host=E2=80=99 lines by hand. > > There is a =E2=80=98home-generic-service=E2=80=99 procedure that allows o= ne to install > packages in dump a file somewhere in their home directory. > > (home-generic-service > 'ssh-config > #:packages (list openssh) > #:files `(("ssh/config" > ,(local-file "/path/to/some/ssh/config")))) > >> Possible actions: >> >> 1. Provide a =E2=80=98guix home init=E2=80=99 command (or similar) tha= t creates an >> initial Home config based on existing config. > > As Andrew mentioned, I recently added a =E2=80=98guix home import=E2=80= =99 command, but > in only imports the installed user packages. Creating configurations > for the packages would require a lot more work, unless we just read the > contents of ~/.bashrc and ~/.config/git/config and use > =E2=80=98home-generic-service=E2=80=99 and =E2=80=98plain-file=E2=80=99, = instead of using > =E2=80=98home-bash-configuration=E2=80=99 and =E2=80=98home-git-configura= tion=E2=80=99. > >> 2. In some cases, such as OpenSSH, provide converters from the native >> format to its Scheme equivalent (maybe?). > > That would require a lot of work; we would have to parse all sorts of > weird configuration formats, not to mention that the upstream > configuration format can change in the future. It would be nice to > have, but I don=E2=80=99t think it should be a blocker for merging Guix H= ome. > >> 3. For each service, provide an escape hatch: a way for users to >> provide a raw config file. We do that for all or most of the Guix >> System services, and it helps a lot when people are starting from >> an existing config. > > Since we already have the =E2=80=98home-generic-service=E2=80=99 helper, = I am not sure > if explicitly providing an escape hatch for every single service is > worth it. I feel like the point is to use Scheme to configure things, > and not to just concatenate big opaque strings. People who haven=E2=80= =99t > re-written their configs in Scheme can always use > =E2=80=98home-generic-service=E2=80=99. =E2=80=98home-generic-service=E2= =80=99 is also useful if say > the user wants to configure Mpv, but there is no Mpv service in Guix > Home. In most cases we allows gexps or/and file-like objects (with `local-file` and include/load or similar directive provided by target software it's easy to include/source already existing file), so it's almost always a way to take current plain-text file configuration and include or slurp it into configuration home-service. In other words, there is already an escape hatch for almost every home-service. >> In terms of API, I noticed that in places such as >> =E2=80=98home-bash-configuration=E2=80=99, config snippets are represent= ed as a list of >> strings (internally passed to =E2=80=98mixed-text-file=E2=80=99). That = forces users to >> mix different languages in their .scm file=E2=80=94e.g., half of my Home= config >> is .bash{rc,_profile} snippets embedded in Scheme strings. That=E2=80= =99s >> inconvenient. >> >> Possible action: >> >> 1. Change config records to accept file-like objects instead of >> strings. That way, users can choose to have snippets inlined (in a >> =E2=80=98plain-file=E2=80=99 object) or separate (via =E2=80=98loca= l-file=E2=80=99). See for >> example how =E2=80=98tor-configuration->torrc=E2=80=99 does it. > > Yeah, there is a =E2=80=98slurp-file-gexp=E2=80=99 procedure that let=E2= =80=99s one read an > extenal file, but using existing APIs like =E2=80=98local-file=E2=80=99 i= s probably a > better idea. `slurp-file-gexp` is a simple function, which returns a gexp, which reads file from store and returns it's content (in most cases to be added to mixed-text-file), it's expected that user will use it with file-like object provided by local-file or any other way. The final configuration will look like: `((key1 . value2) (key2 . (list of values)) ,(slurp-file-gexp (local-file "./file/to/inline")) (key3 . value3)) It's done this way, because for many apps it's hard to provide a separate field like in tor-configuration, because it's not clear where this file should be added (at the end or at the beginning of the file or inside special section). To make a generic solution we do not provide a separate field for file-like object, which contains "plain-text" configuration, but allows to use one of two options above, which allows to achieve the same, but provides more fleixbility and makes configurations of home-services more consistent/uniform. I'll try to write a guideline for defining home-services in the near future and will try to explain all the patterns and best practices for service configurations, after that will start adjusting currently existing services to conform guideline (in case they do not yet). >> That=E2=80=99s it. I hope it makes sense to you! > > Thank you for the feedback! Great to see that people are using and > enjoying Guix Home :) > >> I encourage everyone to give it a spin, fearlessly! >> What I did was (roughly): >> >> git clone https://git.sr.ht/~abcdw/rde >> guix git authenticate \ >> "257cebd587b66e4d865b3537a9a88cccd7107c95" \ >> "2841 9AC6 5038 7440 C7E9 2FFA 2208 D209 58C1 DEB0" \ >> -k origin/keyring >> ./pre-inst-env guix home reconfigure /path/to/home-config.scm > > Alternatively, one can also use it as a channel: > > (channel > (name 'rde) > (url "https://git.sr.ht/~abcdw/rde")) > (introduction > (make-channel-introduction > "257cebd587b66e4d865b3537a9a88cccd7107c95" > (openpgp-fingerprint > "2841 9AC6 5038 7440 C7E9 2FFA 2208 D209 58C1 DEB0"))))