3
0
Fork 0
forked from mirrors/nixpkgs
nixpkgs/upstart-jobs/make-job.nix
Eelco Dolstra ed1029092b * Udev jobs can now declare a passthru attribute which is
useful for testing the building of specific parts of
  a service, e.g. you can do
  
    $ nix-build /etc/nixos/nixos/ -A upstartJobs.udev.passthru.udevRules

  to build the udev rules directory of the udev service.

svn path=/nixos/trunk/; revision=12243
2008-07-02 18:02:24 +00:00

39 lines
1.1 KiB
Nix

{runCommand}: job:
(
if job ? jobDrv then
job.jobDrv
else
(
runCommand ("upstart-" + job.name)
{ inherit (job) job;
jobName = job.name;
buildHook = if job ? buildHook then job.buildHook else "true";
}
"eval \"$buildHook\"; ensureDir $out/etc/event.d; echo \"$job\" > $out/etc/event.d/$jobName"
)
)
//
{
# Allow jobs to declare extra packages that should be added to the
# system path.
extraPath = if job ? extraPath then job.extraPath else [];
# Allow jobs to declare extra files that should be added to /etc.
extraEtc = if job ? extraEtc then job.extraEtc else [];
# Allow jobs to declare extra configuration for Apache (e.g. Nagios
# declaring its web interface).
extraHttpdConfig = if job ? extraHttpdConfig then job.extraHttpdConfig else "";
# Allow jobs to declare user accounts that should be created.
users = if job ? users then job.users else [];
# Allow jobs to declare groups that should be created.
groups = if job ? groups then job.groups else [];
passthru = if job ? passthru then job.passthru else {};
}