[Nix-dev] New easy to use service Plug & Play like API

Marc Weber marco-oweber at gmx.de
Sat Mar 15 14:12:06 CET 2008


Hi.

I've finshed my proposal. it should integrate within the existing system
so you can choose which one to use.

The only thing which is left to be done is option checking but the
implementation is already there.

Example given here:
http://rafb.net/p/g0oRw476.html

note the attr set args at line 21 which is passed to the job function
below

configV is a special function.
It either takes the default or the user supplied option. If you specify
an apply function it will be applied if the user has set the option.

  address = mkOption {
      default = "";
      description = "listen for clients on the given address";
      apply = x: "-a '${x}'";
    };

So that's all you have to type to get options:
  exec ${pkgs.synergy}/bin/synergys -c /etc/${name}.conf -f ${configV "address"} ${configV "screenName"}

Do you like it?

Note also the function autoGeneratedEtcFile.

May I commit it - any questions / suggestions ?
Marc W



More information about the nix-dev mailing list