unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: ludo@gnu.org (Ludovic Courtès)
To: 宋文武 <iyzsong@gmail.com>
Cc: guix-devel@gnu.org
Subject: Services and access to the global configuration
Date: Sun, 30 Nov 2014 12:34:12 +0100	[thread overview]
Message-ID: <87mw78sz0r.fsf_-_@gnu.org> (raw)
In-Reply-To: <878uithrsa.fsf@gmail.com> ("宋文武"'s message of "Sun, 30 Nov 2014 19:05:57 +0800")

宋文武 <iyzsong@gmail.com> skribis:

> Ludovic Courtès <ludo@gnu.org> writes:
>
>> 宋文武 <iyzsong@gmail.com> skribis:
>>
>>> Ludovic Courtès <ludo@gnu.org> writes:
>>>
>>>> Adam Pribyl <pribyl@lowlevel.cz> skribis:

[...]

>>> I just put it in my config.scm:
>>>
>>>   (define (console-layout-service layout)
>>>     (with-monad %store-monad
>>>      (return
>>>       (service
>>>        (document "Setup keyboard layout for console")
>>>        (provision '(console-layout))
>>>        (start #~(lambda _
>>>                   (system* (string-append #kbd "/bin/loadkeys") #$layout)))
>>>        (stop #~(const #t))
>>>        (respawn? #f)))))
>>
>> Excellent.  I was thinking that we should have a keyboard layout setting
>> in the OS declaration, that would lead to a service like the one above
>> as well as the appropriate X settings.
> Currently, operating-system is not declarative, with the setting:
>   (operating-system
>     (keymap "dvorak"))
> IIUC, the xorg-server service can't see it unless passed explicitly.

Right.

> In NixOS, declarative configuration is implemented by 'modules':
>   https://nixos.org/wiki/NixOS:Modules
>   
> Every module can define some options, access and contrib to the config,
> the configuration.nix is just a normal module provided by user.
>
> Yeah, how all the modules eval toghether is still a mystery for me.

Yes, that’s the whole point.  I don’t want an ‘mkIf’ here.  ;-)

There are several issues here.

  1. Is it desirable for any service to be able to touch any part of the
     OS configuration, as is the case in NixOS?  I’m not sure.  On one
     hand, it’s useful in situations like the one above; on the other
     hand, it feels like each service definition would get more
     authority than it really needed.

     Currently, the <service> type has fields such as ‘user-accounts’
     and ‘pam-services’ for that reason: a service can add new accounts
     or PAM services, but does not access the global OS config.  These
     would not be needed if services had access to the global config.

  2. Services typically need to be able to add files to the store, etc.
     Currently, that means that services must be monadic values in the
     store monad.

     This is slightly annoying, because indeed it makes it feel “less
     declarative.”

  3. In NixOS there’s no type checking: one can just add fields to the
     global configuration attribute set, and they may be picked up by
     service definitions.

     Here, ‘operating-system’ is a well-defined type, and
     service-specific options are passed as arguments to procedures that
     implement the service.

Just random thoughts.  :-)

I feel there are things we can improve, but it’s not completely clear
how yet.

Thanks,
Ludo’.

  reply	other threads:[~2014-11-30 11:34 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-28 11:41 Few notes to 0.8 Adam Pribyl
2014-11-28 21:31 ` Ludovic Courtès
2014-11-29 11:57   ` 宋文武
2014-11-29 20:45     ` Ludovic Courtès
2014-11-30 11:05       ` 宋文武
2014-11-30 11:34         ` Ludovic Courtès [this message]
2014-11-29 21:06     ` Alex Kost

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

  List information: https://guix.gnu.org/

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

  git send-email \
    --in-reply-to=87mw78sz0r.fsf_-_@gnu.org \
    --to=ludo@gnu.org \
    --cc=guix-devel@gnu.org \
    --cc=iyzsong@gmail.com \
    /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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).