2007-01-08 23:41:41 +01:00
|
|
|
{config, pkgs, nix}:
|
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
|
|
|
|
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 {
|
2006-12-13 15:24:33 +01:00
|
|
|
inherit (pkgs) writeText cleanSource udev procps;
|
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 {
|
|
|
|
inherit (pkgs) kernel module_init_tools lvm2;
|
|
|
|
})
|
|
|
|
|
2006-12-11 16:32:10 +01:00
|
|
|
# Hardware scan; loads modules for PCI devices.
|
|
|
|
(import ../upstart-jobs/hardware-scan.nix {
|
|
|
|
inherit (pkgs) kernel module_init_tools;
|
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 {
|
|
|
|
inherit (pkgs) nettools kernel module_init_tools;
|
|
|
|
})
|
|
|
|
|
|
|
|
# DHCP client.
|
|
|
|
(import ../upstart-jobs/dhclient.nix {
|
|
|
|
inherit (pkgs) nettools;
|
|
|
|
dhcp = pkgs.dhcpWrapper;
|
|
|
|
})
|
|
|
|
|
|
|
|
# Nix daemon - required for multi-user Nix.
|
|
|
|
(import ../upstart-jobs/nix-daemon.nix {
|
|
|
|
inherit nix;
|
|
|
|
})
|
|
|
|
|
2007-01-10 18:09:00 +01:00
|
|
|
# Cron daemon.
|
|
|
|
(import ../upstart-jobs/cron.nix {
|
|
|
|
inherit (pkgs) cron;
|
|
|
|
})
|
|
|
|
|
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)
|
|
|
|
|
|
|
|
]
|
|
|
|
|
2006-12-16 19:24:49 +01:00
|
|
|
# SSH daemon.
|
|
|
|
++ optional ["services" "sshd" "enable"]
|
|
|
|
(import ../upstart-jobs/sshd.nix {
|
2007-01-07 11:19:16 +01:00
|
|
|
inherit (pkgs) writeText openssh glibc pwdutils;
|
|
|
|
inherit (pkgs.xorg) xauth;
|
|
|
|
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 {
|
2006-12-22 20:23:19 +01:00
|
|
|
inherit (pkgs) ntp kernel module_init_tools glibc pwdutils 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 {
|
|
|
|
inherit (pkgs) substituteAll;
|
|
|
|
inherit (pkgs.xorg) xorgserver xf86inputkeyboard xf86inputmouse xf86videovesa;
|
|
|
|
})
|
|
|
|
|
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;
|
2006-12-18 20:20:03 +01:00
|
|
|
inherit (pkgs) glibc pwdutils;
|
|
|
|
})
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
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 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.
|
2006-12-11 16:32:10 +01:00
|
|
|
++ [pkgs.upstart];
|
2006-12-18 20:46:48 +01:00
|
|
|
|
2006-12-11 16:32:10 +01:00
|
|
|
}
|