[Nix-dev] Services/ Upstart Jobs etc - new Design?

Marc Weber marco-oweber at gmx.de
Tue Nov 20 16:42:03 CET 2007


Current:
  To create a new upstart-job (such as mysqld/ httpd) you have to change
  upstart-jobs/default.nix
    and write
  upstart-jobs/yourjob.nix


  example:
    # DHCP client.
    ++ optional ["networking" "useDHCP"]
      (import ../upstart-jobs/dhclient.nix {
        inherit (pkgs) nettools dhcp lib;
        interfaces = config.get ["networking" "interfaces"];
      })
  
my proposal:
  Goal: make a service behave more like plugins
  interface-design:
    cfg : pkgs : [(your job) (your job)]

  Benefits: Don't have to modify upstart-jobs/default.nix
  Thus if you want to run a second mysqld instances just copy the .nix file
  and add configuration settings to you nixos/configuration.nix file

  You can find a semi tested draft implementation here:
  http://rafb.net/p/bDRWJe46.html

  drawbacks:
    Doesn't solve all issues

What we really need:
  Think of running two mysqld instances and apache and phpMyAdmin
  (DB-Web Interface)

  So we want to add the web application phpMyAdmin to httpd and telling
  phpMyAdmin which port to use !

  How should the configuration look like?

  let mysql_conf = { port = xxx; }; in
  
  { services = {
        mysql = mysql_conf;
        httpd = {
            apps = { phpMyAdmin { mysql = mysql_conf, url_path = "/phpMyAdmin"}
        }
  }

  would be pretty simple and phpMyAdmin knows wether myslqd has been
  enabled and which port to use

additional: < niksnut> btw, maybe the services tree should be merged with the nixos tree
I agree. Then the svn repository would look the same way /etc/nixos.
does.

Marc W.



More information about the nix-dev mailing list