So with the kind help of this list and on IRC, a private instance of ejabberd can compile over our hydra. Now I need to get these options into the same build as per https://github.com/NixOS/nixpkgs/blob/master/nixos/modules/services/networking/ejabberd.nix
Questions: * Would it be better to override ejabberd? * Or just add the below package with options to nixpkgs via function arguments available in nixpkgs? Goal: create a series of testing servers which run NixOS and their nix-channels are subscribed to our hydra instance. A container will pull down a developers testing branch of ejabberd, compile then (maybe using nixops) deploy it to a container. Android and iOS apps will automatically be built configured to point to each container instances of ejabberd. In the configuration.nix file of each testing container chaatz-ejabberd will be configured, much as one would configure ejabberd via configuration.nix. I greatly appreciate your advice. High level advice would be greatly appreciated. This is what I've got so far (with the RPM buird removed for succinctness reasons). It compiles but as I'm sure some of you would see the options don't work. release.nix let pkgs = import <nixpkgs> {}; cfg = pkgs.config.services.chaatz-ejabberd; options = { services.chaatz-ejabberd = { enable = pkgs.lib.mkOption { default = false; description = "Whether to enable ejabberd server"; }; spoolDir = pkgs.lib.mkOption { default = "/var/lib/ejabberd"; description = "Location of the spooldir of ejabberd"; }; logsDir = pkgs.lib.mkOption { default = "/var/log/ejabberd"; description = "Location of the logfile directory of ejabberd"; }; confDir = pkgs.lib.mkOption { default = "/var/ejabberd"; description = "Location of the config directory of ejabberd"; }; virtualHosts = pkgs.lib.mkOption { default = "\"localhost\""; description = "Virtualhosts that ejabberd should host. Hostnames are surrounded with doublequotes and separated by commas"; }; loadDumps = pkgs.lib.mkOption { default = []; description = "Configuration dump that should be loaded on the first startup"; example = pkgs.literalExample "[ ./myejabberd.dump ]"; }; }; }; jobs = rec { config = pkgs.lib.mkIf cfg.enable { environment.systemPackages = [ pkgs.chaatz-ejabberd ]; jobs.chaatz-ejabberd = { description = "Chaatz ejabberd server"; startOn = "started network-interfaces"; stopOn = "stopping network-interfaces"; environment = { PATH = "$PATH:${pkgs.chaatz-ejabberd}/sbin:${pkgs.chaatz-ejabberd}/bin:${pkgs.coreutils}/bin:${pkgs.bash}/bin:${pkgs.gnused}/bin"; }; preStart = '' PATH="$PATH:${pkgs.chaatz-ejabberd}/sbin:${pkgs.chaatz-ejabberd}/bin:${pkgs.coreutils}/bin:${pkgs.bash}/bin:${pkgs.gnused}/bin"; # Initialise state data mkdir -p ${cfg.logsDir} if ! test -d ${cfg.spoolDir} then initialize=1 cp -av ${pkgs.chaatz-ejabberd}/var/lib/ejabberd /var/lib fi if ! test -d ${cfg.confDir} then mkdir -p ${cfg.confDir} cp ${pkgs.chaatz-ejabberd}/etc/ejabberd/* ${cfg.confDir} sed -e 's|{hosts, \["localhost"\]}.|{hosts, \[${cfg.virtualHosts}\]}.|' ${pkgs.chaatz-ejabberd}/etc/ejabberd/ejabberd.cfg > ${cfg.confDir}/ejabberd.cfg fi ejabberdctl --config-dir ${cfg.confDir} --logs ${cfg.logsDir} --spool ${cfg.spoolDir} start ${if cfg.loadDumps == [] then "" else '' if [ "$initialize" = "1" ] then # Wait until the ejabberd server is available for use count=0 while ! ejabberdctl --config-dir ${cfg.confDir} --logs ${cfg.logsDir} --spool ${cfg.spoolDir} status do if [ $count -eq 30 ] then echo "Tried 30 times, giving up..." exit 1 fi echo "Ejabberd daemon not yet started. Waiting for 1 second..." count=$((count++)) sleep 1 done ${pkgs.concatMapStrings (dump: '' echo "Importing dump: ${dump}" if [ -f ${dump} ] then ejabberdctl --config-dir ${cfg.confDir} --logs ${cfg.logsDir} --spool ${cfg.spoolDir} load ${dump} elif [ -d ${dump} ] then for i in ${dump}/ejabberd-dump/* do ejabberdctl --config-dir ${cfg.confDir} --logs ${cfg.logsDir} --spool ${cfg.spoolDir} load $i done fi '') cfg.loadDumps} fi ''} ''; postStop = '' ejabberdctl --config-dir ${cfg.confDir} --logs ${cfg.logsDir} --spool ${cfg.spoolDir} stop ''; }; security.pam.services.chaatz-ejabberd = {}; }; chaatz-ejabberd = pkgs.stdenv.mkDerivation rec { name = "chaatz-ejabberd"; src = <chaatz-ejabberd>; buildInputs = ( with pkgs; [ expat erlang zlib openssl pam automake autoconf git libyaml openssh libcouchbase ]); preConfigure = "./autogen.sh"; }; }; in jobs _______________________________________________ nix-dev mailing list nix-dev@lists.science.uu.nl http://lists.science.uu.nl/mailman/listinfo/nix-dev