From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id +IDxDYo3+mH5QAEAgWs5BA (envelope-from ) for ; Wed, 02 Feb 2022 08:49:30 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id 6CZKC4o3+mEtmAAA9RJhRA (envelope-from ) for ; Wed, 02 Feb 2022 08:49:30 +0100 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 74DC12B54B for ; Wed, 2 Feb 2022 08:49:29 +0100 (CET) Received: from localhost ([::1]:33040 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nFAOO-0000o5-8a for larch@yhetil.org; Wed, 02 Feb 2022 02:49:28 -0500 Received: from eggs.gnu.org ([209.51.188.92]:39846) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nFANy-0000lY-PV for guix-patches@gnu.org; Wed, 02 Feb 2022 02:49:03 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:57420) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nFANy-0002kA-GN for guix-patches@gnu.org; Wed, 02 Feb 2022 02:49:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nFANy-0001mY-Eg for guix-patches@gnu.org; Wed, 02 Feb 2022 02:49:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#53466] [PATCH v2] home: Add redshift service. Resent-From: Andrew Tropin Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Wed, 02 Feb 2022 07:49:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 53466 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Ludovic =?UTF-8?Q?Court=C3=A8s?= Cc: 53466@debbugs.gnu.org Received: via spool by 53466-submit@debbugs.gnu.org id=B53466.16437881096793 (code B ref 53466); Wed, 02 Feb 2022 07:49:02 +0000 Received: (at 53466) by debbugs.gnu.org; 2 Feb 2022 07:48:29 +0000 Received: from localhost ([127.0.0.1]:51317 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nFANQ-0001lV-WE for submit@debbugs.gnu.org; Wed, 02 Feb 2022 02:48:29 -0500 Received: from mail-lf1-f53.google.com ([209.85.167.53]:40941) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nFANO-0001lC-OW for 53466@debbugs.gnu.org; Wed, 02 Feb 2022 02:48:27 -0500 Received: by mail-lf1-f53.google.com with SMTP id a28so38834076lfl.7 for <53466@debbugs.gnu.org>; Tue, 01 Feb 2022 23:48:26 -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:in-reply-to:references:date:message-id :mime-version; bh=7KhBGqZ7y8/pgwmjVcu+rxamHWcZU65SrcJtr7wz9kM=; b=FP8B5GN2D3l8rZBJWsApBSj3OqiDllchEh0AYyLeArgDPI1pGP1L02EXRqPOLatKZs xHb51MvOFpkdja8Bg/ZLRr2Nh6boWTc4xm8jh/RSpEd4gYIVcgPrUrdFzRtQXsKq6vtN n03pZljUywzrgjgQPknYU4WVnN/pFhjbs54OLT+O2jnQkeCvP1/VZlyHr3XIFHkRZiZU P41cM0c9XtF3NpYEa847Z0KapMsr33VudOrYLrehFnwF5axCooXL04BAMD57ztMC+BD8 7u0ejzOqro8hidxr8yPQGYu31EUtk11kqkHEzCKSqhHU9DJqyMT0RKD8yxV8N3KFmAuS yL+A== 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:in-reply-to:references:date :message-id:mime-version; bh=7KhBGqZ7y8/pgwmjVcu+rxamHWcZU65SrcJtr7wz9kM=; b=q7f8HQ4oL57epuCatVCRQzGIe5OVJtPvwzHMKwEhAtA8z00lqwMtz1kdQWQtRamNee wgjOvB79W7sj8mCnlehWcXENWX2tJr426pY1wS0ElA7En389VmP36iXuaN/G7fiIPR4q n7hp2pFBOdMVZT3nSJ1WWQ67ygw1HyVa9QE2lzWXjf3jlne/ZFNgoc1pSF/sAvGS8HEH /wIFoqcbKLG5EJvW+8OWJPVgWtWKm0hoG5BkT3bfUadVqnDLUl2OqgBjN7EYJQ06o75a XKr+zWbVuqPfzjZhsCVsw+jtcxdg+NJgtsTBq8j7BBOOsu4zjTVeAsKn8QtKfOrPU/G7 6P6w== X-Gm-Message-State: AOAM532jaV4VWgbAFP2FiGbquN0geggfIDG2HK7dB8C/iHrSWHeP5r+D tJovm937jX6hxHW55PuxfJn07g== X-Google-Smtp-Source: ABdhPJzU/uXcbS7pQDAFncPpjXHXMlL/h+/nPf779Tjrdk4U7G6qQbbHLFQrBrqY2uCVAeTz+T/pkw== X-Received: by 2002:a05:6512:e90:: with SMTP id bi16mr22564392lfb.21.1643788100366; Tue, 01 Feb 2022 23:48:20 -0800 (PST) Received: from localhost (109-252-135-33.dynamic.spd-mgts.ru. [109.252.135.33]) by smtp.gmail.com with ESMTPSA id f7sm2396592lfs.183.2022.02.01.23.48.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Feb 2022 23:48:19 -0800 (PST) From: Andrew Tropin In-Reply-To: <87leyv6kp1.fsf@gnu.org> References: <87sft8tah0.fsf@trop.in> <20220130151139.3857-1-ludo@gnu.org> <87r18nybq5.fsf@trop.in> <87leyv6kp1.fsf@gnu.org> Date: Wed, 02 Feb 2022 10:48:16 +0300 Message-ID: <87bkzpzp33.fsf@trop.in> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" 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+larch=yhetil.org@gnu.org Sender: "Guix-patches" X-Migadu-Flow: FLOW_IN X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1643788169; 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:resent-cc:resent-from:resent-sender: resent-message-id:in-reply-to:in-reply-to:references:references: list-id:list-help:list-unsubscribe:list-subscribe:list-post: dkim-signature; bh=7KhBGqZ7y8/pgwmjVcu+rxamHWcZU65SrcJtr7wz9kM=; b=MW+izRnk0u7y+R6qZPtm/109oHWvxqGQuPqPxruFNWB91gD4pHgoVyO4VnfK3z/Czd5+Cj D1Tw6+H+DWfdFFfBOPGEvvK5Zp2APZ+alMbAVocOY64Dcj5ZHmIZOfIDtgM/o5h+Zm+L9u n9CfmvdiVyLQCS9xnWcgrNkxoR9/uj9d6ouNBySXa2qvDpbDY8AXVY7VZRDcumz/2kF/qb aqzs8U7bPRj4sE+63Ujvea3e6UT6A5PO9VhoKmbkmkyXJFVgjCfUpubednbPt9DEHzH/Tw vQsXK11sc0Zq4BZsjBC+qGgHERmB4sXlkXZF7Sxyfu05w84oKIm7IC6EQq/Fsg== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1643788169; a=rsa-sha256; cv=none; b=TcXYmouNykS5L26/WIku2OEb/sCgrAn4xtXpwrU1HpAX7Xy32MZfuN0hC6N1nO1C1v/Su8 xtc8ChEm6BZcsKnRPk2JEhleGxfeW12REbFfYBpawXMMF/ImhyrI5B/uXMWsTbcBwRDrhZ PEOpVN6u12I1i19O+giSsDyUdq9jlXuaXiorJqrnBiq2/PS1vKDF5zedgooFKNdiw3x5+S RVJPx6hjsGY9oJ4X4429SkWoTCtS8E00+wQ8QjnPUT24HH99tkn0P/gHnfp0D+bKaSg7Jn 5ALdFM94lcgWzW9h7v2iO2BN4hDFTAgxadVgK5a8usXashNOTVbYGiq/nOGD+Q== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=trop-in.20210112.gappssmtp.com header.s=20210112 header.b=FP8B5GN2; dmarc=none; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: -5.03 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=trop-in.20210112.gappssmtp.com header.s=20210112 header.b=FP8B5GN2; dmarc=none; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: 74DC12B54B X-Spam-Score: -5.03 X-Migadu-Scanner: scn0.migadu.com X-TUID: 1ClwiWRkAMYF --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 2022-02-01 09:43, Ludovic Court=C3=A8s wrote: > Hi, > > Andrew Tropin skribis: > >> On 2022-01-30 16:11, Ludovic Court=C3=A8s wrote: >> >>> * gnu/home/services/desktop.scm: New file. >>> * gnu/local.mk (GNU_SYSTEM_MODULES): Add it. >>> * doc/guix.texi (Desktop Home Services): New node. > > [...] > >> Probably, I already mentioned, but combining renamed option names from >> the configuration record and option names in the escape hatch is >> inconsistent, confusing and error-prone. > > I think I replied already. > >> It's very unclear where this extra-content goes and user can't know it >> until he check out the implementation or build the config (currently >> it's also almost impossible to find it on file system after build). > > (He or she.) I documented it in a way that I thought was clear: > > @item @code{extra-content} (default: @code{""}) (type: raw-configuratio= n-string) > Extra content appended as-is to the Redshift configuration file. [=E2= =80=A6] > > Notice =E2=80=9Cappended=E2=80=9D. How would you phrase it? (: >> Using such type of escape hatch is no joy at all. > > Escape hatches are meant to be used as a last resort; they=E2=80=99re a h= ack. > Normally, people would have everything they need with the provided > bindings. So yes, using them is no fun, but that=E2=80=99s not a surpris= e IMO. > >> Seems this one is missplaced and should be go before [manual] section, >> otherwise it won't be possible to set values of redshift section. And >> doing so will lead to very ugly: >> >> (extra-content "\ >> dawn-time=3D5:30 >> dusk-time=3D18:30 >> [geoclue2] >> some-other-option=3Dvalue >> # Do I know that I'm in the middle of config file?") >> >> It will be especially ugly or even erroneous, when the target config has >> a format, which uses identation. >> >> I didn't try it for redshift, but in many ini parser it's forbidden to >> repeat sections with the same name. > > Ah, bummer. > > Another way to see it is that I should augment the bindings, maybe > that=E2=80=99s what you=E2=80=99re getting at? :-) Sorry, not sure if I can translate your question correctly, so I won't try to answer it, but will rephrase my statement to crarify what I mean: The current implementation of escape hatch doesn't work (I can't set missing options in redshift section, because extra-content added after manual section begins, and I'm not sure if redshift's ini parser allows to define a section with the same name a few times, Git for example allows to do so, but it's more an exception). There are a few ways to fix = it: 1. Move manual section on top of redshift section, so the extra-content will be added just after redshift section 2. Move extra-content before manual section to accoplish the same. 3. Use file escape hatch (as it done in some system services), which will invalidate all the options set before and just place the content of file field as a value of configuration. 4. Provide the bindings for other options (probably what you were asking). > > I can do that. > >>> + #$(home-redshift-configuration-extra-content config))) >> >> A little offtopic: >> >> I know a number of system services, where the extra-content goes in >> unexpected locations and overall behavior of escape hatch is unexpected >> and incosistent with other escape hatches. Some of the services has a >> number of escape hatches in almost every nested record with different >> names and behaviors. >> >> I'm relatively fresh Guix user and this part really confused me at first >> even having experience with NixOS module system before and it's very >> likely that many people just don't report it, because it really hard to >> get the roots of it. > > How does NixOS handle escape hatches today? Back when I was using it is > that it wasn=E2=80=99t any more consistent than what we have today, which= is at > least a consolation. I don't remember, how it's done for nixos "system modules", but in home-manager it's relatively consistent, in most cases it just a nested maps (attrsets, a little more high-level analogue of alists): https://rycee.gitlab.io/home-manager/options.html#opt-programs.git.extraCon= fig https://rycee.gitlab.io/home-manager/options.html#opt-accounts.email.accoun= ts._name_.msmtp.extraConfig https://rycee.gitlab.io/home-manager/options.html#opt-gtk.gtk3.extraConfig Sometimes, it allows to add a multi-line string to the end of the file: https://rycee.gitlab.io/home-manager/options.html#opt-programs.abook.extraC= onfig but it's getting deprecated, when proper serializer for target config format is implemented: https://github.com/nix-community/home-manager/blob/master/modules/programs/= git.nix#L342 As you can see, they provide a list of frequently used options as top-level "fields", but all of them, including extraConfig just extends (get merged) to primary "config" (iniContent for git for example) and after that, this primary "config" attributeset get serialized to the target config file. While they have this "escape hatch", it works the same way as all other fields with the only difference: it doesn't have schema (just untyped attributeset). This is quite close to what we do in rde. =2D-=20 Best regards, Andrew Tropin --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQJDBAEBCgAtFiEEKEGaxlA4dEDH6S/6IgjSCVjB3rAFAmH6N0APHGFuZHJld0B0 cm9wLmluAAoJECII0glYwd6wdvAP+QEfw3138OtNcg+ZeX3T/Chd/+AlCk78mO60 WpFkTXrL3f3krJpd8+ArIZV0mMuVVzQ5H6tNOfEfeIkySKsxLUtHBK5aUn3vOQGA /BqXdfUOnm9PwSxrraYQhm7J/B0KcyYs049V9JZXcNMQv8HIjgQr3+g/6DT9L4CG C0w3Q7kadbM5MMkH4hLBJ/Fi/SqxZXgPfYsVvXBAq4pfy7pzl9vAz8f95yp3M55A 6N6F+zhRbql0KHsAMdYSym2qki5dEU9lTis++gY9zDmXlIbZY+XCMrYWKLicVB0r 6ZEQUjHicoaZN92zrhNRhASuiTLid6GvFQfRLop3LLR6ZjVip96VcHzj71NENXMO GTJYM39pdJwj0z62bFaxFUIRpCgWaK8QLUtyhcAAOgOQ+RtgREyHYixaStcdWx+V iUhXcuPGG2pR6Qf6VLWdr9vu5IZeVWetUMueZ9mH9sJ2geCSeRk1xl2ktu+dgUxm ZSlGvdNtgqcQGAWmi5CVyHXUVckIlzqatgQl/6F9ZuIDwAJTrVGMv+59v47IrpVF Rw1RyCe6B7hecC5o/vS+ptvF4D8h8Ai6JWSDcP0zF0L12aJ2lvH32gEbJxTW1AXu Zdta3SmD8/GsVUg7bhF7DfY0Rrzn0tLfYHRB5Rafk7rwjCgWtqHhmWaQj9ocxctS XBLzWn2y =cPfd -----END PGP SIGNATURE----- --=-=-=--