2007-03-04 02:16:24 +01:00
|
|
|
{config, pkgs, nix, modprobe, nssModulesPath}:
|
2006-12-11 16:32:10 +01:00
|
|
|
|
|
|
|
let
|
|
|
|
|
|
|
|
makeJob = import ../upstart-jobs/make-job.nix {
|
|
|
|
inherit (pkgs) runCommand;
|
|
|
|
};
|
|
|
|
|
2006-12-16 19:24:49 +01:00
|
|
|
optional = option: service:
|
2006-12-18 16:16:20 +01:00
|
|
|
if config.get option then [(makeJob service)] else [];
|
2006-12-16 19:24:49 +01:00
|
|
|
|
2007-04-04 19:10:38 +02:00
|
|
|
requiredTTYs =
|
|
|
|
(config.get ["services" "mingetty" "ttys"])
|
|
|
|
++ [10] /* !!! sync with syslog.conf */ ;
|
|
|
|
|
2006-12-11 16:32:10 +01:00
|
|
|
in
|
|
|
|
|
|
|
|
import ../upstart-jobs/gather.nix {
|
|
|
|
inherit (pkgs) runCommand;
|
|
|
|
|
|
|
|
jobs = map makeJob [
|
|
|
|
# Syslogd.
|
|
|
|
(import ../upstart-jobs/syslogd.nix {
|
|
|
|
inherit (pkgs) sysklogd;
|
|
|
|
})
|
|
|
|
|
2006-12-13 13:17:38 +01:00
|
|
|
# The udev daemon creates devices nodes and runs programs when
|
|
|
|
# hardware events occur.
|
|
|
|
(import ../upstart-jobs/udev.nix {
|
2007-03-04 00:20:08 +01:00
|
|
|
inherit (pkgs) stdenv writeText substituteAll udev procps;
|
2007-01-15 10:20:34 +01:00
|
|
|
inherit (pkgs.lib) cleanSource;
|
2007-03-04 00:20:08 +01:00
|
|
|
firmwareDirs =
|
2007-07-22 04:07:02 +02:00
|
|
|
pkgs.lib.optional (config.get ["networking" "enableIntel2200BGFirmware"]) pkgs.ipw2200fw;
|
|
|
|
extraUdevPkgs =
|
|
|
|
pkgs.lib.optional (config.get ["services" "hal" "enable"]) pkgs.hal;
|
2006-12-13 13:17:38 +01:00
|
|
|
})
|
|
|
|
|
2006-12-24 02:07:28 +01:00
|
|
|
# Makes LVM logical volumes available.
|
|
|
|
(import ../upstart-jobs/lvm.nix {
|
2007-03-04 02:16:24 +01:00
|
|
|
inherit modprobe;
|
2007-06-28 11:57:36 +02:00
|
|
|
inherit (pkgs) lvm2 devicemapper;
|
2006-12-24 02:07:28 +01:00
|
|
|
})
|
|
|
|
|
2007-01-11 01:40:28 +01:00
|
|
|
# Activate software RAID arrays.
|
|
|
|
(import ../upstart-jobs/swraid.nix {
|
2007-03-04 02:16:24 +01:00
|
|
|
inherit modprobe;
|
|
|
|
inherit (pkgs) mdadm;
|
2007-01-11 01:40:28 +01:00
|
|
|
})
|
|
|
|
|
2006-12-11 16:32:10 +01:00
|
|
|
# Hardware scan; loads modules for PCI devices.
|
|
|
|
(import ../upstart-jobs/hardware-scan.nix {
|
2007-03-04 02:16:24 +01:00
|
|
|
inherit modprobe;
|
2006-12-23 00:34:42 +01:00
|
|
|
doHardwareScan = config.get ["boot" "hardwareScan"];
|
|
|
|
kernelModules = config.get ["boot" "kernelModules"];
|
2006-12-11 16:32:10 +01:00
|
|
|
})
|
|
|
|
|
2006-12-21 15:22:40 +01:00
|
|
|
# Mount file systems.
|
|
|
|
(import ../upstart-jobs/filesystems.nix {
|
2006-12-21 21:08:15 +01:00
|
|
|
inherit (pkgs) utillinux e2fsprogs;
|
2006-12-21 15:22:40 +01:00
|
|
|
fileSystems = config.get ["fileSystems"];
|
|
|
|
})
|
|
|
|
|
2006-12-21 02:07:23 +01:00
|
|
|
# Swapping.
|
|
|
|
(import ../upstart-jobs/swap.nix {
|
2007-01-10 14:07:57 +01:00
|
|
|
inherit (pkgs) utillinux library;
|
2006-12-21 02:07:23 +01:00
|
|
|
swapDevices = config.get ["swapDevices"];
|
|
|
|
})
|
|
|
|
|
2006-12-11 16:32:10 +01:00
|
|
|
# Network interfaces.
|
|
|
|
(import ../upstart-jobs/network-interfaces.nix {
|
2007-03-04 02:16:24 +01:00
|
|
|
inherit modprobe;
|
2007-05-24 16:50:17 +02:00
|
|
|
inherit (pkgs) nettools wirelesstools bash writeText;
|
2007-02-12 17:00:55 +01:00
|
|
|
nameservers = config.get ["networking" "nameservers"];
|
|
|
|
defaultGateway = config.get ["networking" "defaultGateway"];
|
|
|
|
interfaces = config.get ["networking" "interfaces"];
|
2007-05-24 16:50:17 +02:00
|
|
|
localCommands = config.get ["networking" "localCommands"];
|
2006-12-11 16:32:10 +01:00
|
|
|
})
|
|
|
|
|
|
|
|
# Nix daemon - required for multi-user Nix.
|
|
|
|
(import ../upstart-jobs/nix-daemon.nix {
|
|
|
|
inherit nix;
|
2007-02-22 19:04:18 +01:00
|
|
|
inherit (pkgs) openssl;
|
2006-12-11 16:32:10 +01:00
|
|
|
})
|
|
|
|
|
2007-01-10 18:09:00 +01:00
|
|
|
# Cron daemon.
|
|
|
|
(import ../upstart-jobs/cron.nix {
|
|
|
|
inherit (pkgs) cron;
|
|
|
|
})
|
|
|
|
|
2007-01-12 00:55:25 +01:00
|
|
|
# Name service cache daemon.
|
|
|
|
(import ../upstart-jobs/nscd.nix {
|
2007-06-10 22:13:12 +02:00
|
|
|
inherit (pkgs) glibc;
|
2007-01-15 18:19:41 +01:00
|
|
|
inherit nssModulesPath;
|
2007-01-12 00:55:25 +01:00
|
|
|
})
|
|
|
|
|
2007-04-04 19:10:38 +02:00
|
|
|
# Console font and keyboard maps.
|
|
|
|
(import ../upstart-jobs/kbd.nix {
|
|
|
|
inherit (pkgs) glibc kbd gzip;
|
|
|
|
ttyNumbers = requiredTTYs;
|
|
|
|
defaultLocale = config.get ["i18n" "defaultLocale"];
|
|
|
|
consoleFont = config.get ["i18n" "consoleFont"];
|
|
|
|
consoleKeyMap = config.get ["i18n" "consoleKeyMap"];
|
|
|
|
})
|
|
|
|
|
2006-12-11 16:32:10 +01: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 17:00:55 +01:00
|
|
|
# DHCP client.
|
|
|
|
++ optional ["networking" "useDHCP"]
|
|
|
|
(import ../upstart-jobs/dhclient.nix {
|
2007-02-22 15:26:53 +01:00
|
|
|
inherit (pkgs) nettools dhcp lib;
|
|
|
|
interfaces = config.get ["networking" "interfaces"];
|
2007-02-12 17:00:55 +01:00
|
|
|
})
|
|
|
|
|
2007-08-14 18:43:56 +02:00
|
|
|
# ifplugd daemon for monitoring Ethernet cables.
|
|
|
|
++ optional ["networking" "interfaceMonitor" "enable"]
|
|
|
|
(import ../upstart-jobs/ifplugd.nix {
|
|
|
|
inherit (pkgs) ifplugd writeScript bash;
|
|
|
|
inherit config;
|
|
|
|
})
|
|
|
|
|
2007-03-16 17:41:38 +01:00
|
|
|
# DHCP server.
|
|
|
|
++ optional ["services" "dhcpd" "enable"]
|
|
|
|
(import ../upstart-jobs/dhcpd.nix {
|
|
|
|
inherit (pkgs) dhcp;
|
|
|
|
configFile = config.get ["services" "dhcpd" "configFile"];
|
|
|
|
interfaces = config.get ["services" "dhcpd" "interfaces"];
|
|
|
|
})
|
|
|
|
|
2006-12-16 19:24:49 +01:00
|
|
|
# SSH daemon.
|
|
|
|
++ optional ["services" "sshd" "enable"]
|
|
|
|
(import ../upstart-jobs/sshd.nix {
|
2007-06-10 22:13:12 +02:00
|
|
|
inherit (pkgs) writeText openssh glibc;
|
2007-01-07 11:19:16 +01:00
|
|
|
inherit (pkgs.xorg) xauth;
|
2007-01-15 18:19:41 +01:00
|
|
|
inherit nssModulesPath;
|
2007-01-07 11:19:16 +01:00
|
|
|
forwardX11 = config.get ["services" "sshd" "forwardX11"];
|
2007-01-10 18:19:17 +01:00
|
|
|
allowSFTP = config.get ["services" "sshd" "allowSFTP"];
|
2006-12-16 19:24:49 +01:00
|
|
|
})
|
|
|
|
|
2006-12-22 00:43:17 +01:00
|
|
|
# NTP daemon.
|
|
|
|
++ optional ["services" "ntp" "enable"]
|
|
|
|
(import ../upstart-jobs/ntpd.nix {
|
2007-03-04 02:16:24 +01:00
|
|
|
inherit modprobe;
|
2007-06-10 22:13:12 +02:00
|
|
|
inherit (pkgs) ntp glibc writeText;
|
2006-12-22 00:43:17 +01:00
|
|
|
servers = config.get ["services" "ntp" "servers"];
|
|
|
|
})
|
|
|
|
|
2006-12-16 19:24:49 +01:00
|
|
|
# X server.
|
|
|
|
++ optional ["services" "xserver" "enable"]
|
|
|
|
(import ../upstart-jobs/xserver.nix {
|
2007-02-27 00:11:32 +01:00
|
|
|
inherit config;
|
2007-03-06 01:07:00 +01:00
|
|
|
inherit (pkgs) stdenv writeText lib xterm slim xorg mesa
|
2007-04-02 17:01:09 +02:00
|
|
|
gnome compiz feh kdebase kdelibs xkeyboard_config
|
2007-09-24 11:02:43 +02:00
|
|
|
openssh x11_ssh_askpass nvidiaDrivers synaptics;
|
2007-05-28 17:39:25 +02:00
|
|
|
libX11 = pkgs.xlibs.libX11;
|
|
|
|
libXext = pkgs.xlibs.libXext;
|
2007-09-25 21:00:20 +02:00
|
|
|
fontDirectories = import ../system/fonts.nix {inherit pkgs config;};
|
2007-09-24 07:16:15 +02:00
|
|
|
isClone = config.get ["services" "xserver" "isClone"];
|
2006-12-16 19:24:49 +01:00
|
|
|
})
|
|
|
|
|
2006-12-18 20:20:03 +01:00
|
|
|
# Apache httpd.
|
|
|
|
++ optional ["services" "httpd" "enable"]
|
|
|
|
(import ../upstart-jobs/httpd.nix {
|
2006-12-18 20:46:48 +01:00
|
|
|
inherit config pkgs;
|
2007-06-10 22:13:12 +02:00
|
|
|
inherit (pkgs) glibc;
|
2006-12-18 20:20:03 +01:00
|
|
|
})
|
|
|
|
|
2007-05-28 17:39:25 +02:00
|
|
|
# Samba service.
|
|
|
|
++ optional ["services" "samba" "enable"]
|
|
|
|
(import ../upstart-jobs/samba.nix {
|
|
|
|
inherit pkgs;
|
2007-06-10 22:13:12 +02:00
|
|
|
inherit (pkgs) glibc samba;
|
2007-05-28 17:39:25 +02:00
|
|
|
})
|
|
|
|
|
2007-04-02 19:31:58 +02:00
|
|
|
# CUPS (printing) daemon.
|
|
|
|
++ optional ["services" "printing" "enable"]
|
|
|
|
(import ../upstart-jobs/cupsd.nix {
|
|
|
|
inherit (pkgs) writeText cups;
|
|
|
|
})
|
|
|
|
|
2007-07-09 13:21:04 +02:00
|
|
|
# Gateway6
|
|
|
|
++ optional ["services" "gw6c" "enable"]
|
|
|
|
(import ../upstart-jobs/gw6c.nix {
|
|
|
|
inherit config pkgs;
|
|
|
|
})
|
|
|
|
|
2007-08-08 22:42:25 +02:00
|
|
|
++ optional ["services" "ircdHybrid" "enable"]
|
|
|
|
(import ../upstart-jobs/ircd-hybrid.nix {
|
|
|
|
inherit config pkgs;
|
|
|
|
})
|
|
|
|
|
2007-07-09 13:21:04 +02:00
|
|
|
|
2007-03-01 01:36:00 +01:00
|
|
|
# ALSA sound support.
|
|
|
|
++ optional ["sound" "enable"]
|
|
|
|
(import ../upstart-jobs/alsa.nix {
|
2007-03-04 02:16:24 +01:00
|
|
|
inherit modprobe;
|
|
|
|
inherit (pkgs) alsaUtils;
|
2007-03-01 01:36:00 +01:00
|
|
|
})
|
|
|
|
|
2007-06-08 20:56:55 +02:00
|
|
|
# D-Bus system-wide daemon.
|
|
|
|
++ optional ["services" "dbus" "enable"]
|
|
|
|
(import ../upstart-jobs/dbus.nix {
|
|
|
|
inherit (pkgs) stdenv dbus;
|
2007-06-09 22:05:04 +02:00
|
|
|
dbusServices =
|
2007-07-22 04:07:02 +02:00
|
|
|
pkgs.lib.optional (config.get ["services" "hal" "enable"]) pkgs.hal;
|
2007-06-09 22:05:04 +02:00
|
|
|
})
|
|
|
|
|
|
|
|
# HAL daemon.
|
|
|
|
++ optional ["services" "hal" "enable"]
|
|
|
|
(import ../upstart-jobs/hal.nix {
|
|
|
|
inherit (pkgs) stdenv hal;
|
2007-06-08 20:56:55 +02:00
|
|
|
})
|
|
|
|
|
2006-12-11 16:32:10 +01: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 23:41:41 +01:00
|
|
|
inherit (pkgs) mingetty;
|
|
|
|
inherit ttyNumber;
|
|
|
|
loginProgram = "${pkgs.pam_login}/bin/login";
|
2006-12-11 16:32:10 +01:00
|
|
|
}))
|
2006-12-18 16:41:18 +01:00
|
|
|
(config.get ["services" "mingetty" "ttys"])
|
2006-12-11 16:32:10 +01:00
|
|
|
)
|
|
|
|
|
2007-01-08 23:41:41 +01:00
|
|
|
# Transparent TTY backgrounds.
|
|
|
|
++ optional ["services" "ttyBackgrounds" "enable"]
|
|
|
|
(import ../upstart-jobs/tty-backgrounds.nix {
|
|
|
|
inherit (pkgs) stdenv splashutils;
|
|
|
|
|
|
|
|
backgrounds =
|
|
|
|
|
|
|
|
let
|
|
|
|
|
|
|
|
specificThemes =
|
|
|
|
config.get ["services" "ttyBackgrounds" "defaultSpecificThemes"]
|
|
|
|
++ config.get ["services" "ttyBackgrounds" "specificThemes"];
|
|
|
|
|
|
|
|
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 =
|
|
|
|
pkgs.library.filter (x: !(pkgs.library.elem x overridenTTYs)) requiredTTYs;
|
|
|
|
|
|
|
|
in
|
|
|
|
(map (ttyNumber: {
|
|
|
|
tty = ttyNumber;
|
|
|
|
theme = config.get ["services" "ttyBackgrounds" "defaultTheme"];
|
|
|
|
}) defaultTTYs)
|
|
|
|
++ specificThemes;
|
|
|
|
|
|
|
|
})
|
|
|
|
|
2006-12-18 18:41:46 +01:00
|
|
|
# User-defined events.
|
|
|
|
++ (map makeJob (config.get ["services" "extraJobs"]))
|
|
|
|
|
2006-12-18 20:46:48 +01:00
|
|
|
# For the built-in logd job.
|
2007-06-08 17:41:12 +02:00
|
|
|
++ [(makeJob { jobDrv = pkgs.upstart; })];
|
2006-12-18 20:46:48 +01:00
|
|
|
|
2006-12-11 16:32:10 +01:00
|
|
|
}
|