[PATCH] home: Add redshift service.

  • Done
  • quality assurance status badge
Details
3 participants
  • Andrew Tropin
  • Ludovic Courtès
  • Maxime Devos
Owner
unassigned
Submitted by
Ludovic Courtès
Severity
normal
L
L
Ludovic Courtès wrote on 23 Jan 2022 12:11
(address . guix-patches@gnu.org)(name . Ludovic Courtès)(address . ludo@gnu.org)
20220123111159.27020-1-ludo@gnu.org
* gnu/home/services/desktop.scm: New file.
* gnu/local.mk (GNU_SYSTEM_MODULES): Add it.
* doc/guix.texi (Desktop Home Services): New node.
---
doc/guix.texi | 62 ++++++++++++++++
gnu/home/services/desktop.scm | 135 ++++++++++++++++++++++++++++++++++
gnu/local.mk | 1 +
3 files changed, 198 insertions(+)
create mode 100644 gnu/home/services/desktop.scm

Toggle diff (237 lines)
diff --git a/doc/guix.texi b/doc/guix.texi
index 912a8e3c5a..07414ec13d 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -37186,6 +37186,7 @@ services)}.
* Shells: Shells Home Services. POSIX shells, Bash, Zsh.
* Mcron: Mcron Home Service. Scheduled User's Job Execution.
* Shepherd: Shepherd Home Service. Managing User's Daemons.
+* Desktop: Desktop Home Services. Services for graphical environments.
@end menu
@c In addition to that Home Services can provide
@@ -37567,6 +37568,67 @@ mechanism instead (@pxref{Shepherd Services}).
@end table
@end deftp
+@node Desktop Home Services
+@subsection Desktop Home Services
+
+The @code{(gnu home services desktop)} module provides services that you
+may find useful on ``desktop'' systems running a graphical user
+environment such as Xorg.
+
+@defvr {Scheme Variable} home-redshift-service-type
+This is the service type for @uref{https://github.com/jonls/redshift,
+Redshift}, a program that adjusts the display color temperature
+according to the time of day. Its associated value must be a
+@code{home-redshift-configuration} record, as shown below.
+
+A typical configuration, where we manually specify the latitude and
+longitude, might look like this:
+
+@lisp
+(service home-redshift-service-type
+ (home-redshift-configuration
+ (location-provider 'manual)
+ (latitude 35.81) ;northern hemisphere
+ (longitude -0.80))) ;west of Greenwich
+@end lisp
+@end defvr
+
+@deftp {Data Type} home-redshift-configuration
+Available @code{home-redshift-configuration} fields are:
+
+@table @asis
+@item @code{location-provider} (default: @code{geoclue2}) (type: symbol)
+Geolocation provider---@code{'manual} or @code{'geoclue2}. In the
+former case, you must also specify the @code{latitude} and
+@code{longitude} fields so Redshift can determine daytime at your place.
+In the latter case, the Geoclue system service must be running; it will
+be queried for location information.
+
+@item @code{adjustment-method} (default: @code{randr}) (type: symbol)
+Color adjustment method.
+
+@item @code{daytime-temperature} (default: @code{6500}) (type: integer)
+Daytime color temperature (kelvins).
+
+@item @code{nighttime-temperature} (default: @code{4500}) (type: integer)
+Nighttime color temperature (kelvins).
+
+@item @code{daytime-brightness} (default: @code{disabled}) (type: maybe-inexact-number)
+Daytime screen brightness, between 0.1 and 1.0.
+
+@item @code{nighttime-brightness} (default: @code{disabled}) (type: maybe-inexact-number)
+Nighttime screen brightness, between 0.1 and 1.0.
+
+@item @code{latitude} (default: @code{disabled}) (type: maybe-inexact-number)
+Latitude, when @code{location-provider} is @code{'manual}.
+
+@item @code{longitude} (default: @code{disabled}) (type: maybe-inexact-number)
+Longitude, when @code{location-provider} is @code{'manual}.
+
+@end table
+
+@end deftp
+
@node Invoking guix home
@section Invoking @code{guix home}
diff --git a/gnu/home/services/desktop.scm b/gnu/home/services/desktop.scm
new file mode 100644
index 0000000000..36e02e671f
--- /dev/null
+++ b/gnu/home/services/desktop.scm
@@ -0,0 +1,135 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2022 Ludovic Courtès <ludo@gnu.org>
+;;;
+;;; This file is part of GNU Guix.
+;;;
+;;; GNU Guix is free software; you can redistribute it and/or modify it
+;;; under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation; either version 3 of the License, or (at
+;;; your option) any later version.
+;;;
+;;; GNU Guix is distributed in the hope that it will be useful, but
+;;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;;; GNU General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
+
+(define-module (gnu home services desktop)
+ #:use-module (gnu home services)
+ #:use-module (gnu home services shepherd)
+ #:use-module (gnu services configuration)
+ #:autoload (gnu packages xdisorg) (redshift)
+ #:use-module (guix records)
+ #:use-module (guix gexp)
+ #:use-module (srfi srfi-1)
+ #:use-module (ice-9 match)
+ #:export (home-redshift-configuration
+ home-redshift-configuration?
+
+ home-redshift-service-type))
+
+
+;;;
+;;; Redshift.
+;;;
+
+(define (serialize-integer field value)
+ (string-append (match field
+ ('daytime-temperature "temp-day")
+ ('nighttime-temperature "temp-night")
+ ('daytime-brightness "brightness-day")
+ ('nighttime-brightness "brightness-night")
+ ('latitude "lat")
+ ('longitude "lon")
+ (_ (symbol->string field)))
+ "=" (number->string value) "\n"))
+
+(define (serialize-symbol field value)
+ (string-append (symbol->string field)
+ "=" (symbol->string value) "\n"))
+
+(define serialize-inexact-number serialize-integer)
+
+(define (inexact-number? n)
+ (and (number? n) (inexact? n)))
+(define-maybe inexact-number)
+
+(define-configuration home-redshift-configuration
+ (location-provider
+ (symbol 'geoclue2)
+ "Geolocation provider---@code{'manual} or @code{'geoclue2}.
+
+In the former case, you must also specify the @code{latitude} and
+@code{longitude} fields so Redshift can determine daytime at your place. In
+the latter case, the Geoclue system service must be running; it will be
+queried for location information.")
+ (adjustment-method
+ (symbol 'randr)
+ "Color adjustment method.")
+
+ ;; Default values from redshift(1).
+ (daytime-temperature
+ (integer 6500)
+ "Daytime color temperature (kelvins).")
+ (nighttime-temperature
+ (integer 4500)
+ "Nighttime color temperature (kelvins).")
+
+ (daytime-brightness
+ (maybe-inexact-number 'disabled)
+ "Daytime screen brightness, between 0.1 and 1.0.")
+ (nighttime-brightness
+ (maybe-inexact-number 'disabled)
+ "Nighttime screen brightness, between 0.1 and 1.0.")
+
+ (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}."))
+
+(define (serialize-redshift-configuration config)
+ (define location-fields
+ '(latitude longitude))
+
+ (define (location-field? field)
+ (memq (configuration-field-name field) location-fields))
+
+ #~(string-append
+ "[redshift]\n"
+ #$(serialize-configuration config
+ (remove location-field?
+ home-redshift-configuration-fields))
+ "\n[manual]\n"
+ #$(serialize-configuration config
+ (filter location-field?
+ home-redshift-configuration-fields))))
+
+(define (redshift-shepherd-service config)
+ (define config-file
+ (computed-file "redshift.conf"
+ #~(call-with-output-file #$output
+ (lambda (port)
+ (display #$(serialize-redshift-configuration config)
+ port)))))
+
+ (list (shepherd-service
+ (documentation "Redshift program.")
+ (provision '(redshift))
+ (start #~(make-forkexec-constructor
+ (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)))
+ (default-value (home-redshift-configuration))
+ (description
+ "Run Redshift, a program that adjust the color temperature of display
+according to time of day.")))
diff --git a/gnu/local.mk b/gnu/local.mk
index 03f6d90b9e..cf72926f5d 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -78,6 +78,7 @@ GNU_SYSTEM_MODULES = \
%D%/ci.scm \
%D%/home.scm \
%D%/home/services.scm \
+ %D%/home/services/desktop.scm \
%D%/home/services/symlink-manager.scm \
%D%/home/services/fontutils.scm \
%D%/home/services/shells.scm \

base-commit: ee6bf00b2d89f6acab55b7a82896d99e39c1229b
--
2.34.0
A
A
Andrew Tropin wrote on 28 Jan 2022 11:34
(name . Ludovic Courtès)(address . ludo@gnu.org)
87sft8tah0.fsf@trop.in
On 2022-01-23 12:11, Ludovic Courtès wrote:

Toggle quote (156 lines)
> * gnu/home/services/desktop.scm: New file.
> * gnu/local.mk (GNU_SYSTEM_MODULES): Add it.
> * doc/guix.texi (Desktop Home Services): New node.
> ---
> doc/guix.texi | 62 ++++++++++++++++
> gnu/home/services/desktop.scm | 135 ++++++++++++++++++++++++++++++++++
> gnu/local.mk | 1 +
> 3 files changed, 198 insertions(+)
> create mode 100644 gnu/home/services/desktop.scm
>
> diff --git a/doc/guix.texi b/doc/guix.texi
> index 912a8e3c5a..07414ec13d 100644
> --- a/doc/guix.texi
> +++ b/doc/guix.texi
> @@ -37186,6 +37186,7 @@ services)}.
> * Shells: Shells Home Services. POSIX shells, Bash, Zsh.
> * Mcron: Mcron Home Service. Scheduled User's Job Execution.
> * Shepherd: Shepherd Home Service. Managing User's Daemons.
> +* Desktop: Desktop Home Services. Services for graphical environments.
> @end menu
> @c In addition to that Home Services can provide
>
> @@ -37567,6 +37568,67 @@ mechanism instead (@pxref{Shepherd Services}).
> @end table
> @end deftp
>
> +@node Desktop Home Services
> +@subsection Desktop Home Services
> +
> +The @code{(gnu home services desktop)} module provides services that you
> +may find useful on ``desktop'' systems running a graphical user
> +environment such as Xorg.
> +
> +@defvr {Scheme Variable} home-redshift-service-type
> +This is the service type for @uref{https://github.com/jonls/redshift,
> +Redshift}, a program that adjusts the display color temperature
> +according to the time of day. Its associated value must be a
> +@code{home-redshift-configuration} record, as shown below.
> +
> +A typical configuration, where we manually specify the latitude and
> +longitude, might look like this:
> +
> +@lisp
> +(service home-redshift-service-type
> + (home-redshift-configuration
> + (location-provider 'manual)
> + (latitude 35.81) ;northern hemisphere
> + (longitude -0.80))) ;west of Greenwich
> +@end lisp
> +@end defvr
> +
> +@deftp {Data Type} home-redshift-configuration
> +Available @code{home-redshift-configuration} fields are:
> +
> +@table @asis
> +@item @code{location-provider} (default: @code{geoclue2}) (type: symbol)
> +Geolocation provider---@code{'manual} or @code{'geoclue2}. In the
> +former case, you must also specify the @code{latitude} and
> +@code{longitude} fields so Redshift can determine daytime at your place.
> +In the latter case, the Geoclue system service must be running; it will
> +be queried for location information.
> +
> +@item @code{adjustment-method} (default: @code{randr}) (type: symbol)
> +Color adjustment method.
> +
> +@item @code{daytime-temperature} (default: @code{6500}) (type: integer)
> +Daytime color temperature (kelvins).
> +
> +@item @code{nighttime-temperature} (default: @code{4500}) (type: integer)
> +Nighttime color temperature (kelvins).
> +
> +@item @code{daytime-brightness} (default: @code{disabled}) (type: maybe-inexact-number)
> +Daytime screen brightness, between 0.1 and 1.0.
> +
> +@item @code{nighttime-brightness} (default: @code{disabled}) (type: maybe-inexact-number)
> +Nighttime screen brightness, between 0.1 and 1.0.
> +
> +@item @code{latitude} (default: @code{disabled}) (type: maybe-inexact-number)
> +Latitude, when @code{location-provider} is @code{'manual}.
> +
> +@item @code{longitude} (default: @code{disabled}) (type: maybe-inexact-number)
> +Longitude, when @code{location-provider} is @code{'manual}.
> +
> +@end table
> +
> +@end deftp
> +
> @node Invoking guix home
> @section Invoking @code{guix home}
>
> diff --git a/gnu/home/services/desktop.scm b/gnu/home/services/desktop.scm
> new file mode 100644
> index 0000000000..36e02e671f
> --- /dev/null
> +++ b/gnu/home/services/desktop.scm
> @@ -0,0 +1,135 @@
> +;;; GNU Guix --- Functional package management for GNU
> +;;; Copyright © 2022 Ludovic Courtès <ludo@gnu.org>
> +;;;
> +;;; This file is part of GNU Guix.
> +;;;
> +;;; GNU Guix is free software; you can redistribute it and/or modify it
> +;;; under the terms of the GNU General Public License as published by
> +;;; the Free Software Foundation; either version 3 of the License, or (at
> +;;; your option) any later version.
> +;;;
> +;;; GNU Guix is distributed in the hope that it will be useful, but
> +;;; WITHOUT ANY WARRANTY; without even the implied warranty of
> +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> +;;; GNU General Public License for more details.
> +;;;
> +;;; You should have received a copy of the GNU General Public License
> +;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
> +
> +(define-module (gnu home services desktop)
> + #:use-module (gnu home services)
> + #:use-module (gnu home services shepherd)
> + #:use-module (gnu services configuration)
> + #:autoload (gnu packages xdisorg) (redshift)
> + #:use-module (guix records)
> + #:use-module (guix gexp)
> + #:use-module (srfi srfi-1)
> + #:use-module (ice-9 match)
> + #:export (home-redshift-configuration
> + home-redshift-configuration?
> +
> + home-redshift-service-type))
> +
> +
> +;;;
> +;;; Redshift.
> +;;;
> +
> +(define (serialize-integer field value)
> + (string-append (match field
> + ('daytime-temperature "temp-day")
> + ('nighttime-temperature "temp-night")
> + ('daytime-brightness "brightness-day")
> + ('nighttime-brightness "brightness-night")
> + ('latitude "lat")
> + ('longitude "lon")
> + (_ (symbol->string field)))
> + "=" (number->string value) "\n"))
> +
> +(define (serialize-symbol field value)
> + (string-append (symbol->string field)
> + "=" (symbol->string value) "\n"))
> +
> +(define serialize-inexact-number serialize-integer)
> +
> +(define (inexact-number? n)
> + (and (number? n) (inexact? n)))
> +(define-maybe inexact-number)
> +
> +(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.

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.

Toggle quote (34 lines)
> + (location-provider
> + (symbol 'geoclue2)
> + "Geolocation provider---@code{'manual} or @code{'geoclue2}.
> +
> +In the former case, you must also specify the @code{latitude} and
> +@code{longitude} fields so Redshift can determine daytime at your place. In
> +the latter case, the Geoclue system service must be running; it will be
> +queried for location information.")
> + (adjustment-method
> + (symbol 'randr)
> + "Color adjustment method.")
> +
> + ;; Default values from redshift(1).
> + (daytime-temperature
> + (integer 6500)
> + "Daytime color temperature (kelvins).")
> + (nighttime-temperature
> + (integer 4500)
> + "Nighttime color temperature (kelvins).")
> +
> + (daytime-brightness
> + (maybe-inexact-number 'disabled)
> + "Daytime screen brightness, between 0.1 and 1.0.")
> + (nighttime-brightness
> + (maybe-inexact-number 'disabled)
> + "Nighttime screen brightness, between 0.1 and 1.0.")
> +
> + (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:

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.

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. 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.

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.

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 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=6:00\ndusk-time=18: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)))))

So final configuration will be something like:

(define-configuration home-redshift-configuration
(redshift
(package redshift)
"The redshift package to use.")
(shepherd-service?
(boolean #t)
"Add a redshift service to user's shepherd?")
(redshift-conf
(conf-config '())
"The configuration, which will go to ~/.config/redshift.conf,
Here is an example:
...
To get info about all options see @code{man 1 redshift}"))

Doing so we lose some explorability provided by geiser, because we don't
have separate record fields for each option any more, but get much more
maintainable and simplier configuration implementation.

We don't lose type checking: we can use redshift-config instead of
conf-config and implement proper type checking if we want, a little
harder than with macros on top of records, but not impossible and
probably much more flexible (we have access not only to the value of the
current option, but to the whole configuration).

Toggle quote (31 lines)
> +
> +(define (serialize-redshift-configuration config)
> + (define location-fields
> + '(latitude longitude))
> +
> + (define (location-field? field)
> + (memq (configuration-field-name field) location-fields))
> +
> + #~(string-append
> + "[redshift]\n"
> + #$(serialize-configuration config
> + (remove location-field?
> + home-redshift-configuration-fields))
> + "\n[manual]\n"
> + #$(serialize-configuration config
> + (filter location-field?
> + home-redshift-configuration-fields))))
> +
> +(define (redshift-shepherd-service config)
> + (define config-file
> + (computed-file "redshift.conf"
> + #~(call-with-output-file #$output
> + (lambda (port)
> + (display #$(serialize-redshift-configuration config)
> + port)))))
> +
> + (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.

Toggle quote (10 lines)
> + (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. 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.

Toggle quote (19 lines)
> + (default-value (home-redshift-configuration))
> + (description
> + "Run Redshift, a program that adjust the color temperature of display
> +according to time of day.")))
> diff --git a/gnu/local.mk b/gnu/local.mk
> index 03f6d90b9e..cf72926f5d 100644
> --- a/gnu/local.mk
> +++ b/gnu/local.mk
> @@ -78,6 +78,7 @@ GNU_SYSTEM_MODULES = \
> %D%/ci.scm \
> %D%/home.scm \
> %D%/home/services.scm \
> + %D%/home/services/desktop.scm \
> %D%/home/services/symlink-manager.scm \
> %D%/home/services/fontutils.scm \
> %D%/home/services/shells.scm \
>
> base-commit: ee6bf00b2d89f6acab55b7a82896d99e39c1229b

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.

Related discussions:

--
Best regards,
Andrew Tropin
-----BEGIN PGP SIGNATURE-----

iQJDBAEBCgAtFiEEKEGaxlA4dEDH6S/6IgjSCVjB3rAFAmHzxrsPHGFuZHJld0B0
cm9wLmluAAoJECII0glYwd6wDTwQAJEAFoXRfWVUwjUGO+ZMGt5zMeWuBS58PF3a
bAtiWBJjaIg5IIwWe4jcUjAJODhKRylYriDL4Y8/2ejc0gQzsdsFTa7d0jHXDkrc
q57QUBPVDBSrYDqMOBsj70brBGiiVvOALRTFFWxD9sqN9zKLGHVu5UAnKpBoSA43
CZ7Tfld+HMKDR/Cr0L07jD4AunGoZSU1GWvLKjYzDbVCfTLzt2rj6Mw94AuIHvez
F3fJRfaYwC1tmNlr0l5gJLLOcTZG+MzlYqjm4NR089Z7kAQRAe0oQy24G+MfkVSf
Blp+7kJwPd0cjUzNLLQRUaJ7xiKe02BlMJQFa8f9wXDyufTRlo34AX1xUIpMsysS
ZkSO32pm/iqhHrnw47QY7n5EB2qPvh4K/UhPMOpW7CqpR5yx1YD4Tl/QOkySBdl7
xKfzMY9uY7MBhR6kZZ0eCBh3V0ImGNJM1NxNARqPjQ2dp/rDENPGX2ZMz6D1rhjh
Ai59jv1tvynHWqJ69lks4IXPqliosSZsR1fFbOh/K723x+FMVpv8pa+PERImX4ks
xZkYo4rTd3yhTG3rwOcyhiWhkemkyMt/VAtliF+AXIdbVP/zNUEGB1swW6lBvTps
Y6mzYrKlr4E2zO8ocRKioQtL0Mnr1HgL82VSjTFKIBkWArsAcgNkrG4njD4K613G
Egd3GP+Y
=hs0n
-----END PGP SIGNATURE-----

L
L
Ludovic Courtès wrote on 28 Jan 2022 19:37
(name . Andrew Tropin)(address . andrew@trop.in)(address . 53466@debbugs.gnu.org)
87zgnfbtao.fsf@gnu.org
Hi Andrew,

Andrew Tropin <andrew@trop.in> skribis:

Toggle quote (6 lines)
> On 2022-01-23 12:11, Ludovic Courtès wrote:
>
>> * gnu/home/services/desktop.scm: New file.
>> * gnu/local.mk (GNU_SYSTEM_MODULES): Add it.
>> * doc/guix.texi (Desktop Home Services): New node.

[...]

Toggle quote (8 lines)
>> +(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’ll add it.

Toggle quote (4 lines)
> 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?

Toggle quote (10 lines)
>> + (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’s an
important part of making things intelligible, especially to non-native
speakers.

Toggle quote (9 lines)
> 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’s the usual tradeoff. The choice made so far in Guix has been
to choose clarity over faithfulness to upstream’s name choices.

Toggle quote (4 lines)
> 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’ll add an escape hatch.

Toggle quote (8 lines)
> 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’ll look into it, and I think that’ll help me understand why this
file-like vs. string is so important to you.

Toggle quote (7 lines)
> 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’s the choice we made in Guix: providing bindings for
config file formats. It’s ambitious, but it’s worked well so far. If
it worked for the Dovecot, surely it won’t be a problem here. :-)

Toggle quote (4 lines)
> 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 ‘guix home import’ as a helper, like ‘guix import’. I don’t
think it would make sense to have it automatically handle all the config
files that could possibly be handled by Guix Home services.

Toggle quote (17 lines)
> 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=6:00\ndusk-time=18: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).

[...]

Toggle quote (11 lines)
>> + (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’ll add a FIXME. In practice, that problem would manifest
only if someone logs in at the console first, right?

Perhaps we could define a pseudo ‘xserver-xorg’ Shepherd service that
would be down when ‘DISPLAY’ is undefined, or something like that?

Toggle quote (14 lines)
>> + (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’s not something we usually do for system
services.

As for the latter, I thought about it but I’m not sure what it would be
used for. WDYT?

Toggle quote (5 lines)
> 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?

Toggle quote (4 lines)
> 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’re beyond the scope of this
review. I also think that there’s ample experience with system services
showing that writing “nice” configuration bindings actually works in
practice.

Thanks,
Ludo’.
L
L
Ludovic Courtès wrote on 30 Jan 2022 16:11
[PATCH v2] home: Add redshift service.
(address . 53466@debbugs.gnu.org)(name . Ludovic Courtès)(address . ludo@gnu.org)
20220130151139.3857-1-ludo@gnu.org
* gnu/home/services/desktop.scm: New file.
* gnu/local.mk (GNU_SYSTEM_MODULES): Add it.
* doc/guix.texi (Desktop Home Services): New node.
---
doc/guix.texi | 70 +++++++++++++++
gnu/home/services/desktop.scm | 158 ++++++++++++++++++++++++++++++++++
gnu/local.mk | 1 +
3 files changed, 229 insertions(+)
create mode 100644 gnu/home/services/desktop.scm

Hello!

Changes compared to v1 account for Andrew’s suggestions:

• add ‘redshift’ field to specify the package to use;

• add ‘extra-content’ field as an escape hatch.

We could debate about the latter; from a pragmatic standpoint,
I think it gives all the flexibility one would need in practice.

Thoughts?

Ludo’.

Toggle diff (268 lines)
diff --git a/doc/guix.texi b/doc/guix.texi
index 94f8e5e481..67a5517911 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -37461,6 +37461,7 @@ services)}.
* Shells: Shells Home Services. POSIX shells, Bash, Zsh.
* Mcron: Mcron Home Service. Scheduled User's Job Execution.
* Shepherd: Shepherd Home Service. Managing User's Daemons.
+* Desktop: Desktop Home Services. Services for graphical environments.
@end menu
@c In addition to that Home Services can provide
@@ -37848,6 +37849,75 @@ mechanism instead (@pxref{Shepherd Services}).
@end table
@end deftp
+@node Desktop Home Services
+@subsection Desktop Home Services
+
+The @code{(gnu home services desktop)} module provides services that you
+may find useful on ``desktop'' systems running a graphical user
+environment such as Xorg.
+
+@defvr {Scheme Variable} home-redshift-service-type
+This is the service type for @uref{https://github.com/jonls/redshift,
+Redshift}, a program that adjusts the display color temperature
+according to the time of day. Its associated value must be a
+@code{home-redshift-configuration} record, as shown below.
+
+A typical configuration, where we manually specify the latitude and
+longitude, might look like this:
+
+@lisp
+(service home-redshift-service-type
+ (home-redshift-configuration
+ (location-provider 'manual)
+ (latitude 35.81) ;northern hemisphere
+ (longitude -0.80))) ;west of Greenwich
+@end lisp
+@end defvr
+
+@deftp {Data Type} home-redshift-configuration
+Available @code{home-redshift-configuration} fields are:
+
+@table @asis
+@item @code{redshift} (default: @code{redshift}) (type: file-like)
+Redshift package to use.
+
+@item @code{location-provider} (default: @code{geoclue2}) (type: symbol)
+Geolocation provider---@code{'manual} or @code{'geoclue2}. In the
+former case, you must also specify the @code{latitude} and
+@code{longitude} fields so Redshift can determine daytime at your place.
+In the latter case, the Geoclue system service must be running; it will
+be queried for location information.
+
+@item @code{adjustment-method} (default: @code{randr}) (type: symbol)
+Color adjustment method.
+
+@item @code{daytime-temperature} (default: @code{6500}) (type: integer)
+Daytime color temperature (kelvins).
+
+@item @code{nighttime-temperature} (default: @code{4500}) (type: integer)
+Nighttime color temperature (kelvins).
+
+@item @code{daytime-brightness} (default: @code{disabled}) (type: maybe-inexact-number)
+Daytime screen brightness, between 0.1 and 1.0.
+
+@item @code{nighttime-brightness} (default: @code{disabled}) (type: maybe-inexact-number)
+Nighttime screen brightness, between 0.1 and 1.0.
+
+@item @code{latitude} (default: @code{disabled}) (type: maybe-inexact-number)
+Latitude, when @code{location-provider} is @code{'manual}.
+
+@item @code{longitude} (default: @code{disabled}) (type: maybe-inexact-number)
+Longitude, when @code{location-provider} is @code{'manual}.
+
+@item @code{extra-content} (default: @code{""}) (type: raw-configuration-string)
+Extra content appended as-is to the Redshift configuration file. Run
+@command{man redshift} for more information about the configuration file
+format.
+
+@end table
+
+@end deftp
+
@node Invoking guix home
@section Invoking @code{guix home}
diff --git a/gnu/home/services/desktop.scm b/gnu/home/services/desktop.scm
new file mode 100644
index 0000000000..010668550a
--- /dev/null
+++ b/gnu/home/services/desktop.scm
@@ -0,0 +1,158 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2022 Ludovic Courtès <ludo@gnu.org>
+;;;
+;;; This file is part of GNU Guix.
+;;;
+;;; GNU Guix is free software; you can redistribute it and/or modify it
+;;; under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation; either version 3 of the License, or (at
+;;; your option) any later version.
+;;;
+;;; GNU Guix is distributed in the hope that it will be useful, but
+;;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;;; GNU General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
+
+(define-module (gnu home services desktop)
+ #:use-module (gnu home services)
+ #:use-module (gnu home services shepherd)
+ #:use-module (gnu services configuration)
+ #:autoload (gnu packages xdisorg) (redshift)
+ #:use-module (guix records)
+ #:use-module (guix gexp)
+ #:use-module (srfi srfi-1)
+ #:use-module (ice-9 match)
+ #:export (home-redshift-configuration
+ home-redshift-configuration?
+
+ home-redshift-service-type))
+
+
+;;;
+;;; Redshift.
+;;;
+
+(define (serialize-integer field value)
+ (string-append (match field
+ ('daytime-temperature "temp-day")
+ ('nighttime-temperature "temp-night")
+ ('daytime-brightness "brightness-day")
+ ('nighttime-brightness "brightness-night")
+ ('latitude "lat")
+ ('longitude "lon")
+ (_ (symbol->string field)))
+ "=" (number->string value) "\n"))
+
+(define (serialize-symbol field value)
+ (string-append (symbol->string field)
+ "=" (symbol->string value) "\n"))
+
+(define serialize-inexact-number serialize-integer)
+
+(define (inexact-number? n)
+ (and (number? n) (inexact? n)))
+(define-maybe inexact-number)
+
+(define (serialize-raw-configuration-string field value)
+ value)
+(define raw-configuration-string? string?)
+
+(define-configuration home-redshift-configuration
+ (redshift
+ (file-like redshift)
+ "Redshift package to use.")
+
+ (location-provider
+ (symbol 'geoclue2)
+ "Geolocation provider---@code{'manual} or @code{'geoclue2}.
+
+In the former case, you must also specify the @code{latitude} and
+@code{longitude} fields so Redshift can determine daytime at your place. In
+the latter case, the Geoclue system service must be running; it will be
+queried for location information.")
+ (adjustment-method
+ (symbol 'randr)
+ "Color adjustment method.")
+
+ ;; Default values from redshift(1).
+ (daytime-temperature
+ (integer 6500)
+ "Daytime color temperature (kelvins).")
+ (nighttime-temperature
+ (integer 4500)
+ "Nighttime color temperature (kelvins).")
+
+ (daytime-brightness
+ (maybe-inexact-number 'disabled)
+ "Daytime screen brightness, between 0.1 and 1.0.")
+ (nighttime-brightness
+ (maybe-inexact-number 'disabled)
+ "Nighttime screen brightness, between 0.1 and 1.0.")
+
+ (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}.")
+
+ (extra-content
+ (raw-configuration-string "")
+ "Extra content appended as-is to the Redshift configuration file. Run
+@command{man redshift} for more information about the configuration file
+format."))
+
+(define (serialize-redshift-configuration config)
+ (define location-fields
+ '(latitude longitude))
+
+ (define (location-field? field)
+ (memq (configuration-field-name field) location-fields))
+
+ (define (secondary-field? field)
+ (or (location-field? field)
+ (memq (configuration-field-name field)
+ '(redshift extra-content))))
+
+ #~(string-append
+ "[redshift]\n"
+ #$(serialize-configuration config
+ (remove secondary-field?
+ home-redshift-configuration-fields))
+ "\n[manual]\n"
+ #$(serialize-configuration config
+ (filter location-field?
+ home-redshift-configuration-fields))
+
+ #$(home-redshift-configuration-extra-content config)))
+
+(define (redshift-shepherd-service config)
+ (define config-file
+ (computed-file "redshift.conf"
+ #~(call-with-output-file #$output
+ (lambda (port)
+ (display #$(serialize-redshift-configuration config)
+ port)))))
+
+ (list (shepherd-service
+ (documentation "Redshift program.")
+ (provision '(redshift))
+ ;; FIXME: This fails to start if Home is first activated from a
+ ;; non-X11 session.
+ (start #~(make-forkexec-constructor
+ (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)))
+ (default-value (home-redshift-configuration))
+ (description
+ "Run Redshift, a program that adjusts the color temperature of display
+according to time of day.")))
diff --git a/gnu/local.mk b/gnu/local.mk
index 27e7877361..80cb760132 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -79,6 +79,7 @@ GNU_SYSTEM_MODULES = \
%D%/ci.scm \
%D%/home.scm \
%D%/home/services.scm \
+ %D%/home/services/desktop.scm \
%D%/home/services/symlink-manager.scm \
%D%/home/services/fontutils.scm \
%D%/home/services/shells.scm \

base-commit: 27c1d58d901dcf48929bcb6f76d861fc21575dbf
--
2.34.0
M
M
Maxime Devos wrote on 30 Jan 2022 18:43
(name . Andrew Tropin)(address . andrew@trop.in)
091b93b3f04fe083d9fd0b798523a272fb623ce4.camel@telenet.be
Ludovic Courtès schreef op zo 30-01-2022 om 16:11 [+0100]:
Toggle quote (10 lines)
> +@item @code{location-provider} (default: @code{geoclue2}) (type: symbol)
> +Geolocation provider---@code{'manual} or @code{'geoclue2}.  In the
> +former case, you must also specify the @code{latitude} and
> +@code{longitude} fields so Redshift can determine daytime at your place.
> +In the latter case, the Geoclue system service must be running; it will
> +be queried for location information.
> +
> +@item @code{adjustment-method} (default: @code{randr}) (type: symbol)
> +Color adjustment method.

It would be nice to document which color adjustment methods exist,
as done for 'location-provider'.

Greetings,
Maxime
-----BEGIN PGP SIGNATURE-----

iI0EABYKADUWIQTB8z7iDFKP233XAR9J4+4iGRcl7gUCYfbONhccbWF4aW1lZGV2
b3NAdGVsZW5ldC5iZQAKCRBJ4+4iGRcl7syaAP0evH3AXhY4m9QxzjfKbyRyCBpD
oY38ZNmgdnQQO7lHiAD/cc3kNgzSSAm/9sHWYgiSa9D+8QdCg/vrSFHDH9B2IgY=
=BKLN
-----END PGP SIGNATURE-----


A
A
Andrew Tropin wrote on 31 Jan 2022 19:22
Re: [bug#53466] [PATCH] home: Add redshift service.
(name . Ludovic Courtès)(address . ludo@gnu.org)(address . 53466@debbugs.gnu.org)
87v8xzyddf.fsf@trop.in
On 2022-01-28 19:37, Ludovic Courtès wrote:

Toggle quote (23 lines)
> Hi Andrew,
>
> Andrew Tropin <andrew@trop.in> skribis:
>
>> On 2022-01-23 12:11, Ludovic Courtès 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’ll add it.
>

Good, thank you.

Toggle quote (7 lines)
>> 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?
>

Only add a package to profile and configuration to home-files.

Toggle quote (15 lines)
>>> + (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’s an
> important part of making things intelligible, especially to non-native
> speakers.
>

It's really cool.

Toggle quote (13 lines)
>> 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’s the usual tradeoff. The choice made so far in Guix has been
> to choose clarity over faithfulness to upstream’s name choices.
>

Maybe I'm wrong, but it's very likely that most of the users will be
checking out upstream documentation anyway during configuration of some
programs and those renamings will bring a lot of confusion and
especially, when the record fields names will be combined with names in
escape hatches.

Toggle quote (18 lines)
>> 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’ll 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’ll look into it, and I think that’ll help me understand why this
> file-like vs. string is so important to you.
>

I'll make another reply to the second version of the patch and highlight
this topic a little.

Toggle quote (20 lines)
>> 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’s the choice we made in Guix: providing bindings for
> config file formats. It’s ambitious, but it’s worked well so far. If
> it worked for the Dovecot, surely it won’t 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 ‘guix home import’ as a helper, like ‘guix import’. I don’t
> think it would make sense to have it automatically handle all the config
> files that could possibly be handled by Guix Home services.
>

I treat it the same, I forgot to add that guix home import is just an
example, any generation of configurations or other automated processing
becomes magnitudes harder. Even including sophisticated "type checks".

Toggle quote (22 lines)
>> 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=6:00\ndusk-time=18: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).

Type checks are possible with data structure driven approach as well and
in a fact it's much more flexible and powerful, however to be fair it
will require some work to prepare a good framework for that like
or
for Clojure.

It's also possible to generate documentation for such specs.

Potentially, such approach is more powerful.

However, the big pros of guix records, that it's already have some
whistles and bells.

Toggle quote (17 lines)
>
> [...]
>
>>> + (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’ll add a FIXME. In practice, that problem would manifest
> only if someone logs in at the console first, right?

Mostly yes.

Toggle quote (5 lines)
>
> Perhaps we could define a pseudo ‘xserver-xorg’ Shepherd service that
> would be down when ‘DISPLAY’ is undefined, or something like that?
>

It's only a part of the puzzle, we also need somehow to make this
service to share environment variables with other services, when X
window manager or Wayland compositor is finally started.

Toggle quote (17 lines)
>>> + (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’s not something we usually do for system
> services.

Imagine terminal or almost any other user space program, which doesn't
have a configuration in ~/.config and binary in the profile. Many of
home services will require both to make underlying programs operate
correctly (also think about setting search paths and similar things). I
can imagine some exceptions, but better to keep it consistent and do it
for all home services not to confuse people.

Toggle quote (5 lines)
>
> As for the latter, I thought about it but I’m not sure what it would be
> used for. WDYT?
>

It can be used for debugging, for man pages or when redshift don't use
shepherd service and started in different way (by wm for example).

Toggle quote (9 lines)
>> 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?
>

I think for home services it's ok to always add a package to profile.

Toggle quote (9 lines)
>> 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’re beyond the scope of this
> review. I also think that there’s ample experience with system services
> showing that writing “nice” configuration bindings actually works in
> practice.

I saw how well-written, but macros-based solutions in Clojure ecosystem
slowly died and substituted with data-based. I understand that Guile
ecosystem has a slightly weaker toolkit for processing datastructures,
but by the end of the day I think we will be here sooner or later.
Using macros instead of datastructures feels for me like remaking the
same mistake again knowing the consequences. Maybe I'm wrong.

--
Best regards,
Andrew Tropin
-----BEGIN PGP SIGNATURE-----

iQJDBAEBCgAtFiEEKEGaxlA4dEDH6S/6IgjSCVjB3rAFAmH4KMwPHGFuZHJld0B0
cm9wLmluAAoJECII0glYwd6wOScP/RBunPiNfqji6oce3hvTX0AkZVGYhRUyCMAT
hypEFi1v4bg+W8UoxH3QotA4kugOphk7AIX3XQGMGyiXS1g/2mITNAnwUrzbDEro
UZCd9fFLzwtnw70wV0jXNELfISf003as1HVXD2G62mk9dduSHyxu3PILAN9oixSu
2G1UEsEwIE4sKJoBsx5F5m1hC4g+Nh7fX4dHw6OojgpFymyPlDM0XqJ/H8kf2Ruo
aE9oqEKunUZ8UyUjbBSNtCcRNRI5VfOhLEZvdRn0XqgqWbnbEAZbxVumUJsvKxIE
7H2L32S8vJQjC0bP+7uUzXbczzCPXIv9ck1QIRkoqxT2BIxgpzYgrENzVqBhWnge
VwZPst838u8ofM5oC98b6gRvTzMUieHRPIDDj0EtFdK3KF2+EpBMik1bhc23PSxa
eruWa9FnPwIZUBxQ5YHTAY2Jol7mZvLvTuTuUdHy2SDD9O4xfk1HCTB47G/nO601
j/KXhnnRxO1GHZ82xIzM98rnmMLAafX/nQ026RsRle65De7Q2MPZ2/HxeTsnuJQr
G7q1EPnnIrjQrIiDo2cyZ11Ht+rOUtXr7ZOKQwEMphoGpx7GYWsu3t5xNkKlELd8
Xo4jXq8LCTDKinzVSoP7dWQPf5/CXTUcBVAUSS92a1uEiWXsscjtZa1H8RI7nc71
8qldywFR
=LGT9
-----END PGP SIGNATURE-----

A
A
Andrew Tropin wrote on 31 Jan 2022 19:57
Re: [bug#53466] [PATCH v2] home: Add redshift service.
(name . Ludovic Courtès)(address . ludo@gnu.org)
87r18nybq5.fsf@trop.in
On 2022-01-30 16:11, Ludovic Courtès wrote:

Toggle quote (23 lines)
> * gnu/home/services/desktop.scm: New file.
> * gnu/local.mk (GNU_SYSTEM_MODULES): Add it.
> * doc/guix.texi (Desktop Home Services): New node.
> ---
> doc/guix.texi | 70 +++++++++++++++
> gnu/home/services/desktop.scm | 158 ++++++++++++++++++++++++++++++++++
> gnu/local.mk | 1 +
> 3 files changed, 229 insertions(+)
> create mode 100644 gnu/home/services/desktop.scm
>
> Hello!
>
> Changes compared to v1 account for Andrew’s suggestions:
>
> • add ‘redshift’ field to specify the package to use;
>
> • add ‘extra-content’ field as an escape hatch.
>
> We could debate about the latter; from a pragmatic standpoint,
> I think it gives all the flexibility one would need in practice.
>
> Thoughts?

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.

Toggle quote (227 lines)
>
> Ludo’.
>
> diff --git a/doc/guix.texi b/doc/guix.texi
> index 94f8e5e481..67a5517911 100644
> --- a/doc/guix.texi
> +++ b/doc/guix.texi
> @@ -37461,6 +37461,7 @@ services)}.
> * Shells: Shells Home Services. POSIX shells, Bash, Zsh.
> * Mcron: Mcron Home Service. Scheduled User's Job Execution.
> * Shepherd: Shepherd Home Service. Managing User's Daemons.
> +* Desktop: Desktop Home Services. Services for graphical environments.
> @end menu
> @c In addition to that Home Services can provide
>
> @@ -37848,6 +37849,75 @@ mechanism instead (@pxref{Shepherd Services}).
> @end table
> @end deftp
>
> +@node Desktop Home Services
> +@subsection Desktop Home Services
> +
> +The @code{(gnu home services desktop)} module provides services that you
> +may find useful on ``desktop'' systems running a graphical user
> +environment such as Xorg.
> +
> +@defvr {Scheme Variable} home-redshift-service-type
> +This is the service type for @uref{https://github.com/jonls/redshift,
> +Redshift}, a program that adjusts the display color temperature
> +according to the time of day. Its associated value must be a
> +@code{home-redshift-configuration} record, as shown below.
> +
> +A typical configuration, where we manually specify the latitude and
> +longitude, might look like this:
> +
> +@lisp
> +(service home-redshift-service-type
> + (home-redshift-configuration
> + (location-provider 'manual)
> + (latitude 35.81) ;northern hemisphere
> + (longitude -0.80))) ;west of Greenwich
> +@end lisp
> +@end defvr
> +
> +@deftp {Data Type} home-redshift-configuration
> +Available @code{home-redshift-configuration} fields are:
> +
> +@table @asis
> +@item @code{redshift} (default: @code{redshift}) (type: file-like)
> +Redshift package to use.
> +
> +@item @code{location-provider} (default: @code{geoclue2}) (type: symbol)
> +Geolocation provider---@code{'manual} or @code{'geoclue2}. In the
> +former case, you must also specify the @code{latitude} and
> +@code{longitude} fields so Redshift can determine daytime at your place.
> +In the latter case, the Geoclue system service must be running; it will
> +be queried for location information.
> +
> +@item @code{adjustment-method} (default: @code{randr}) (type: symbol)
> +Color adjustment method.
> +
> +@item @code{daytime-temperature} (default: @code{6500}) (type: integer)
> +Daytime color temperature (kelvins).
> +
> +@item @code{nighttime-temperature} (default: @code{4500}) (type: integer)
> +Nighttime color temperature (kelvins).
> +
> +@item @code{daytime-brightness} (default: @code{disabled}) (type: maybe-inexact-number)
> +Daytime screen brightness, between 0.1 and 1.0.
> +
> +@item @code{nighttime-brightness} (default: @code{disabled}) (type: maybe-inexact-number)
> +Nighttime screen brightness, between 0.1 and 1.0.
> +
> +@item @code{latitude} (default: @code{disabled}) (type: maybe-inexact-number)
> +Latitude, when @code{location-provider} is @code{'manual}.
> +
> +@item @code{longitude} (default: @code{disabled}) (type: maybe-inexact-number)
> +Longitude, when @code{location-provider} is @code{'manual}.
> +
> +@item @code{extra-content} (default: @code{""}) (type: raw-configuration-string)
> +Extra content appended as-is to the Redshift configuration file. Run
> +@command{man redshift} for more information about the configuration file
> +format.
> +
> +@end table
> +
> +@end deftp
> +
> @node Invoking guix home
> @section Invoking @code{guix home}
>
> diff --git a/gnu/home/services/desktop.scm b/gnu/home/services/desktop.scm
> new file mode 100644
> index 0000000000..010668550a
> --- /dev/null
> +++ b/gnu/home/services/desktop.scm
> @@ -0,0 +1,158 @@
> +;;; GNU Guix --- Functional package management for GNU
> +;;; Copyright © 2022 Ludovic Courtès <ludo@gnu.org>
> +;;;
> +;;; This file is part of GNU Guix.
> +;;;
> +;;; GNU Guix is free software; you can redistribute it and/or modify it
> +;;; under the terms of the GNU General Public License as published by
> +;;; the Free Software Foundation; either version 3 of the License, or (at
> +;;; your option) any later version.
> +;;;
> +;;; GNU Guix is distributed in the hope that it will be useful, but
> +;;; WITHOUT ANY WARRANTY; without even the implied warranty of
> +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> +;;; GNU General Public License for more details.
> +;;;
> +;;; You should have received a copy of the GNU General Public License
> +;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
> +
> +(define-module (gnu home services desktop)
> + #:use-module (gnu home services)
> + #:use-module (gnu home services shepherd)
> + #:use-module (gnu services configuration)
> + #:autoload (gnu packages xdisorg) (redshift)
> + #:use-module (guix records)
> + #:use-module (guix gexp)
> + #:use-module (srfi srfi-1)
> + #:use-module (ice-9 match)
> + #:export (home-redshift-configuration
> + home-redshift-configuration?
> +
> + home-redshift-service-type))
> +
> +
> +;;;
> +;;; Redshift.
> +;;;
> +
> +(define (serialize-integer field value)
> + (string-append (match field
> + ('daytime-temperature "temp-day")
> + ('nighttime-temperature "temp-night")
> + ('daytime-brightness "brightness-day")
> + ('nighttime-brightness "brightness-night")
> + ('latitude "lat")
> + ('longitude "lon")
> + (_ (symbol->string field)))
> + "=" (number->string value) "\n"))
> +
> +(define (serialize-symbol field value)
> + (string-append (symbol->string field)
> + "=" (symbol->string value) "\n"))
> +
> +(define serialize-inexact-number serialize-integer)
> +
> +(define (inexact-number? n)
> + (and (number? n) (inexact? n)))
> +(define-maybe inexact-number)
> +
> +(define (serialize-raw-configuration-string field value)
> + value)
> +(define raw-configuration-string? string?)
> +
> +(define-configuration home-redshift-configuration
> + (redshift
> + (file-like redshift)
> + "Redshift package to use.")
> +
> + (location-provider
> + (symbol 'geoclue2)
> + "Geolocation provider---@code{'manual} or @code{'geoclue2}.
> +
> +In the former case, you must also specify the @code{latitude} and
> +@code{longitude} fields so Redshift can determine daytime at your place. In
> +the latter case, the Geoclue system service must be running; it will be
> +queried for location information.")
> + (adjustment-method
> + (symbol 'randr)
> + "Color adjustment method.")
> +
> + ;; Default values from redshift(1).
> + (daytime-temperature
> + (integer 6500)
> + "Daytime color temperature (kelvins).")
> + (nighttime-temperature
> + (integer 4500)
> + "Nighttime color temperature (kelvins).")
> +
> + (daytime-brightness
> + (maybe-inexact-number 'disabled)
> + "Daytime screen brightness, between 0.1 and 1.0.")
> + (nighttime-brightness
> + (maybe-inexact-number 'disabled)
> + "Nighttime screen brightness, between 0.1 and 1.0.")
> +
> + (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}.")
> +
> + (extra-content
> + (raw-configuration-string "")
> + "Extra content appended as-is to the Redshift configuration file. Run
> +@command{man redshift} for more information about the configuration file
> +format."))
> +
> +(define (serialize-redshift-configuration config)
> + (define location-fields
> + '(latitude longitude))
> +
> + (define (location-field? field)
> + (memq (configuration-field-name field) location-fields))
> +
> + (define (secondary-field? field)
> + (or (location-field? field)
> + (memq (configuration-field-name field)
> + '(redshift extra-content))))
> +
> + #~(string-append
> + "[redshift]\n"
> + #$(serialize-configuration config
> + (remove secondary-field?
> + home-redshift-configuration-fields))
> + "\n[manual]\n"
> + #$(serialize-configuration config
> + (filter location-field?
> + home-redshift-configuration-fields))
> +

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).
Using such type of escape hatch is no joy at all.

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=5:30
dusk-time=18:30
[geoclue2]
some-other-option=value
# 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.
Toggle quote (3 lines)
>
> + #$(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.

Toggle quote (43 lines)
> +
> +(define (redshift-shepherd-service config)
> + (define config-file
> + (computed-file "redshift.conf"
> + #~(call-with-output-file #$output
> + (lambda (port)
> + (display #$(serialize-redshift-configuration config)
> + port)))))
> +
> + (list (shepherd-service
> + (documentation "Redshift program.")
> + (provision '(redshift))
> + ;; FIXME: This fails to start if Home is first activated from a
> + ;; non-X11 session.
> + (start #~(make-forkexec-constructor
> + (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)))
> + (default-value (home-redshift-configuration))
> + (description
> + "Run Redshift, a program that adjusts the color temperature of display
> +according to time of day.")))
> diff --git a/gnu/local.mk b/gnu/local.mk
> index 27e7877361..80cb760132 100644
> --- a/gnu/local.mk
> +++ b/gnu/local.mk
> @@ -79,6 +79,7 @@ GNU_SYSTEM_MODULES = \
> %D%/ci.scm \
> %D%/home.scm \
> %D%/home/services.scm \
> + %D%/home/services/desktop.scm \
> %D%/home/services/symlink-manager.scm \
> %D%/home/services/fontutils.scm \
> %D%/home/services/shells.scm \
>
> base-commit: 27c1d58d901dcf48929bcb6f76d861fc21575dbf

--
Best regards,
Andrew Tropin
-----BEGIN PGP SIGNATURE-----

iQJDBAEBCgAtFiEEKEGaxlA4dEDH6S/6IgjSCVjB3rAFAmH4MSIPHGFuZHJld0B0
cm9wLmluAAoJECII0glYwd6wQMoP/iqMv0dgHlIYxUWp4n+v9R2140n8QQhr+GFU
R7zEyznIfs3LKWd5WH1UhUAhTNWZ8NPJlIjdTj14Pawpvu4CL8ZkTS+ISE44VJ7z
dY/ApOYr/oK/X/ODg2xKF4bDGOFefR8TIjTcUtYJoHA4ElmXD3us4vtsjcpAgVAw
AQap2bzKr70QJ169dZ4Iq4gzJqBbUq1uwn3pBXG5CkTraVJyR09EnoeRyEL3wUTh
iBMobOQR2EULK42ya5oXPvgmUo5GUHVB9LbaPwLUlKPqeyNjnUYxL52lisRBn8O6
n8izHY1NMZyr0AT2PcVgxljm4XRwLaOGH6KV2eAWycYBc6J8rrT9y0KO6X6ciJoq
CNxKVKfdrqvFQP/CqdgqDCOFT1U2MxRnSfDXjPcQJ/3Evks2ZSvcpwx/Rx6lppG3
vRy2O5PsrGBQtTTq9BjqyjI7Kc6psufzTp7D2uzOBIY+O+spkRBk1zkGBGN1IC4t
iTLZliipBQui47EOo/byCpDkm6Sg5jSUHdoX5pjfBZiICUfrmxFv4kHXqCPMGRcl
mhzUXNa2rtel0WxTQTgIZAq9C5AS0TunYLjxnchhF1d2Q8SxV6bRCMvFRI0ftbgc
fLO/ULW9VqGi8BTJa3Ah74wKgxDAZfAssvsAqfhCBAGG9vL0vh8XsqqJ2ikOIev7
9BfYs/oQ
=T2To
-----END PGP SIGNATURE-----

L
L
Ludovic Courtès wrote on 1 Feb 2022 09:36
(name . Maxime Devos)(address . maximedevos@telenet.be)
87v8xz6l0r.fsf@gnu.org
Hi,

Maxime Devos <maximedevos@telenet.be> skribis:

Toggle quote (14 lines)
> Ludovic Courtès schreef op zo 30-01-2022 om 16:11 [+0100]:
>> +@item @code{location-provider} (default: @code{geoclue2}) (type: symbol)
>> +Geolocation provider---@code{'manual} or @code{'geoclue2}.  In the
>> +former case, you must also specify the @code{latitude} and
>> +@code{longitude} fields so Redshift can determine daytime at your place.
>> +In the latter case, the Geoclue system service must be running; it will
>> +be queried for location information.
>> +
>> +@item @code{adjustment-method} (default: @code{randr}) (type: symbol)
>> +Color adjustment method.
>
> It would be nice to document which color adjustment methods exist,
> as done for 'location-provider'.

Good idea, will do.

Thanks,
Ludo’.
L
L
Ludovic Courtès wrote on 1 Feb 2022 09:43
(name . Andrew Tropin)(address . andrew@trop.in)(address . 53466@debbugs.gnu.org)
87leyv6kp1.fsf@gnu.org
Hi,

Andrew Tropin <andrew@trop.in> skribis:

Toggle quote (6 lines)
> On 2022-01-30 16:11, Ludovic Courtès wrote:
>
>> * gnu/home/services/desktop.scm: New file.
>> * gnu/local.mk (GNU_SYSTEM_MODULES): Add it.
>> * doc/guix.texi (Desktop Home Services): New node.

[...]

Toggle quote (4 lines)
> 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.

Toggle quote (4 lines)
> 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-configuration-string)
Extra content appended as-is to the Redshift configuration file. […]

Notice “appended”. How would you phrase it?

Toggle quote (2 lines)
> Using such type of escape hatch is no joy at all.

Escape hatches are meant to be used as a last resort; they’re a hack.
Normally, people would have everything they need with the provided
bindings. So yes, using them is no fun, but that’s not a surprise IMO.

Toggle quote (17 lines)
> 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=5:30
> dusk-time=18:30
> [geoclue2]
> some-other-option=value
> # 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’s what you’re getting at? :-)

I can do that.

Toggle quote (15 lines)
>> + #$(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’t any more consistent than what we have today, which is at
least a consolation.

Thanks,
Ludo’.
L
L
Ludovic Courtès wrote on 1 Feb 2022 10:15
Re: [bug#53466] [PATCH] home: Add redshift service.
(name . Andrew Tropin)(address . andrew@trop.in)(address . 53466@debbugs.gnu.org)
87v8xz54n9.fsf@gnu.org
Hi Andrew,

We’re drifting away from the practical issue of adding a Redshift
service, but you raise interesting issues.

Andrew Tropin <andrew@trop.in> skribis:

[...]

Toggle quote (10 lines)
>> Yes, that’s the usual tradeoff. The choice made so far in Guix has been
>> to choose clarity over faithfulness to upstream’s name choices.
>>
>
> Maybe I'm wrong, but it's very likely that most of the users will be
> checking out upstream documentation anyway during configuration of some
> programs and those renamings will bring a lot of confusion and
> especially, when the record fields names will be combined with names in
> escape hatches.

I think there doesn’t have to be a single answer. For Redshift and its
handful of options, I see little incentive to go look at ‘man redshift’;
it doesn’t add much to what we provide.

For more complex services, the answer might be different, although again
the Dovecot service shows that, even for this big a service, we can
provide comprehensive bindings and associated documentation.

[...]

Toggle quote (17 lines)
>> 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).
>
> Type checks are possible with data structure driven approach as well and
> in a fact it's much more flexible and powerful, however to be fair it
> will require some work to prepare a good framework for that like
> https://github.com/plumatic/schema
> or
> https://github.com/metosin/spec-tools/blob/master/docs/02_data_specs.md
> for Clojure.
>
> It's also possible to generate documentation for such specs.
>
> Potentially, such approach is more powerful.

I’m aware of Clojure specs, but I don’t find it convincing compared to
records, at least for our use case.

[...]

Toggle quote (9 lines)
>>> 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’s not something we usually do for system
>> services.
>
> Imagine terminal or almost any other user space program

I’m not imagining: we’re discussing a very concrete service here. :-)

For Redshift, I don’t see the point of making the config available
globally. For system services, there’s only a handful of exception (PAM
and OpenSSH come to mind, but see /etc).

Again, there doesn’t have to be a single answer. I suspect many
services won’t need to make their config available under ~/.config, but
if some do, so be it. I’d say that the default should be to not make
config available unless that’s required, just like what we do for system
services.

How does that sound?

Toggle quote (7 lines)
>> As for the latter, I thought about it but I’m not sure what it would be
>> used for. WDYT?
>>
>
> It can be used for debugging, for man pages or when redshift don't use
> shepherd service and started in different way (by wm for example).

The point of this Redshift service is to have it started automatically,
so to me the only reason to add ‘redshift’ to the user profile would be
to allow ‘man redshift’.

I don’t view it as super useful in this case, and would instead lean on
the side of not “polluting” the user’s profile, but I can very well
imagine that in other cases we’d prefer to extend the user’s profile.

Toggle quote (11 lines)
>> I understand your concerns, but I think they’re beyond the scope of this
>> review. I also think that there’s ample experience with system services
>> showing that writing “nice” configuration bindings actually works in
>> practice.
>
> I saw how well-written, but macros-based solutions in Clojure ecosystem
> slowly died and substituted with data-based. I understand that Guile
> ecosystem has a slightly weaker toolkit for processing datastructures,
> but by the end of the day I think we will be here sooner or later.
> Using macros instead of datastructures feels for me like remaking the

Records are data structures, not macros.

Toggle quote (2 lines)
> same mistake again knowing the consequences. Maybe I'm wrong.

Maybe one of us is wrong, or maybe it’s more complex than this. :-)

As it turns out, I find Guix’s configuration records rather nice to
use—much nicer than, for example, Gnus’ loose configuration trees.

Thanks for your feedback,
Ludo’.
A
A
Andrew Tropin wrote on 2 Feb 2022 07:59
(name . Ludovic Courtès)(address . ludo@gnu.org)(address . 53466@debbugs.gnu.org)
87fsp1zrcw.fsf@trop.in
On 2022-02-01 10:15, Ludovic Courtès wrote:

Toggle quote (5 lines)
> Hi Andrew,
>
> We’re drifting away from the practical issue of adding a Redshift
> service, but you raise interesting issues.

That's true, but a few first home services will set the tone for the
rest, so it's probably a good idea to look ahead right now, then later.

Toggle quote (46 lines)
>
> Andrew Tropin <andrew@trop.in> skribis:
>
> [...]
>
>>> Yes, that’s the usual tradeoff. The choice made so far in Guix has been
>>> to choose clarity over faithfulness to upstream’s name choices.
>>>
>>
>> Maybe I'm wrong, but it's very likely that most of the users will be
>> checking out upstream documentation anyway during configuration of some
>> programs and those renamings will bring a lot of confusion and
>> especially, when the record fields names will be combined with names in
>> escape hatches.
>
> I think there doesn’t have to be a single answer. For Redshift and its
> handful of options, I see little incentive to go look at ‘man redshift’;
> it doesn’t add much to what we provide.
>
> For more complex services, the answer might be different, although again
> the Dovecot service shows that, even for this big a service, we can
> provide comprehensive bindings and associated documentation.
>
> [...]
>
>>> 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).
>>
>> Type checks are possible with data structure driven approach as well and
>> in a fact it's much more flexible and powerful, however to be fair it
>> will require some work to prepare a good framework for that like
>> https://github.com/plumatic/schema
>> or
>> https://github.com/metosin/spec-tools/blob/master/docs/02_data_specs.md
>> for Clojure.
>>
>> It's also possible to generate documentation for such specs.
>>
>> Potentially, such approach is more powerful.
>
> I’m aware of Clojure specs, but I don’t find it convincing compared to
> records, at least for our use case.
>

Ok.

Toggle quote (23 lines)
>>>> 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’s not something we usually do for system
>>> services.
>>
>> Imagine terminal or almost any other user space program
>
> I’m not imagining: we’re discussing a very concrete service here. :-)
>
> For Redshift, I don’t see the point of making the config available
> globally. For system services, there’s only a handful of exception (PAM
> and OpenSSH come to mind, but see /etc).
>
> Again, there doesn’t have to be a single answer. I suspect many
> services won’t need to make their config available under ~/.config, but
> if some do, so be it. I’d say that the default should be to not make
> config available unless that’s required, just like what we do for system
> services.
>
> How does that sound?

It sounds logical for redshift, but inconsistent in general: some home
services install package to profile, some not, some create config in
XDG_CONFIG_DIR, some not.

I still think that almost all services must provide both package and
configs.

Toggle quote (29 lines)
>>> As for the latter, I thought about it but I’m not sure what it would be
>>> used for. WDYT?
>>>
>>
>> It can be used for debugging, for man pages or when redshift don't use
>> shepherd service and started in different way (by wm for example).
>
> The point of this Redshift service is to have it started automatically,
> so to me the only reason to add ‘redshift’ to the user profile would be
> to allow ‘man redshift’.
>
> I don’t view it as super useful in this case, and would instead lean on
> the side of not “polluting” the user’s profile, but I can very well
> imagine that in other cases we’d prefer to extend the user’s profile.
>
>>> I understand your concerns, but I think they’re beyond the scope of this
>>> review. I also think that there’s ample experience with system services
>>> showing that writing “nice” configuration bindings actually works in
>>> practice.
>>
>> I saw how well-written, but macros-based solutions in Clojure ecosystem
>> slowly died and substituted with data-based. I understand that Guile
>> ecosystem has a slightly weaker toolkit for processing datastructures,
>> but by the end of the day I think we will be here sooner or later.
>> Using macros instead of datastructures feels for me like remaking the
>
> Records are data structures, not macros.
>

But, IIRC, define-configuration, define-record-type are.

Toggle quote (4 lines)
>> same mistake again knowing the consequences. Maybe I'm wrong.
>
> Maybe one of us is wrong, or maybe it’s more complex than this. :-)

Also, maybe my non-guile experience doesn't apply here.

Toggle quote (4 lines)
>
> As it turns out, I find Guix’s configuration records rather nice to
> use—much nicer than, for example, Gnus’ loose configuration trees.

Unfortunately, I'm not familiar with Gnus internals and can't say if
it's related, similar or not.

--
Best regards,
Andrew Tropin
-----BEGIN PGP SIGNATURE-----

iQJDBAEBCgAtFiEEKEGaxlA4dEDH6S/6IgjSCVjB3rAFAmH6K78PHGFuZHJld0B0
cm9wLmluAAoJECII0glYwd6wi8cP/jUbawgZB2j7UUyN3b7GedLqCEQyPKqJBwwY
OlwCIT+t8BADpMWvbHeXdZze69N8Dq0LZSBYzO4SkX615Y+m7h5P4Y+fN9gCip7W
QYcXuupMAwwiS+H36r10AQrhdLaWpkP81JGmhrOJ3NfdYbOu6nmuLu+UyK1+8FUy
hvBG/Q568heBcA6y8QgMtr052EJpu1IlBZ5kYxI7EKZjoA3LN8FINKkijH1GZNw3
1Zxp6c1OLAGAQJ0eV9jrjHKKDpiSvcGozaKaU6xtLdfdvkhfhTS5KBac+Rc5N20Y
siXWeHCzz5XqVRi7VMNM9FEQl8BE0UdDgpOGVmS4JHb3HOM87MfVZWZc+EalVWVF
biM8bQlXxH31EascJwJcrdJ8N6QBP4L3VK//XMi+7Qj7mNmoSqvE1dEuGMiGuR9l
ViW+uuY6BKRJF2LEj69VOEwnIkkNKO+s9kkOMQiOAbsi46meCzAo5V22KMbvmgS7
oWB+drg/UIb2zyDsW8O+AQnlcnhwfEx/FUfz6f6J9lV43fsHdQXWr4uBu4dO/2dy
9MnYFzXVxP4/ckx1keCPj1kfA2SKctNIw3NSxGNKJP62TtfwO04dK3tJPbMhgyBA
9uvUttazmY3ABs/XekjuPYSEA7Oo9Dgt512xA2ARQRYPo/Iel/VGZjgbEnAtiUwU
IjPGFgjA
=A+fP
-----END PGP SIGNATURE-----

A
A
Andrew Tropin wrote on 2 Feb 2022 08:48
Re: [bug#53466] [PATCH v2] home: Add redshift service.
(name . Ludovic Courtès)(address . ludo@gnu.org)(address . 53466@debbugs.gnu.org)
87bkzpzp33.fsf@trop.in
On 2022-02-01 09:43, Ludovic Courtès wrote:

Toggle quote (29 lines)
> Hi,
>
> Andrew Tropin <andrew@trop.in> skribis:
>
>> On 2022-01-30 16:11, Ludovic Courtès 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-configuration-string)
> Extra content appended as-is to the Redshift configuration file. […]
>
> Notice “appended”. How would you phrase it?

(:

Toggle quote (28 lines)
>> Using such type of escape hatch is no joy at all.
>
> Escape hatches are meant to be used as a last resort; they’re a hack.
> Normally, people would have everything they need with the provided
> bindings. So yes, using them is no fun, but that’s not a surprise 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=5:30
>> dusk-time=18:30
>> [geoclue2]
>> some-other-option=value
>> # 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’s what you’re 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).

Toggle quote (22 lines)
>
> 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’t 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):

Sometimes, it allows to add a multi-line string to the end of the file:

but it's getting deprecated, when proper serializer for target config
format is implemented:

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.

--
Best regards,
Andrew Tropin
-----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-----

A
A
Andrew Tropin wrote on 2 Feb 2022 09:57
Re: [bug#53466] [PATCH] home: Add redshift service.
(name . Ludovic Courtès)(address . ludo@gnu.org)(address . 53466@debbugs.gnu.org)
874k5hzlvo.fsf@trop.in
On 2022-02-01 10:15, Ludovic Courtès wrote:

Toggle quote (5 lines)
> Hi Andrew,
>
> We’re drifting away from the practical issue of adding a Redshift
> service, but you raise interesting issues.

I have a few more to raise, but they are unrelated to redshift and even
weakly related to configuration styles :)

Overall, I'm ok with this redshift service and if you are sure that
tradeoffs accepted by guix system services are correct even in the light
of issues I mentioned and we don't need to try a slightly different and
more data-structure oriented way, I think we can proceed with this
service.

Just give it one more week, after a next revision of the patch with
fixed escape hatch is published, just in case someone else has good
arguments, but didn't speak yet.

I think I'll move (gnu home-services ...) I personally use and
incompatible with system services approach to (rde home services) not to
confuse people and will maintain them myself. But I'm ok if someone
would like to rewrite to the usual style and upstream them, I will help
with the review.

--
Best regards,
Andrew Tropin
-----BEGIN PGP SIGNATURE-----

iQJDBAEBCgAtFiEEKEGaxlA4dEDH6S/6IgjSCVjB3rAFAmH6R3sPHGFuZHJld0B0
cm9wLmluAAoJECII0glYwd6wLNAP/3ts5MC9M+KRCkiDoVW9WMXN/H8XdVO5GjeD
XAwrjbW+fF1iwMkoExy6hIPTmsOAOB+XaX9AGH2cMKUPjRd8p2O+i9vYIqrnwZ5s
n+C1b9MsuPQASKr1DWxioP5a1slwmySJtfW80d+WWH3u42aK400gL1Vw38LDHIt2
Cx7YIV1H7mX7GnF2Ad0ONkYYq7k0VvvvCKTIvoIfEKQluQX6hp8Wf6C9VEzSph+2
w1YgH2QxYPn7+ffHGRgPBHHkfQyk7v+vpB4WOelp0T6ftibvM7fitpg0h/Vcd/uk
2MQg5l9yeEH9XxDaqlnoZt6y0b0ZcK+YmZdRUos0DnL40yE8CdNlU1r1hgUVct04
1SpDP21BHsbCAo8EXhjRpdE8u4QP5qTXkVF09OXKPwPuCtQot1hS18f5vGEfwNcH
muhDNwLKwEK4x2myTTiq6wlreYAfuEWvGqIVG5F+9749QQUy6haYdoIjTw/Hm1fY
qqLWs+YbCGQsc/HcQTvSxAOX3fs+KXN4bQxJCI+bFNBbdcoDiawPThvPJYHC8sUQ
68+ulLY4X4pgXfrLKW5O/9bdo4es/zg30w6nnVWNzabMgYL/yvPitoIsVqoAMalz
/pbByauld1TT4G5R/prZcJ9BhLJPw4GCDoo0TjEYjbh57RIU+RIk8z1hqygwj68Z
YB+J8Qw0
=Wa8S
-----END PGP SIGNATURE-----

L
L
Ludovic Courtès wrote on 7 Feb 2022 00:13
Re: bug#53466: [PATCH] home: Add redshift service.
(name . Andrew Tropin)(address . andrew@trop.in)(address . 53466-done@debbugs.gnu.org)
87bkzjfv1u.fsf_-_@gnu.org
Hi Andrew,

Andrew Tropin <andrew@trop.in> skribis:

Toggle quote (14 lines)
> 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).

Ah got it. I went for #2 and #4 (there are still missing options, but
we can add them when people actually need them.)

Pushed as 39e8025d3b40a0079f75e0ce9a91b6dad6766773.

Toggle quote (27 lines)
>> How does NixOS handle escape hatches today? Back when I was using it is
>> that it wasn’t 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.extraConfig
> https://rycee.gitlab.io/home-manager/options.html#opt-accounts.email.accounts._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.extraConfig
>
> 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.

OK, I see. Nix is all about attribute sets, which are dictionaries,
like alists, and just as sloppy: you can add attributes but they may or
may not be ignored, you never know. Here they “take advantage” of that,
IIUC, by serializing attributes that happen to be here.

Nix (the language) doesn’t have the ability to define disjoint types
like what we’re doing with configuration record types, and to me that’s
a weakness that directly affects usability.

Thanks,
Ludo’.
Closed
A
A
Andrew Tropin wrote on 7 Feb 2022 16:16
(name . Ludovic Courtès)(address . ludo@gnu.org)(address . 53466-done@debbugs.gnu.org)
87wni67lmo.fsf@trop.in
On 2022-02-07 00:13, Ludovic Courtès wrote:

Toggle quote (24 lines)
> Hi Andrew,
>
> Andrew Tropin <andrew@trop.in> skribis:
>
>> 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).
>
> Ah got it. I went for #2 and #4 (there are still missing options, but
> we can add them when people actually need them.)
>
> Pushed as 39e8025d3b40a0079f75e0ce9a91b6dad6766773.
>

Good, thank you for working on this!)

Toggle quote (39 lines)
>>> How does NixOS handle escape hatches today? Back when I was using it is
>>> that it wasn’t 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.extraConfig
>> https://rycee.gitlab.io/home-manager/options.html#opt-accounts.email.accounts._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.extraConfig
>>
>> 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.
>
> OK, I see. Nix is all about attribute sets, which are dictionaries,
> like alists, and just as sloppy: you can add attributes but they may or
> may not be ignored, you never know. Here they “take advantage” of that,
> IIUC, by serializing attributes that happen to be here.
>
> Nix (the language) doesn’t have the ability to define disjoint types
> like what we’re doing with configuration record types, and to me that’s
> a weakness that directly affects usability.
>
> Thanks,
> Ludo’.

--
Best regards,
Andrew Tropin
-----BEGIN PGP SIGNATURE-----

iQJDBAEBCgAtFiEEKEGaxlA4dEDH6S/6IgjSCVjB3rAFAmIBN78PHGFuZHJld0B0
cm9wLmluAAoJECII0glYwd6wYhMP/i9qfRRRJBRm1oPE2Lk1fBgpebmk+eYMD/pC
u9Ev3ea6bwc8KMexRtTsn8UBonMFaDVnD7y7fyHFK9uzJzweHX15kiRLhiZhhEN1
6JM/VXOoBqNAV1s+uEdPtSQimfPljhz4NKgn80jDDygSj9Y1yd8oqLeQRbswcwKR
a5GkRo21osfsRPkla39tt3vlY9BAkeboIZdLWbP2/T0fFzKcaXuwDEf/+41sLyGm
yR+jq3ubO02O53q7rvwIx2oat8CEq8LRCvuer7Cr511N6tewZeMIosSN3NNd2n6E
8AygtbZDmdB4w6MetP06wsSKi+nJq8uZj0Dm2v6Me6MV0kXFhrgT1iBu6uJuhXDn
YlE9dHVxbp2JYwOkYuxMmt3LJ27LjUc0wXqBr+U35/4mfhzoBmoQHzm2seDASrHv
+q6TIqNsjJVut7yr8XxT19ROFIeI1MeWLTGh4GN6ddzj9wwM8Mxm54zFgWKnX0i6
kjuYMhqX5YXOIN0W6NkvRuhl8W8c/sD8FmjNOlxzdlwca55lix+v/FxQ347FpAhi
QcQfygpva/Mug+v6aUaIHaX9LBnlXPHzxUs8YKexd3C6YH5WptYGsup/piUBo7rc
9a7LiVv5dGevd8lmGBMwKpYQK4wWGGCTlQmiryapKlmkQQRpzEp1NmGdIXQ3cA8v
nQT3MCrG
=ZQXd
-----END PGP SIGNATURE-----

Closed
L
L
Ludovic Courtès wrote on 8 Feb 2022 10:22
Re: [bug#53466] [PATCH] home: Add redshift service.
(name . Andrew Tropin)(address . andrew@trop.in)(address . 53466@debbugs.gnu.org)
878ruld86f.fsf@gnu.org
Hi Andrew,

I hadn’t noticed this message of yours earlier…

Andrew Tropin <andrew@trop.in> skribis:

Toggle quote (6 lines)
> I think I'll move (gnu home-services ...) I personally use and
> incompatible with system services approach to (rde home services) not to
> confuse people and will maintain them myself. But I'm ok if someone
> would like to rewrite to the usual style and upstream them, I will help
> with the review.

Alright noted. I would obviously prefer if you would instead contribute
those services to Guix Home proper—that was the whole point of getting
it merge in Guix in the first place, right?

I feel that perhaps, contrary to what I thought, we hadn’t reached a
shared understanding of what it means to maintain things collectively
withing Guix. It’s a bit of a sad situation, but I’m sure there’ll
still be good things happening in Guix Home, and in rde.

Thanks,
Ludo’.
A
A
Andrew Tropin wrote on 13 Mar 2022 10:41
(address . control@debbugs.gnu.org)
878rte6vfy.fsf@trop.in
unarchive 53466
-----BEGIN PGP SIGNATURE-----

iQJDBAEBCgAtFiEEKEGaxlA4dEDH6S/6IgjSCVjB3rAFAmItvFEPHGFuZHJld0B0
cm9wLmluAAoJECII0glYwd6w1X0P+waUKXUel5yuRklrQBrqvdVwfome5zyIxwxN
QgYDZPBtzSezDxQ1dMZLCkB1UCWzYRAeWyF21L5c7J8WhPiZO7cTwfkbkoDYXTEv
3i7drWsUNoSOl8jPk9yl3i4cURWdy9QMOfeCS6kPvmoZzxE6edDByecsH1zAlPEV
g74dqmZhvkU/MJvYdNBnYAsyX1st1L591cBmtzAaLFk50m9mEM6hOL3BL1oiaklH
OPOnYJovcF2yMCKLmOQgF+S55aH+mOituVScx2aqj2fu/59mBi3YM+XAe3yZP3UH
yRU7CPO2nSej6QGWh+58P65+tLHgRvHgYWTXL5lBWcoF0g4uQUYwxGRjqLU2m2LM
9j/stZInY+GlzunK/m/5iPHrEnBYvSyr/vtuIKps8sePX7c0i85+MQL4F//GcKD+
0OjgpMsoQ36WxTl0TssV/XEKcwuqhHYfXNbioeNsRPL5IBuv/giYeJ9zJmRP90kt
+PkaIyJBDPSuggr3Jiz4p3LBztfPROkSpn+boPnwrOaLudd6qM6dkeMK8z8X3n5C
aKzHqe7Lr4kaaWn0lmfhwn6b/PDqpO3In9zz9iUBBW0dcm6yps/wjq4/ZmNHTBjo
yHuvDg9e5tO6kHNQYAIkbmeGoH1Trf8n7IAW9Jeh0c/4eHZBv2si1JI/rx6O1+P+
YdFybKVc
=rVx5
-----END PGP SIGNATURE-----

A
A
Andrew Tropin wrote on 13 Mar 2022 10:52
(name . Ludovic Courtès)(address . ludo@gnu.org)(address . 53466@debbugs.gnu.org)
877d8y6uyh.fsf@trop.in
On 2022-02-08 10:22, Ludovic Courtès wrote:

Toggle quote (16 lines)
> Hi Andrew,
>
> I hadn’t noticed this message of yours earlier…
>
> Andrew Tropin <andrew@trop.in> skribis:
>
>> I think I'll move (gnu home-services ...) I personally use and
>> incompatible with system services approach to (rde home services) not to
>> confuse people and will maintain them myself. But I'm ok if someone
>> would like to rewrite to the usual style and upstream them, I will help
>> with the review.
>
> Alright noted. I would obviously prefer if you would instead contribute
> those services to Guix Home proper—that was the whole point of getting
> it merge in Guix in the first place, right?

Originally, I planned to upstream them, but the implementation of rde
home services is quite different from guix system services, that means
it would be necessary to almost completely rewrite them to match the
style of system services and move them to Guix proper. In addition to
updating rde parts depending on those services it's a humongous amount
of work. I can't do it right now for various reasons, so I will just
move them from (gnu home-services) to prevent future compatibilty
problems and the overall amount the usage by people who are looking for
guix home services.

In the meantime people looking for some missing home services can take
an inspiration from rde home service and send patches to guix-patches
with proper implementation, I can help with code review and provide some
insights, suggestions and knowledge about possible pitfalls.

Maybe in the future rde will be able to migrate to guix home services.

Toggle quote (5 lines)
> I feel that perhaps, contrary to what I thought, we hadn’t reached a
> shared understanding of what it means to maintain things collectively
> withing Guix. It’s a bit of a sad situation, but I’m sure there’ll
> still be good things happening in Guix Home, and in rde.

I try to upstream everything I can, to make everyone in Guix community
be able benefit from it and also to make a code benefit from collective
maintenance in Guix repo. BTW, sending you a lot of kudos for improving
guix home and symlink-manager code.

Resending this email to keep public record of it. (It was declined by
debbugs cause issue was archived).

--
Best regards,
Andrew Tropin
-----BEGIN PGP SIGNATURE-----

iQJDBAEBCgAtFiEEKEGaxlA4dEDH6S/6IgjSCVjB3rAFAmItkuwPHGFuZHJld0B0
cm9wLmluAAoJECII0glYwd6wat8P/R9mpO+lXuICbiOF73oloQIGFDbMwdtUBBtW
23ur8XVrJPVLwnu2jIm+WfTVjYDcsAty9iMLrhKSLwD4QtwaORivvDgIN4/Mp1XI
0DEsQ0M9OByRyxtMdckHpam7l8dM0TrVJpXzXj79HC1+TyOC73YIfHDk5my+Npqc
Hy7FD984Zvi/+uXB8AnV4VVIScGhCP+aLdJdO/LzUQuWz1NvrgBQUg8cZr+UhV9T
ByuYe26iM1VdJKCIUJJY5uXBUfrMVDUnpEOmBf7NZVPNCCf2hdrGAkKviHvHLPbn
JJGaa6ZM7Lov1xHPculxNWqS23ZRNsMHpfiyJ4i3rhO5Dn4wA8YTbc6Zeb1tsRCP
Ftpg52ATREMW9BPDghtX1tXJKfX4GnytkWKh5l40Rc5ZLRnFgLBy+ktiBbMfC2GU
xmp9xuDJHXqhSYSJEQobAe7fv+fGYbX5e08CXmh2trQTlYxzHGh9q0JPYc+ScHmy
eOaBHWaVT6Dzs1wNj7fB/siaFRHQv8T5vQq5Y5ABOiOl+7jTF09uUw7bl6pZwEo0
RVzRnbgIKMC9gqWpzsr1ycDZfQYVLW3AJk50MOpftKwnqlX3oe51ER690xz6cLxM
nwmcwsyeLe6sDeTa+B1nuNcg4DeHR56bveF8CATJgMl8aCeqCYhfa2BLflOZKWN6
Q6UAuJxC
=bhHP
-----END PGP SIGNATURE-----
?
Your comment

This issue is archived.

To comment on this conversation send an email to 53466@debbugs.gnu.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 53466
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch