2007-11-15 09:16:16 -08:00
|
|
|
{config, pkgs, nix, modprobe, nssModulesPath, nixEnvVars}:
|
2006-12-11 07:32:10 -08:00
|
|
|
|
|
|
|
let
|
|
|
|
|
|
|
|
makeJob = import ../upstart-jobs/make-job.nix {
|
|
|
|
inherit (pkgs) runCommand;
|
|
|
|
};
|
|
|
|
|
2007-11-09 10:49:45 -08:00
|
|
|
optional = cond: service: pkgs.lib.optional cond (makeJob service);
|
2006-12-16 10:24:49 -08:00
|
|
|
|
2007-04-04 10:10:38 -07:00
|
|
|
requiredTTYs =
|
2008-01-04 08:11:12 -08:00
|
|
|
config.services.mingetty.ttys
|
|
|
|
++ config.boot.extraTTYs
|
|
|
|
++ [config.services.syslogd.tty];
|
2007-04-04 10:10:38 -07:00
|
|
|
|
2007-11-23 02:56:12 -08:00
|
|
|
|
2006-12-11 07:32:10 -08:00
|
|
|
jobs = map makeJob [
|
|
|
|
# Syslogd.
|
|
|
|
(import ../upstart-jobs/syslogd.nix {
|
|
|
|
inherit (pkgs) sysklogd;
|
|
|
|
})
|
|
|
|
|
2006-12-13 04:17:38 -08:00
|
|
|
# The udev daemon creates devices nodes and runs programs when
|
|
|
|
# hardware events occur.
|
|
|
|
(import ../upstart-jobs/udev.nix {
|
2007-03-03 15:20:08 -08:00
|
|
|
inherit (pkgs) stdenv writeText substituteAll udev procps;
|
2007-01-15 01:20:34 -08:00
|
|
|
inherit (pkgs.lib) cleanSource;
|
2007-03-03 15:20:08 -08:00
|
|
|
firmwareDirs =
|
2008-01-12 14:53:13 -08:00
|
|
|
pkgs.lib.optional config.networking.enableIntel2200BGFirmware pkgs.ipw2200fw
|
|
|
|
++ pkgs.lib.optional config.networking.enableIntel3945ABGFirmware pkgs.iwlwifi3945ucode
|
|
|
|
++ config.services.udev.addFirmware;
|
2007-07-21 19:07:02 -07:00
|
|
|
extraUdevPkgs =
|
2008-02-04 02:52:58 -08:00
|
|
|
pkgs.lib.optional config.services.hal.enable pkgs.hal
|
|
|
|
++ pkgs.lib.optional config.hardware.enableGo7007 pkgs.wis_go7007;
|
2008-01-12 14:53:13 -08:00
|
|
|
sndMode = config.services.udev.sndMode;
|
2006-12-13 04:17:38 -08:00
|
|
|
})
|
|
|
|
|
2006-12-23 17:07:28 -08:00
|
|
|
# Makes LVM logical volumes available.
|
|
|
|
(import ../upstart-jobs/lvm.nix {
|
2007-03-03 17:16:24 -08:00
|
|
|
inherit modprobe;
|
2007-06-28 02:57:36 -07:00
|
|
|
inherit (pkgs) lvm2 devicemapper;
|
2006-12-23 17:07:28 -08:00
|
|
|
})
|
|
|
|
|
2007-01-10 16:40:28 -08:00
|
|
|
# Activate software RAID arrays.
|
|
|
|
(import ../upstart-jobs/swraid.nix {
|
2007-03-03 17:16:24 -08:00
|
|
|
inherit modprobe;
|
|
|
|
inherit (pkgs) mdadm;
|
2007-01-10 16:40:28 -08:00
|
|
|
})
|
|
|
|
|
2006-12-11 07:32:10 -08:00
|
|
|
# Hardware scan; loads modules for PCI devices.
|
|
|
|
(import ../upstart-jobs/hardware-scan.nix {
|
2007-03-03 17:16:24 -08:00
|
|
|
inherit modprobe;
|
2007-11-09 10:49:45 -08:00
|
|
|
doHardwareScan = config.boot.hardwareScan;
|
|
|
|
kernelModules = config.boot.kernelModules;
|
2006-12-11 07:32:10 -08:00
|
|
|
})
|
|
|
|
|
2006-12-21 06:22:40 -08:00
|
|
|
# Mount file systems.
|
|
|
|
(import ../upstart-jobs/filesystems.nix {
|
2006-12-21 12:08:15 -08:00
|
|
|
inherit (pkgs) utillinux e2fsprogs;
|
2007-11-09 10:49:45 -08:00
|
|
|
fileSystems = config.fileSystems;
|
2006-12-21 06:22:40 -08:00
|
|
|
})
|
|
|
|
|
2006-12-20 17:07:23 -08:00
|
|
|
# Swapping.
|
|
|
|
(import ../upstart-jobs/swap.nix {
|
2008-02-11 03:51:51 -08:00
|
|
|
inherit (pkgs) utillinux lib;
|
2007-11-09 10:49:45 -08:00
|
|
|
swapDevices = config.swapDevices;
|
2006-12-20 17:07:23 -08:00
|
|
|
})
|
|
|
|
|
2006-12-11 07:32:10 -08:00
|
|
|
# Network interfaces.
|
|
|
|
(import ../upstart-jobs/network-interfaces.nix {
|
2007-11-23 09:12:37 -08:00
|
|
|
inherit modprobe config;
|
2007-05-24 07:50:17 -07:00
|
|
|
inherit (pkgs) nettools wirelesstools bash writeText;
|
2006-12-11 07:32:10 -08:00
|
|
|
})
|
|
|
|
|
|
|
|
# Nix daemon - required for multi-user Nix.
|
|
|
|
(import ../upstart-jobs/nix-daemon.nix {
|
2007-11-15 09:16:16 -08:00
|
|
|
inherit config pkgs nix nixEnvVars;
|
2006-12-11 07:32:10 -08:00
|
|
|
})
|
|
|
|
|
2007-01-10 09:09:00 -08:00
|
|
|
# Cron daemon.
|
|
|
|
(import ../upstart-jobs/cron.nix {
|
2008-02-01 04:01:27 -08:00
|
|
|
inherit config pkgs;
|
2007-01-10 09:09:00 -08:00
|
|
|
})
|
|
|
|
|
2007-01-11 15:55:25 -08:00
|
|
|
# Name service cache daemon.
|
|
|
|
(import ../upstart-jobs/nscd.nix {
|
2007-06-10 13:13:12 -07:00
|
|
|
inherit (pkgs) glibc;
|
2007-01-15 09:19:41 -08:00
|
|
|
inherit nssModulesPath;
|
2007-01-11 15:55:25 -08:00
|
|
|
})
|
|
|
|
|
2007-04-04 10:10:38 -07:00
|
|
|
# Console font and keyboard maps.
|
|
|
|
(import ../upstart-jobs/kbd.nix {
|
|
|
|
inherit (pkgs) glibc kbd gzip;
|
|
|
|
ttyNumbers = requiredTTYs;
|
2007-11-09 10:49:45 -08:00
|
|
|
defaultLocale = config.i18n.defaultLocale;
|
|
|
|
consoleFont = config.i18n.consoleFont;
|
|
|
|
consoleKeyMap = config.i18n.consoleKeyMap;
|
2007-04-04 10:10:38 -07:00
|
|
|
})
|
|
|
|
|
2006-12-11 07:32:10 -08:00
|
|
|
# Handles the maintenance/stalled event (single-user shell).
|
|
|
|
(import ../upstart-jobs/maintenance-shell.nix {
|
|
|
|
inherit (pkgs) bash;
|
|
|
|
})
|
|
|
|
|
|
|
|
# Ctrl-alt-delete action.
|
|
|
|
(import ../upstart-jobs/ctrl-alt-delete.nix)
|
|
|
|
|
|
|
|
]
|
|
|
|
|
2007-02-12 08:00:55 -08:00
|
|
|
# DHCP client.
|
2007-11-09 10:49:45 -08:00
|
|
|
++ optional config.networking.useDHCP
|
2007-02-12 08:00:55 -08:00
|
|
|
(import ../upstart-jobs/dhclient.nix {
|
2007-02-22 06:26:53 -08:00
|
|
|
inherit (pkgs) nettools dhcp lib;
|
2007-11-09 10:49:45 -08:00
|
|
|
interfaces = config.networking.interfaces;
|
2007-02-12 08:00:55 -08:00
|
|
|
})
|
|
|
|
|
2007-08-14 09:43:56 -07:00
|
|
|
# ifplugd daemon for monitoring Ethernet cables.
|
2007-11-09 10:49:45 -08:00
|
|
|
++ optional config.networking.interfaceMonitor.enable
|
2007-08-14 09:43:56 -07:00
|
|
|
(import ../upstart-jobs/ifplugd.nix {
|
|
|
|
inherit (pkgs) ifplugd writeScript bash;
|
|
|
|
inherit config;
|
|
|
|
})
|
|
|
|
|
2007-03-16 09:41:38 -07:00
|
|
|
# DHCP server.
|
2007-11-09 10:49:45 -08:00
|
|
|
++ optional config.services.dhcpd.enable
|
2007-03-16 09:41:38 -07:00
|
|
|
(import ../upstart-jobs/dhcpd.nix {
|
2007-12-04 06:53:37 -08:00
|
|
|
inherit pkgs config;
|
2007-03-16 09:41:38 -07:00
|
|
|
})
|
|
|
|
|
2006-12-16 10:24:49 -08:00
|
|
|
# SSH daemon.
|
2007-11-09 10:49:45 -08:00
|
|
|
++ optional config.services.sshd.enable
|
2006-12-16 10:24:49 -08:00
|
|
|
(import ../upstart-jobs/sshd.nix {
|
2007-06-10 13:13:12 -07:00
|
|
|
inherit (pkgs) writeText openssh glibc;
|
2007-01-07 02:19:16 -08:00
|
|
|
inherit (pkgs.xorg) xauth;
|
2007-01-15 09:19:41 -08:00
|
|
|
inherit nssModulesPath;
|
2007-11-09 10:49:45 -08:00
|
|
|
forwardX11 = config.services.sshd.forwardX11;
|
|
|
|
allowSFTP = config.services.sshd.allowSFTP;
|
2006-12-16 10:24:49 -08:00
|
|
|
})
|
|
|
|
|
2006-12-21 15:43:17 -08:00
|
|
|
# NTP daemon.
|
2007-11-09 10:49:45 -08:00
|
|
|
++ optional config.services.ntp.enable
|
2006-12-21 15:43:17 -08:00
|
|
|
(import ../upstart-jobs/ntpd.nix {
|
2007-03-03 17:16:24 -08:00
|
|
|
inherit modprobe;
|
2007-06-10 13:13:12 -07:00
|
|
|
inherit (pkgs) ntp glibc writeText;
|
2007-11-09 10:49:45 -08:00
|
|
|
servers = config.services.ntp.servers;
|
2006-12-21 15:43:17 -08:00
|
|
|
})
|
|
|
|
|
2006-12-16 10:24:49 -08:00
|
|
|
# X server.
|
2007-11-09 10:49:45 -08:00
|
|
|
++ optional config.services.xserver.enable
|
2006-12-16 10:24:49 -08:00
|
|
|
(import ../upstart-jobs/xserver.nix {
|
2008-01-04 02:54:33 -08:00
|
|
|
inherit config pkgs;
|
2007-09-25 12:00:20 -07:00
|
|
|
fontDirectories = import ../system/fonts.nix {inherit pkgs config;};
|
2006-12-16 10:24:49 -08:00
|
|
|
})
|
|
|
|
|
2006-12-18 11:20:03 -08:00
|
|
|
# Apache httpd.
|
2008-02-04 02:52:58 -08:00
|
|
|
++ optional (config.services.httpd.enable && !config.services.httpd.experimental)
|
2006-12-18 11:20:03 -08:00
|
|
|
(import ../upstart-jobs/httpd.nix {
|
2006-12-18 11:46:48 -08:00
|
|
|
inherit config pkgs;
|
2007-06-10 13:13:12 -07:00
|
|
|
inherit (pkgs) glibc;
|
2007-11-23 02:56:12 -08:00
|
|
|
extraConfig = pkgs.lib.concatStringsSep "\n"
|
|
|
|
(map (job: job.extraHttpdConfig) jobs);
|
2006-12-18 11:20:03 -08:00
|
|
|
})
|
|
|
|
|
2008-01-04 02:36:14 -08:00
|
|
|
# Apache httpd (new style).
|
2008-02-04 02:52:58 -08:00
|
|
|
++ optional (config.services.httpd.enable && config.services.httpd.experimental)
|
2008-01-04 02:36:14 -08:00
|
|
|
(import ../upstart-jobs/apache-httpd {
|
|
|
|
inherit config pkgs;
|
|
|
|
})
|
|
|
|
|
2008-01-28 06:30:18 -08:00
|
|
|
# MySQL server
|
|
|
|
++ optional config.services.mysql.enable
|
|
|
|
(import ../upstart-jobs/mysql.nix {
|
|
|
|
inherit config pkgs;
|
|
|
|
})
|
|
|
|
|
2007-12-02 20:48:31 -08:00
|
|
|
# Postgres SQL server
|
|
|
|
++ optional config.services.postgresql.enable
|
|
|
|
(import ../upstart-jobs/postgresql.nix {
|
|
|
|
inherit config pkgs;
|
|
|
|
startDependency = if config.services.gw6c.enable then
|
|
|
|
"gw6c" else "network-interfaces";
|
|
|
|
})
|
|
|
|
|
2008-02-04 05:40:01 -08:00
|
|
|
# EJabberd service
|
|
|
|
++ optional config.services.ejabberd.enable
|
|
|
|
(import ../upstart-jobs/ejabberd.nix {
|
|
|
|
inherit config pkgs;
|
|
|
|
})
|
|
|
|
|
2008-01-28 07:16:14 -08:00
|
|
|
# JBoss service
|
|
|
|
++ optional config.services.jboss.enable
|
|
|
|
(import ../upstart-jobs/jboss.nix {
|
|
|
|
inherit config pkgs;
|
|
|
|
})
|
|
|
|
|
2008-01-30 03:00:00 -08:00
|
|
|
# Apache Tomcat service
|
|
|
|
++ optional config.services.tomcat.enable
|
|
|
|
(import ../upstart-jobs/tomcat.nix {
|
|
|
|
inherit config pkgs;
|
|
|
|
})
|
|
|
|
|
2007-05-28 08:39:25 -07:00
|
|
|
# Samba service.
|
2007-11-09 10:49:45 -08:00
|
|
|
++ optional config.services.samba.enable
|
2007-05-28 08:39:25 -07:00
|
|
|
(import ../upstart-jobs/samba.nix {
|
|
|
|
inherit pkgs;
|
2007-06-10 13:13:12 -07:00
|
|
|
inherit (pkgs) glibc samba;
|
2007-05-28 08:39:25 -07:00
|
|
|
})
|
|
|
|
|
2007-04-02 10:31:58 -07:00
|
|
|
# CUPS (printing) daemon.
|
2007-11-09 10:49:45 -08:00
|
|
|
++ optional config.services.printing.enable
|
2007-04-02 10:31:58 -07:00
|
|
|
(import ../upstart-jobs/cupsd.nix {
|
|
|
|
inherit (pkgs) writeText cups;
|
|
|
|
})
|
|
|
|
|
2007-07-09 04:21:04 -07:00
|
|
|
# Gateway6
|
2007-11-09 10:49:45 -08:00
|
|
|
++ optional config.services.gw6c.enable
|
2007-07-09 04:21:04 -07:00
|
|
|
(import ../upstart-jobs/gw6c.nix {
|
|
|
|
inherit config pkgs;
|
|
|
|
})
|
|
|
|
|
2008-02-07 04:41:18 -08:00
|
|
|
# VSFTPd server
|
|
|
|
++ optional config.services.vsftpd.enable
|
|
|
|
(import ../upstart-jobs/vsftpd.nix {
|
|
|
|
inherit (pkgs) vsftpd;
|
2008-02-07 05:37:20 -08:00
|
|
|
inherit (config.services.vsftpd) anonymousUser;
|
2008-02-07 04:41:18 -08:00
|
|
|
})
|
|
|
|
|
2007-11-05 00:54:30 -08:00
|
|
|
# X Font Server
|
2007-11-09 10:49:45 -08:00
|
|
|
++ optional config.services.xfs.enable
|
2008-01-04 02:54:33 -08:00
|
|
|
(import ../upstart-jobs/xfs.nix {
|
|
|
|
inherit config pkgs;
|
|
|
|
})
|
2007-11-05 00:54:30 -08:00
|
|
|
|
2007-11-09 10:49:45 -08:00
|
|
|
++ optional config.services.ircdHybrid.enable
|
2007-08-08 13:42:25 -07:00
|
|
|
(import ../upstart-jobs/ircd-hybrid.nix {
|
|
|
|
inherit config pkgs;
|
|
|
|
})
|
|
|
|
|
2007-02-28 16:36:00 -08:00
|
|
|
# ALSA sound support.
|
2007-11-09 10:49:45 -08:00
|
|
|
++ optional config.sound.enable
|
2007-02-28 16:36:00 -08:00
|
|
|
(import ../upstart-jobs/alsa.nix {
|
2007-03-03 17:16:24 -08:00
|
|
|
inherit modprobe;
|
|
|
|
inherit (pkgs) alsaUtils;
|
2007-02-28 16:36:00 -08:00
|
|
|
})
|
|
|
|
|
2007-06-08 11:56:55 -07:00
|
|
|
# D-Bus system-wide daemon.
|
2007-11-09 10:49:45 -08:00
|
|
|
++ optional config.services.dbus.enable
|
2007-06-08 11:56:55 -07:00
|
|
|
(import ../upstart-jobs/dbus.nix {
|
|
|
|
inherit (pkgs) stdenv dbus;
|
2007-06-09 13:05:04 -07:00
|
|
|
dbusServices =
|
2007-11-09 10:49:45 -08:00
|
|
|
pkgs.lib.optional (config.services.hal.enable) pkgs.hal;
|
2007-06-09 13:05:04 -07:00
|
|
|
})
|
|
|
|
|
|
|
|
# HAL daemon.
|
2007-11-09 10:49:45 -08:00
|
|
|
++ optional config.services.hal.enable
|
2007-06-09 13:05:04 -07:00
|
|
|
(import ../upstart-jobs/hal.nix {
|
|
|
|
inherit (pkgs) stdenv hal;
|
2007-06-08 11:56:55 -07:00
|
|
|
})
|
|
|
|
|
2007-11-12 08:43:35 -08:00
|
|
|
# Nagios system/network monitoring daemon.
|
|
|
|
++ optional config.services.nagios.enable
|
|
|
|
(import ../upstart-jobs/nagios {
|
|
|
|
inherit config pkgs;
|
|
|
|
})
|
|
|
|
|
2006-12-11 07:32:10 -08:00
|
|
|
# Handles the reboot/halt events.
|
|
|
|
++ (map
|
|
|
|
(event: makeJob (import ../upstart-jobs/halt.nix {
|
|
|
|
inherit (pkgs) bash utillinux;
|
|
|
|
inherit event;
|
|
|
|
}))
|
|
|
|
["reboot" "halt" "system-halt" "power-off"]
|
|
|
|
)
|
|
|
|
|
|
|
|
# The terminals on ttyX.
|
|
|
|
++ (map
|
|
|
|
(ttyNumber: makeJob (import ../upstart-jobs/mingetty.nix {
|
2007-01-08 14:41:41 -08:00
|
|
|
inherit (pkgs) mingetty;
|
|
|
|
inherit ttyNumber;
|
|
|
|
loginProgram = "${pkgs.pam_login}/bin/login";
|
2006-12-11 07:32:10 -08:00
|
|
|
}))
|
2007-11-09 10:49:45 -08:00
|
|
|
(config.services.mingetty.ttys)
|
2006-12-11 07:32:10 -08:00
|
|
|
)
|
|
|
|
|
2007-01-08 14:41:41 -08:00
|
|
|
# Transparent TTY backgrounds.
|
2007-11-09 10:49:45 -08:00
|
|
|
++ optional config.services.ttyBackgrounds.enable
|
2007-01-08 14:41:41 -08:00
|
|
|
(import ../upstart-jobs/tty-backgrounds.nix {
|
|
|
|
inherit (pkgs) stdenv splashutils;
|
|
|
|
|
|
|
|
backgrounds =
|
|
|
|
|
|
|
|
let
|
|
|
|
|
|
|
|
specificThemes =
|
2007-11-09 10:49:45 -08:00
|
|
|
config.services.ttyBackgrounds.defaultSpecificThemes
|
|
|
|
++ config.services.ttyBackgrounds.specificThemes;
|
2007-01-08 14:41:41 -08:00
|
|
|
|
|
|
|
overridenTTYs = map (x: x.tty) specificThemes;
|
|
|
|
|
|
|
|
# Use the default theme for all the mingetty ttys and for the
|
|
|
|
# syslog tty, except those for which a specific theme is
|
|
|
|
# specified.
|
|
|
|
defaultTTYs =
|
2008-02-11 03:51:51 -08:00
|
|
|
pkgs.lib.filter (x: !(pkgs.lib.elem x overridenTTYs)) requiredTTYs;
|
2007-01-08 14:41:41 -08:00
|
|
|
|
|
|
|
in
|
|
|
|
(map (ttyNumber: {
|
|
|
|
tty = ttyNumber;
|
2007-11-09 10:49:45 -08:00
|
|
|
theme = config.services.ttyBackgrounds.defaultTheme;
|
2007-01-08 14:41:41 -08:00
|
|
|
}) defaultTTYs)
|
|
|
|
++ specificThemes;
|
|
|
|
|
|
|
|
})
|
|
|
|
|
2006-12-18 09:41:46 -08:00
|
|
|
# User-defined events.
|
2007-11-09 10:49:45 -08:00
|
|
|
++ (map makeJob (config.services.extraJobs))
|
2006-12-18 09:41:46 -08:00
|
|
|
|
2006-12-18 11:46:48 -08:00
|
|
|
# For the built-in logd job.
|
2007-06-08 08:41:12 -07:00
|
|
|
++ [(makeJob { jobDrv = pkgs.upstart; })];
|
2007-11-23 02:56:12 -08:00
|
|
|
|
2006-12-18 11:46:48 -08:00
|
|
|
|
2007-11-23 02:56:12 -08:00
|
|
|
in import ../upstart-jobs/gather.nix {
|
|
|
|
inherit (pkgs) runCommand;
|
|
|
|
inherit jobs;
|
2006-12-11 07:32:10 -08:00
|
|
|
}
|