[Nix-dev] Re: NixOS: New scheme

Nicolas Pierron nicolas.b.pierron at gmail.com
Tue Nov 18 17:55:59 CET 2008


On Tue, Nov 18, 2008 at 16:22, Ludovic Courtès <ludo at gnu.org> wrote:
> Hello!
>
> "Nicolas Pierron"
> <nicolas.b.pierron at gmail.com> writes:
>
>> This mail is a draft about the description of the new writing style.
>
> I'm afraid I didn't get the whole point, partly because "New scheme" or
> "new writing style" is not very descriptive IMO.

True, may be we should call it the "fix style".

>> To support you reading, you can have a look at
>> https://svn.nixos.org/repos/nix/nixos/trunk/upstart-jobs/cron.nix
>>
>> A configuration file is the same as a module.  It starts with the
>> following syntax which declares everything you may need.
>>
>> ------
>> {pkgs, config, ...}:
>> ------
>>
>> - pkgs: Attribute set that contains every package (e.g.: pkgs.cron,
>> pkgs.keen4, ...)
>> - config: Attribute set that contains your computer configuration. (see ??)
>
> I agree that it makes it slightly more simple to write an Upstart jobs.
> However, I think that passing `pkgs' and `config' to every single job is
> too coarse-grain, and it breaks the principle of least authority.  I
> would feel more at ease if Upstart jobs were passed only what they
> really need (which is roughly what the so-called "old scheme" does).

One problem with the "old scheme" is that you need to add extra stuff
everywhere when you want a bit of freedom.  True freedom is not a good
solution as explained in the principle of least authority. [1]  I
think a good solution have some kinds of scopes.  So we have to
distinguish 2 terms "require" and "inherit". (this is just an idea)

- require: only import option definitions and make them useable.
- inherit: import option definitions and make them accessibles to other modules.

Therefore if you are using something you have to declare it first and
with this we would be able to mask low-level options.

> BTW, I'd find it nicer if such experiments were made in a separate
> branch so as to minimize disruption, and especially since I don't think
> there's an overwhelming consensus about it.

I've presented this to Eelco some months ago, but Eelco is not
everybody ... So I will probably create a branch in NixOS to continue
this work.

[1]: http://en.wikipedia.org/wiki/Principle_of_least_privilege

-- 
Nicolas Pierron
http://www.linkedin.com/in/nicolasbpierron
- If you are doing something twice then you should try to do it once.



More information about the nix-dev mailing list