2007-03-03 17:16:24 -08:00
|
|
|
{config, pkgs, nix, modprobe, nssModulesPath}:
|
2006-12-11 07:32:10 -08:00
|
|
|
|
|
|
|
let
|
|
|
|
|
|
|
|
makeJob = import ../upstart-jobs/make-job.nix {
|
|
|
|
inherit (pkgs) runCommand;
|
|
|
|
};
|
|
|
|
|
2006-12-16 10:24:49 -08:00
|
|
|
optional = option: service:
|
2006-12-18 07:16:20 -08:00
|
|
|
if config.get option then [(makeJob service)] else [];
|
2006-12-16 10:24:49 -08:00
|
|
|
|
2006-12-11 07:32:10 -08: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 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 =
|
|
|
|
(if config.get ["networking" "enableIntel2200BGFirmware"] then [pkgs.ipw2200fw] else []);
|
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;
|
|
|
|
inherit (pkgs) lvm2;
|
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;
|
2006-12-22 15:34:42 -08:00
|
|
|
doHardwareScan = config.get ["boot" "hardwareScan"];
|
|
|
|
kernelModules = config.get ["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;
|
2006-12-21 06:22:40 -08:00
|
|
|
fileSystems = config.get ["fileSystems"];
|
|
|
|
})
|
|
|
|
|
2006-12-20 17:07:23 -08:00
|
|
|
# Swapping.
|
|
|
|
(import ../upstart-jobs/swap.nix {
|
2007-01-10 05:07:57 -08:00
|
|
|
inherit (pkgs) utillinux library;
|
2006-12-20 17:07:23 -08:00
|
|
|
swapDevices = config.get ["swapDevices"];
|
|
|
|
})
|
|
|
|
|
2006-12-11 07:32:10 -08:00
|
|
|
# Network interfaces.
|
|
|
|
(import ../upstart-jobs/network-interfaces.nix {
|
2007-03-03 17:16:24 -08:00
|
|
|
inherit modprobe;
|
|
|
|
inherit (pkgs) nettools wirelesstools;
|
2007-02-12 08:00:55 -08:00
|
|
|
nameservers = config.get ["networking" "nameservers"];
|
|
|
|
defaultGateway = config.get ["networking" "defaultGateway"];
|
|
|
|
interfaces = config.get ["networking" "interfaces"];
|
2006-12-11 07:32:10 -08:00
|
|
|
})
|
|
|
|
|
|
|
|
# Nix daemon - required for multi-user Nix.
|
|
|
|
(import ../upstart-jobs/nix-daemon.nix {
|
|
|
|
inherit nix;
|
2007-02-22 10:04:18 -08:00
|
|
|
inherit (pkgs) openssl;
|
2006-12-11 07:32:10 -08:00
|
|
|
})
|
|
|
|
|
2007-01-10 09:09:00 -08:00
|
|
|
# Cron daemon.
|
|
|
|
(import ../upstart-jobs/cron.nix {
|
|
|
|
inherit (pkgs) cron;
|
|
|
|
})
|
|
|
|
|
2007-01-11 15:55:25 -08:00
|
|
|
# Name service cache daemon.
|
|
|
|
(import ../upstart-jobs/nscd.nix {
|
|
|
|
inherit (pkgs) glibc pwdutils;
|
2007-01-15 09:19:41 -08:00
|
|
|
inherit nssModulesPath;
|
2007-01-11 15:55:25 -08: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.
|
|
|
|
++ optional ["networking" "useDHCP"]
|
|
|
|
(import ../upstart-jobs/dhclient.nix {
|
2007-02-22 06:26:53 -08:00
|
|
|
inherit (pkgs) nettools dhcp lib;
|
|
|
|
interfaces = config.get ["networking" "interfaces"];
|
2007-02-12 08:00:55 -08:00
|
|
|
})
|
|
|
|
|
2007-03-16 09:41:38 -07: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 10:24:49 -08:00
|
|
|
# SSH daemon.
|
|
|
|
++ optional ["services" "sshd" "enable"]
|
|
|
|
(import ../upstart-jobs/sshd.nix {
|
2007-01-07 02:19:16 -08:00
|
|
|
inherit (pkgs) writeText openssh glibc pwdutils;
|
|
|
|
inherit (pkgs.xorg) xauth;
|
2007-01-15 09:19:41 -08:00
|
|
|
inherit nssModulesPath;
|
2007-01-07 02:19:16 -08:00
|
|
|
forwardX11 = config.get ["services" "sshd" "forwardX11"];
|
2007-01-10 09:19:17 -08:00
|
|
|
allowSFTP = config.get ["services" "sshd" "allowSFTP"];
|
2006-12-16 10:24:49 -08:00
|
|
|
})
|
|
|
|
|
2006-12-21 15:43:17 -08:00
|
|
|
# NTP daemon.
|
|
|
|
++ optional ["services" "ntp" "enable"]
|
|
|
|
(import ../upstart-jobs/ntpd.nix {
|
2007-03-03 17:16:24 -08:00
|
|
|
inherit modprobe;
|
|
|
|
inherit (pkgs) ntp glibc pwdutils writeText;
|
2006-12-21 15:43:17 -08:00
|
|
|
servers = config.get ["services" "ntp" "servers"];
|
|
|
|
})
|
|
|
|
|
2006-12-16 10:24:49 -08:00
|
|
|
# X server.
|
|
|
|
++ optional ["services" "xserver" "enable"]
|
|
|
|
(import ../upstart-jobs/xserver.nix {
|
2007-02-26 15:11:32 -08:00
|
|
|
inherit config;
|
2007-03-05 16:07:00 -08:00
|
|
|
inherit (pkgs) stdenv writeText lib xterm slim xorg mesa
|
2007-04-02 08:01:09 -07:00
|
|
|
gnome compiz feh kdebase kdelibs xkeyboard_config
|
|
|
|
openssh x11_ssh_askpass;
|
2007-03-30 05:59:43 -07:00
|
|
|
fontDirectories = import ../system/fonts.nix {inherit pkgs;};
|
2006-12-16 10:24:49 -08:00
|
|
|
})
|
|
|
|
|
2006-12-18 11:20:03 -08:00
|
|
|
# Apache httpd.
|
|
|
|
++ optional ["services" "httpd" "enable"]
|
|
|
|
(import ../upstart-jobs/httpd.nix {
|
2006-12-18 11:46:48 -08:00
|
|
|
inherit config pkgs;
|
2006-12-18 11:20:03 -08:00
|
|
|
inherit (pkgs) glibc pwdutils;
|
|
|
|
})
|
|
|
|
|
2007-04-02 10:31:58 -07:00
|
|
|
# CUPS (printing) daemon.
|
|
|
|
++ optional ["services" "printing" "enable"]
|
|
|
|
(import ../upstart-jobs/cupsd.nix {
|
|
|
|
inherit (pkgs) writeText cups;
|
|
|
|
})
|
|
|
|
|
2007-02-28 16:36:00 -08:00
|
|
|
# ALSA sound support.
|
|
|
|
++ optional ["sound" "enable"]
|
|
|
|
(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
|
|
|
})
|
|
|
|
|
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
|
|
|
}))
|
2006-12-18 07:41:18 -08:00
|
|
|
(config.get ["services" "mingetty" "ttys"])
|
2006-12-11 07:32:10 -08:00
|
|
|
)
|
|
|
|
|
2007-01-08 14:41:41 -08: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;
|
|
|
|
|
|
|
|
requiredTTYs =
|
|
|
|
(config.get ["services" "mingetty" "ttys"])
|
|
|
|
++ [10] /* !!! sync with syslog.conf */ ;
|
|
|
|
|
|
|
|
# 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 09:41:46 -08:00
|
|
|
# User-defined events.
|
|
|
|
++ (map makeJob (config.get ["services" "extraJobs"]))
|
|
|
|
|
2006-12-18 11:46:48 -08:00
|
|
|
# For the built-in logd job.
|
2007-03-05 16:07:00 -08:00
|
|
|
++ [
|
2007-03-30 05:55:09 -07:00
|
|
|
(pkgs.upstart // {extraPath = []; extraEtc = [];})
|
2007-03-05 16:07:00 -08:00
|
|
|
];
|
2006-12-18 11:46:48 -08:00
|
|
|
|
2006-12-11 07:32:10 -08:00
|
|
|
}
|