all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Ludovic Courtès" <ludo@gnu.org>
To: Andrew Tropin <andrew@trop.in>
Cc: 53466-done@debbugs.gnu.org
Subject: bug#53466: [PATCH] home: Add redshift service.
Date: Mon, 07 Feb 2022 00:13:17 +0100	[thread overview]
Message-ID: <87bkzjfv1u.fsf_-_@gnu.org> (raw)
In-Reply-To: <87bkzpzp33.fsf@trop.in> (Andrew Tropin's message of "Wed, 02 Feb 2022 10:48:16 +0300")

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.

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




  reply	other threads:[~2022-02-06 23:14 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-23 11:11 [bug#53466] [PATCH] home: Add redshift service Ludovic Courtès
2022-01-28 10:34 ` Andrew Tropin
2022-01-28 18:37   ` Ludovic Courtès
2022-01-31 18:22     ` Andrew Tropin
2022-02-01  9:15       ` Ludovic Courtès
2022-02-02  6:59         ` Andrew Tropin
2022-02-02  8:57         ` Andrew Tropin
2022-02-08  9:22           ` Ludovic Courtès
2022-03-13  9:52             ` Andrew Tropin
2022-01-30 15:11   ` [bug#53466] [PATCH v2] " Ludovic Courtès
2022-01-30 17:43     ` Maxime Devos
2022-02-01  8:36       ` Ludovic Courtès
2022-01-31 18:57     ` Andrew Tropin
2022-02-01  8:43       ` Ludovic Courtès
2022-02-02  7:48         ` Andrew Tropin
2022-02-06 23:13           ` Ludovic Courtès [this message]
2022-02-07 15:16             ` [bug#53466] [PATCH] " Andrew Tropin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87bkzjfv1u.fsf_-_@gnu.org \
    --to=ludo@gnu.org \
    --cc=53466-done@debbugs.gnu.org \
    --cc=andrew@trop.in \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.