[Nix-dev] services - upstart jobs

Marc Weber marco-oweber at gmx.de
Tue Nov 13 02:36:53 CET 2007


I had a look at the services upstart-jobs code


  optional = option: service:
    if config.get option then [(makeJob service)] else [];

Why not use something like
  let got =  config.get option; in
    if got then [(makeJob (service got)] else [];

Because it seems natural to me that most services have options anyway so
you don't need to get them again?



Why do I have to specify the path to the upsta-jbs/myservice.nix ?
Why not just use the attribute name to import the file automatically?

I mean if you have services.myjobs you can look for
upstart-jobs/myjob.nix
if you then pass pkgs and the options directly can get rid of
those lines:

  [...]
    # Makes LVM logical volumes available. 
    (import ../upstart-jobs/lvm.nix {
      inherit modprobe;
      inherit (pkgs) lvm2 devicemapper;
    }) ++
  [...]

they seem to be just boilerplate ?

So the lvm.nix would become
  options : pkgs : let modprobe =  pkgs.modprobe; in  {
  [...]
or even
  options : pkgs : with pkgs; {
  [...]

instead of
  {modprobe, lvm2, devicemapper}:
  { 
  [ .... ]


Marc



More information about the nix-dev mailing list