* Convert the remaining jobs to jobAttrs style.

svn path=/nixos/trunk/; revision=17764
wip/yesman
Eelco Dolstra 15 years ago
parent 9943e0762e
commit d982f23f20
  1. 13
      modules/services/audio/alsa.nix
  2. 10
      modules/services/databases/mysql.nix
  3. 5
      modules/services/hardware/acpid.nix
  4. 8
      modules/services/hardware/hal.nix
  5. 6
      modules/services/hardware/udev.nix
  6. 6
      modules/services/logging/syslogd.nix
  7. 12
      modules/services/misc/nix-daemon.nix
  8. 6
      modules/services/misc/rogue.nix
  9. 31
      modules/services/networking/ddclient.nix
  10. 11
      modules/services/networking/dhclient.nix
  11. 6
      modules/services/networking/firewall.nix
  12. 35
      modules/services/networking/privoxy.nix
  13. 14
      modules/services/networking/wpa_supplicant.nix
  14. 6
      modules/services/networking/xinetd.nix
  15. 6
      modules/services/scheduling/atd.nix
  16. 6
      modules/services/system/dbus.nix
  17. 6
      modules/services/system/nscd.nix
  18. 14
      modules/services/ttys/mingetty.nix
  19. 6
      modules/services/x11/xserver.nix
  20. 2
      modules/system/upstart/upstart.nix
  21. 8
      modules/tasks/kbd.nix
  22. 8
      modules/tasks/network-interfaces.nix
  23. 11
      modules/tasks/swap.nix
  24. 80
      modules/tasks/tty-backgrounds.nix
  25. 6
      modules/testing/test-instrumentation.nix

@ -1,8 +1,9 @@
# ALSA sound support.
{pkgs, config, ...}:
{ config, pkgs, ... }:
with pkgs.lib;
let
inherit (pkgs.lib) mkOption singleton mkIf;
inherit (pkgs) alsaUtils;
@ -23,7 +24,7 @@ in
description = ''
Whether to enable ALSA sound.
'';
merge = pkgs.lib.mergeEnableOption;
merge = mergeEnableOption;
};
};
@ -44,10 +45,8 @@ in
gid = config.ids.gids.audio;
};
jobs = singleton
{ name = "alsa";
startOn = "udev";
jobAttrs.alsa =
{ startOn = "udev";
preStart =
''

@ -1,7 +1,8 @@
{pkgs, config, ...}:
{ config, pkgs, ... }:
with pkgs.lib;
let
inherit (pkgs.lib) mkOption mkIf singleton;
cfg = config.services.mysql;
@ -71,9 +72,8 @@ in
environment.systemPackages = [mysql];
jobs = singleton
{ name = "mysql";
description = "MySQL server";
jobAttrs.mysql =
{ description = "MySQL server";
startOn = "filesystems";
stopOn = "shutdown";

@ -76,9 +76,8 @@ in
config = mkIf config.powerManagement.enable {
jobs = singleton
{ name = "acpid";
description = "ACPI daemon";
jobAttrs.acpid =
{ description = "ACPI daemon";
startOn = "udev";
stopOn = "shutdown";

@ -1,5 +1,5 @@
# HAL daemon.
{pkgs, config, ...}:
{ config, pkgs, ... }:
with pkgs.lib;
@ -64,10 +64,8 @@ in
gid = config.ids.gids.haldaemon;
};
jobs = singleton
{ name = "hal";
description = "HAL daemon";
jobAttrs.hal =
{ description = "HAL daemon";
# !!! TODO: make sure that HAL starts after acpid,
# otherwise hald-addon-acpi will grab /proc/acpi/event.

@ -152,10 +152,8 @@ in
services.udev.packages = [extraUdevRules];
jobs = singleton
{ name = "udev";
startOn = "startup";
jobAttrs.udev =
{ startOn = "startup";
stopOn = "shutdown";
environment = { UDEV_CONFIG_FILE = conf; };

@ -47,10 +47,8 @@ in
config = {
jobs = singleton
{ name = "syslogd";
description = "Syslog daemon";
jobAttrs.syslogd =
{ description = "Syslog daemon";
startOn = "udev";
stopOn = "shutdown";

@ -1,4 +1,4 @@
{pkgs, config, ...}:
{ config, pkgs, ... }:
with pkgs.lib;
@ -127,7 +127,7 @@ in
envVars = mkOption {
internal = true;
default = "";
merge = pkgs.lib.mergeStringOption;
merge = mergeStringOption;
description = "
Environment variables used by Nix.
";
@ -178,7 +178,7 @@ in
{ # List of machines for distributed Nix builds in the format expected
# by build-remote.pl.
source = pkgs.writeText "nix.machines"
(pkgs.lib.concatStrings (map (machine:
(concatStrings (map (machine:
"${machine.sshUser}@${machine.hostName} "
+ (if machine ? system then machine.system else concatStringsSep "," machine.systems)
+ " ${machine.sshKey} ${toString machine.maxJobs} "
@ -188,10 +188,8 @@ in
target = "nix.machines";
};
jobs = pkgs.lib.singleton
{ name = "nix-daemon";
startOn = "startup";
jobAttrs.nixDaemon =
{ startOn = "startup";
script =
''

@ -40,10 +40,8 @@ in
boot.extraTTYs = [ cfg.tty ];
jobs = singleton
{ name = "rogue";
description = "Rogue dungeon crawling game";
jobAttrs.rogue =
{ description = "Rogue dungeon crawling game";
startOn = "udev";
stopOn = "shutdown";

@ -1,4 +1,4 @@
{pkgs, config, ...}:
{ config, pkgs, ... }:
let
@ -110,27 +110,24 @@ in
home = stateDir;
};
jobs = singleton {
jobAttrs.ddclient =
{ name = "ddclient";
name = "ddclient";
startOn = "startup";
stopOn = "shutdown";
startOn = "startup";
stopOn = "shutdown";
preStart =
''
mkdir -m 0755 -p ${stateDir}
chown ${ddclientUser} ${stateDir}
preStart = ''
mkdir -m 0755 -p ${stateDir}
chown ${ddclientUser} ${stateDir}
# Needed to run ddclient as an unprivileged user.
${modprobe}/sbin/modprobe capability || true
'';
# Needed to run ddclient as an unprivileged user.
${modprobe}/sbin/modprobe capability || true
'';
script = ''
${ddclient}/bin/ddclient ${ddclientFlags}
'';
exec = "${ddclient}/bin/ddclient ${ddclientFlags}";
};
};
};
}

@ -1,7 +1,8 @@
{pkgs, config, ...}:
{ config, pkgs, ... }:
with pkgs.lib;
let
inherit (pkgs.lib) mkOption mkIf mergeEnableOption mergeListOption;
inherit (pkgs) nettools dhcp lib;
@ -60,10 +61,8 @@ in
config = mkIf config.networking.useDHCP {
jobs = pkgs.lib.singleton
{ name = "dhclient";
startOn = "network-interfaces/started";
jobAttrs.dhclient =
{ startOn = "network-interfaces/started";
stopOn = "network-interfaces/stop";
preStart =

@ -78,10 +78,8 @@ in
environment.systemPackages = [pkgs.iptables];
jobs = singleton
{ name = "firewall";
startOn = "network-interfaces/started";
jobAttrs.firewall =
{ startOn = "network-interfaces/started";
preStart =
''

@ -1,8 +1,8 @@
{pkgs, config, ...}:
{ config, pkgs, ... }:
let
with pkgs.lib;
inherit (pkgs.lib) mkOption mkIf singleton;
let
inherit (pkgs) privoxy;
@ -77,27 +77,24 @@ in
home = stateDir;
};
jobs = singleton {
name = "privoxy";
jobAttrs.privoxy =
{ name = "privoxy";
startOn = "startup";
stopOn = "shutdown";
startOn = "startup";
stopOn = "shutdown";
preStart = ''
mkdir -m 0755 -p ${stateDir}
chown ${privoxyUser} ${stateDir}
preStart =
''
mkdir -m 0755 -p ${stateDir}
chown ${privoxyUser} ${stateDir}
# Needed to run privoxy as an unprivileged user.
${modprobe}/sbin/modprobe capability || true
'';
# Needed to run privoxy as an unprivileged user.
${modprobe}/sbin/modprobe capability || true
'';
script = ''
${privoxy}/sbin/privoxy ${privoxyFlags}
'';
exec = "${privoxy}/sbin/privoxy ${privoxyFlags}";
};
};
};
}

@ -1,4 +1,6 @@
{pkgs, config, ...}:
{ config, pkgs, ... }:
with pkgs.lib;
let
@ -12,7 +14,7 @@ in
options = {
networking.enableWLAN = pkgs.lib.mkOption {
networking.enableWLAN = mkOption {
default = false;
description = ''
Whether to start <command>wpa_supplicant</command> to scan for
@ -31,14 +33,12 @@ in
###### implementation
config = pkgs.lib.mkIf config.networking.enableWLAN {
config = mkIf config.networking.enableWLAN {
environment.systemPackages = [pkgs.wpa_supplicant];
jobs = pkgs.lib.singleton
{ name = "wpa_supplicant";
startOn = "network-interfaces/started";
jobAttrs.wpa_supplicant =
{ startOn = "network-interfaces/started";
stopOn = "network-interfaces/stop";
preStart =

@ -119,10 +119,8 @@ in
config = mkIf cfg.enable {
jobs = singleton
{ name = "xinetd";
description = "xinetd server";
jobAttrs.xinetd =
{ description = "xinetd server";
startOn = "network-interfaces/started";
stopOn = "network-interfaces/stop";

@ -63,10 +63,8 @@ in
gid = config.ids.gids.atd;
};
jobs = singleton
{ name = "atd";
description = "at daemon (atd)";
jobAttrs.atd =
{ description = "at daemon (atd)";
startOn = "startup";
stopOn = "shutdown";

@ -113,10 +113,8 @@ in
gid = config.ids.gids.messagebus;
};
jobs = singleton
{ name = "dbus";
startOn = "udev";
jobAttrs.dbus =
{ startOn = "udev";
stopOn = "shutdown";
preStart =

@ -17,10 +17,8 @@ in
description = "Name service cache daemon user";
};
jobs = singleton
{ name = "nscd";
description = "Name Service Cache Daemon";
jobAttrs.nscd =
{ description = "Name Service Cache Daemon";
startOn = "startup";
stopOn = "shutdown";

@ -1,10 +1,6 @@
{pkgs, config, ...}:
{ config, pkgs, ... }:
let
inherit (pkgs.lib) mkOption mkIf singleton;
in
with pkgs.lib;
{
@ -57,15 +53,13 @@ in
config = {
# Generate a separate job for each tty.
jobs = map (tty: {
jobAttrs = listToAttrs (map (tty: nameValuePair tty {
name = tty;
startOn = "udev";
exec = "${pkgs.mingetty}/sbin/mingetty --loginprog=${pkgs.pam_login}/bin/login --noclear ${tty}";
}) config.services.mingetty.ttys;
}) config.services.mingetty.ttys);
environment.etc = singleton
{ # Friendly greeting on the virtual consoles.

@ -348,10 +348,8 @@ in
services.hal.packages = halConfigFiles;
jobs = singleton
{ name = "xserver";
startOn = if cfg.autorun then "hal" else "never";
jobAttrs.xserver =
{ startOn = if cfg.autorun then "hal" else "never";
environment =
{ FONTCONFIG_FILE = "/etc/fonts/fonts.conf"; # !!! cleanup

@ -73,7 +73,7 @@ let
echo "$jobText" > $out/etc/event.d/${job.name}
'';
jobs =
let
deprecatedJobDefs = config.jobs;

@ -1,4 +1,4 @@
{pkgs, config, ...}:
{ config, pkgs, ... }:
with pkgs.lib;
@ -56,10 +56,8 @@ in
environment.systemPackages = [pkgs.kbd];
jobs = singleton
{ name = "kbd";
description = "Keyboard / console initialisation";
jobAttrs.kbd =
{ description = "Keyboard / console initialisation";
startOn = "udev";

@ -1,8 +1,8 @@
{pkgs, config, ...}:
{ config, pkgs, ... }:
let
with pkgs.lib;
inherit (pkgs.lib) mkOption types;
let
inherit (pkgs) nettools;
@ -132,7 +132,7 @@ in
pkgs.wirelesstools
];
jobs = pkgs.lib.singleton
jobAttrs.networkInterfaces =
{ name = "network-interfaces";
startOn = "udev";

@ -1,9 +1,10 @@
{pkgs, config, ...}:
{ config, pkgs, ... }:
with pkgs.lib;
let
inherit (pkgs) utillinux;
inherit (pkgs.lib) mkOption filter types;
toPath = x: if x.device != null then x.device else "/dev/disk/by-label/${x.label}";
@ -65,10 +66,8 @@ in
config = {
jobs = pkgs.lib.singleton
{ name = "swap";
task = true;
jobAttrs.swap =
{ task = true;
startOn = ["startup" "new-devices"];

@ -1,7 +1,9 @@
{pkgs, config, ...}:
{ config, pkgs, ... }:
with pkgs.lib;
let
inherit (pkgs.lib) mkOption mkIf singleton;
inherit (pkgs) stdenv;
kernelPackages = config.boot.kernelPackages;
@ -19,7 +21,7 @@ let
# syslog tty, except those for which a specific theme is
# specified.
defaultTTYs =
pkgs.lib.filter (x: !(pkgs.lib.elem x overridenTTYs)) requiredTTYs;
filter (x: !(elem x overridenTTYs)) requiredTTYs;
in
(map (tty: {
@ -100,42 +102,42 @@ in
target = "splash";
};
jobs = singleton {
name = "tty-backgrounds";
startOn = "udev";
preStart =
''
# Critical: tell the kernel where to find splash_helper. It calls
# this program every time we switch between consoles.
helperProcFile=${splashutils.helperProcFile}
if test -e /proc/sys/fbcondecor; then helperProcFile=/proc/sys/fbcondecor; fi
echo ${splashutils}/${splashutils.helperName} > $helperProcFile
# For each console...
for tty in ${toString (map (x: x.tty) backgrounds)}; do
# Make sure that the console exists.
echo -n "" > /dev/$tty
# Set the theme as determined by tty-backgrounds-combine.sh
# above. Note that splashutils needs a TTY number
# instead of a device name, hence the ''${tty:3}.
theme=$(readlink ${themesUnpacked}/$tty)
${splashutils}/${splashutils.controlName} --tty ''${tty:3} -c setcfg -t $theme || true
${splashutils}/${splashutils.controlName} --tty ''${tty:3} -c setpic -t $theme || true
${splashutils}/${splashutils.controlName} --tty ''${tty:3} -c on || true
done
'';
postStop =
''
# Disable the theme on each console.
for tty in ${toString (map (x: x.tty) backgrounds)}; do
${splashutils}/${splashutils.controlName} --tty ''${tty:3} -c off || true
done
'';
};
jobAttrs.ttyBackgrounds =
{ name = "tty-backgrounds";
startOn = "udev";
preStart =
''
# Critical: tell the kernel where to find splash_helper. It calls
# this program every time we switch between consoles.
helperProcFile=${splashutils.helperProcFile}
if test -e /proc/sys/fbcondecor; then helperProcFile=/proc/sys/fbcondecor; fi
echo ${splashutils}/${splashutils.helperName} > $helperProcFile
# For each console...
for tty in ${toString (map (x: x.tty) backgrounds)}; do
# Make sure that the console exists.
echo -n "" > /dev/$tty
# Set the theme as determined by tty-backgrounds-combine.sh
# above. Note that splashutils needs a TTY number
# instead of a device name, hence the ''${tty:3}.
theme=$(readlink ${themesUnpacked}/$tty)
${splashutils}/${splashutils.controlName} --tty ''${tty:3} -c setcfg -t $theme || true
${splashutils}/${splashutils.controlName} --tty ''${tty:3} -c setpic -t $theme || true
${splashutils}/${splashutils.controlName} --tty ''${tty:3} -c on || true
done
'';
postStop =
''
# Disable the theme on each console.
for tty in ${toString (map (x: x.tty) backgrounds)}; do
${splashutils}/${splashutils.controlName} --tty ''${tty:3} -c off || true
done
'';
};
};

@ -9,10 +9,8 @@ with pkgs.lib;
config = {
jobs = singleton
{ name = "backdoor";
startOn = "network-interfaces";
jobAttrs.backdoor =
{ startOn = "network-interfaces";
preStart =
''

Loading…
Cancel
Save