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 2KE5M8FG9GEjDAAAgWs5BA (envelope-from ) for ; Fri, 28 Jan 2022 20:40:49 +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 2MCuMMFG9GGZvgAA9RJhRA (envelope-from ) for ; Fri, 28 Jan 2022 20:40:49 +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 035AA3C36B for ; Fri, 28 Jan 2022 20:40:49 +0100 (CET) Received: from localhost ([::1]:58594 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nDX70-0001Ug-W9 for larch@yhetil.org; Fri, 28 Jan 2022 14:40:47 -0500 Received: from eggs.gnu.org ([209.51.188.92]:48230) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nDW8P-0000oI-AY for guix-patches@gnu.org; Fri, 28 Jan 2022 13:38:09 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:39366) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nDW8I-0001nC-F2 for guix-patches@gnu.org; Fri, 28 Jan 2022 13:38:05 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nDW8I-0002nO-Dc for guix-patches@gnu.org; Fri, 28 Jan 2022 13:38:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#53466] [PATCH] home: Add redshift service. Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 28 Jan 2022 18:38: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: Andrew Tropin Cc: 53466@debbugs.gnu.org Received: via spool by 53466-submit@debbugs.gnu.org id=B53466.164339506810716 (code B ref 53466); Fri, 28 Jan 2022 18:38:02 +0000 Received: (at 53466) by debbugs.gnu.org; 28 Jan 2022 18:37:48 +0000 Received: from localhost ([127.0.0.1]:60502 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nDW83-0002ml-F7 for submit@debbugs.gnu.org; Fri, 28 Jan 2022 13:37:47 -0500 Received: from hera.aquilenet.fr ([185.233.100.1]:55570) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nDW82-0002mV-69 for 53466@debbugs.gnu.org; Fri, 28 Jan 2022 13:37:46 -0500 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id 2D8A13D7; Fri, 28 Jan 2022 19:37:39 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at aquilenet.fr Received: from hera.aquilenet.fr ([127.0.0.1]) by localhost (hera.aquilenet.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id yn3mDqpI547c; Fri, 28 Jan 2022 19:37:37 +0100 (CET) Received: from ribbon (91-160-117-201.subs.proxad.net [91.160.117.201]) by hera.aquilenet.fr (Postfix) with ESMTPSA id 493753D6; Fri, 28 Jan 2022 19:37:37 +0100 (CET) From: Ludovic =?UTF-8?Q?Court=C3=A8s?= References: <20220123111159.27020-1-ludo@gnu.org> <87sft8tah0.fsf@trop.in> X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: 9 =?UTF-8?Q?Pluvi=C3=B4se?= an 230 de la =?UTF-8?Q?R=C3=A9volution?= 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: Fri, 28 Jan 2022 19:37:35 +0100 In-Reply-To: <87sft8tah0.fsf@trop.in> (Andrew Tropin's message of "Fri, 28 Jan 2022 13:34:35 +0300") Message-ID: <87zgnfbtao.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spamd-Bar: / X-Rspamd-Server: hera X-Rspamd-Queue-Id: 2D8A13D7 X-Spamd-Result: default: False [-0.10 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; RCPT_COUNT_TWO(0.00)[2]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; MID_RHS_MATCH_FROM(0.00)[] 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=1643398849; 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: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; bh=O+wxlDICUc4xgbMN1pg0bl43L4ycDG5f5Ah+bsw6dHI=; b=opKMEux6Jy4TjkL6bbi9+dV/6MY8TNLqSwX0bQluyA01iFY4fs92xZ8I3imZ9wYHrv7XaJ wdQXpG0MWJxkZJZQ/jVtlp3cZBy7D0Osy1LsS/mbd0F2kjmY4KBuHuKGmm8VBUiQerZB4Z Nig858QkEBCipmrJX2sa1CxXUYMNVYpGhdxTNyNQ6BsADK3PaczJ3HdA0qPsOWRmWgjQW2 oGe5Z2bV5TWhtKwJuMD6OdyMm29ULT7Ybo3CuHsNtSCFIVpOinjps+1L96G3Hlk4mJfxEd tqUL2tUnSgb4mUPDzUekI5HXwCTFIRhgsCqIm9+0ZQZRmUzIuL4z95yNT19GJw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1643398849; a=rsa-sha256; cv=none; b=CefrGZ0Jpj7B5mKnOAgH92UH72OL3Vg7PwCw+FYcAJTddGoGYIZypfY8o2RonwTB2H+e6v e1T9l9gi6UpduWZWQowUiCHljJrF3+PsuEklhK9zu6FugiC22XBbzYrPyaXdJKlyotMLf7 XysOQYYeTWJbWpPyZgfFKF5AG/pTyCAONW05HZMx0i69YSsyqhuTfg3VYLnS2IxF/+MEOm 0oBgO6bsjSkPBMaCRpi2H85VqSPNci705ODtvaoqA/Ge4CHboxKlgn5WILbmxfocbQzb3S IGUB3mJvb9gXiqVziSB0EAE7GfdFg7Oy6U64l3RVCXduMZ5qQKb2+04XG/nrrQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; dmarc=pass (policy=none) header.from=gnu.org; 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: -3.63 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=pass (policy=none) header.from=gnu.org; 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: 035AA3C36B X-Spam-Score: -3.63 X-Migadu-Scanner: scn1.migadu.com X-TUID: fmBMNOyintDJ Hi Andrew, Andrew Tropin skribis: > On 2022-01-23 12: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. [...] >> +(define-configuration home-redshift-configuration > > (redshift > (package redshift)) > > would be useful, especially for people who would like to use a patched > redshift supporting wayland or some other extended version of a package. Oops, indeed; I=E2=80=99ll add it. > Another good candidate for a separate field is shepherd? or > shepherd-service? to make it possible to remove an integration with > shepherd if it's not needed. What would the service do when set to #f? >> + (latitude >> + (maybe-inexact-number 'disabled) >> + "Latitude, when @code{location-provider} is @code{'manual}.") >> + (longitude >> + (maybe-inexact-number 'disabled) >> + "Longitude, when @code{location-provider} is @code{'manual}.")) > > While I like the naming of the fields more than original option names I > still not a big fan of this approach for various reasons: For the record, the whole project avoids abbreviations. I think it=E2=80= =99s an important part of making things intelligible, especially to non-native speakers. > 1. Users of this home service would need to deal with one more level of > abstraction and keep in mind latitude -> manual.lat, > nighttime-brightness -> redshift.brightness-night, etc mappings. Maybe > for completely new users it's not even necessary to think about > internals, but for person reading man pages or non-guix specific > articles it would be a headache. It's not that bad for very simple > programs like redshift, but becomes much more significant for software > supporting much more options like sway or git. Yes, that=E2=80=99s the usual tradeoff. The choice made so far in Guix has= been to choose clarity over faithfulness to upstream=E2=80=99s name choices. > 2. With the current configuration implementation 8 options are missing > and not possible to set, also it's not possible to reuse already > existing configuration. Oops yes, I=E2=80=99ll add an escape hatch. > Escape hatch with extra-content field solves this problem only > partially and extra-content can NOT be combined with the rest of > fields representing redshift options. So it should be a named a > "file", not extra-content, and when used will remove the effect of all > other fields. extra-options is possible but will blow the mind, we > have mappings and all that stuff, also need a custom serialization > logic to merge sections. I=E2=80=99ll look into it, and I think that=E2=80=99ll help me understand w= hy this file-like vs. string is so important to you. > 3. We copy the documentation and part of implementation for software we > are wrapping and now we have to maintain it ourselves. Probably, > redshift is quite stable and both documentation and options doesn't > change frequently, but for the bigger projects it will lead to outdated > docs and missing options quite fast or will put a huge maintanance > burden. Yes. Again, that=E2=80=99s the choice we made in Guix: providing bindings = for config file formats. It=E2=80=99s ambitious, but it=E2=80=99s worked well = so far. If it worked for the Dovecot, surely it won=E2=80=99t be a problem here. :-) > 4. If we decide one day to continue development of guix home import > command it would be a little nightmare to write importers from existing > configuration to guix services configurations. I view =E2=80=98guix home import=E2=80=99 as a helper, like =E2=80=98guix i= mport=E2=80=99. I don=E2=80=99t think it would make sense to have it automatically handle all the config files that could possibly be handled by Guix Home services. > I would prefer to have one config field for all the fields above: > > (redshift-conf > '((redshift > ((temp-day . 5700) > (temp-night . 3600) > (gamma . 0.8) > ;; any other number of option some one would like to set > #~"dawn-time=3D6:00\ndusk-time=3D18:00" > ;; or a nasty slurp-file-gexp, which reads the existing > ;; configuration or part of it if we migrate step by step > (adjustment-method . randr) > (location-provider . manual))) > (manual > ((lat . 55.7) > (lon . 12.6))))) I can see the appeal of alists, but the choice made in Guix is to use records for configuration; that has advantages, such as type checking, detection of incorrect field names, and the ability to use all the bells and whistles of (guix records). [...] >> + (list (shepherd-service >> + (documentation "Redshift program.") >> + (provision '(redshift)) >> + (start #~(make-forkexec-constructor > > There is a possibility that shepherd is launched before X or wayland > session started and redshift won't be able to access necessary > environment variables. I have a few hacky solutions for other > applications, but need to come up with a better and more generic way to > handle it. Oh, I see. I=E2=80=99ll add a FIXME. In practice, that problem would mani= fest only if someone logs in at the console first, right? Perhaps we could define a pseudo =E2=80=98xserver-xorg=E2=80=99 Shepherd se= rvice that would be down when =E2=80=98DISPLAY=E2=80=99 is undefined, or something lik= e that? >> + (list #$(file-append redshift "/bin/redshift") >> + "-c" #$config-file))) >> + (stop #~(make-kill-destructor))))) >> + >> +(define home-redshift-service-type >> + (service-type >> + (name 'home-redshift) >> + (extensions (list (service-extension home-shepherd-service-type >> + redshift-shepherd-service))) > > It would be good to extend home-files-service-type with config-file > generated above and home-profile-service-type with the value of > `redshift` field. Regarding the former, that=E2=80=99s not something we usually do for system services. As for the latter, I thought about it but I=E2=80=99m not sure what it woul= d be used for. WDYT? > This way user will be able to launch redshift himself or using other > mechanism like wm startup file, it maybe necessary for > testing/debugging purpose or to be sure that redshift has DISPLAY or > other variables available or maybe some other use cases. In that case it may be best to let users explicitly install it in their profile maybe? > Yes, it's possible to use the approach proposed by this patch for > implementing configuration for such simple program, but I still have > a lot of concerns about applying it to more complex software. I understand your concerns, but I think they=E2=80=99re beyond the scope of= this review. I also think that there=E2=80=99s ample experience with system ser= vices showing that writing =E2=80=9Cnice=E2=80=9D configuration bindings actually= works in practice. Thanks, Ludo=E2=80=99.