* Update some more modules.
svn path=/nixos/trunk/; revision=17763
This commit is contained in:
parent
e91d882a94
commit
9943e0762e
|
@ -71,10 +71,7 @@ in zipModules ([]
|
|||
++ rename obsolete "boot.bootMount" to "boot.loader.grub.bootDevice"
|
||||
++ rename obsolete "boot.grubSplashImage" to "boot.loader.grub.splashImage"
|
||||
|
||||
# jobs
|
||||
++ rename obsolete "services.extraJobs" to "jobs"
|
||||
|
||||
# kde
|
||||
# KDE
|
||||
++ rename deprecated "kde.extraPackages" to "environment.kdePackages"
|
||||
|
||||
|
||||
|
|
|
@ -113,27 +113,24 @@ in
|
|||
|
||||
environment.systemPackages = [postgresql];
|
||||
|
||||
jobs = singleton {
|
||||
name = "postgresql";
|
||||
jobAttrs.postgresql =
|
||||
{ description = "PostgreSQL server";
|
||||
|
||||
job = ''
|
||||
description "PostgreSQL server"
|
||||
startOn = "${startDependency}/started";
|
||||
stopOn = "shutdown";
|
||||
|
||||
start on ${startDependency}/started
|
||||
stop on shutdown
|
||||
|
||||
start script
|
||||
preStart =
|
||||
''
|
||||
if ! test -e ${cfg.dataDir}; then
|
||||
mkdir -m 0700 -p ${cfg.dataDir}
|
||||
chown -R postgres ${cfg.dataDir}
|
||||
${run} -c '${postgresql}/bin/initdb -D ${cfg.dataDir} -U root'
|
||||
fi
|
||||
cp -f ${pkgs.writeText "pg_hba.conf" cfg.authentication} ${cfg.dataDir}/pg_hba.conf
|
||||
end script
|
||||
'';
|
||||
|
||||
respawn ${run} -c '${postgresql}/bin/postgres -D ${cfg.dataDir} ${toString flags}'
|
||||
'';
|
||||
};
|
||||
exec = "${run} -c '${postgresql}/bin/postgres -D ${cfg.dataDir} ${toString flags}'";
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -93,10 +93,10 @@ in
|
|||
|
||||
exec =
|
||||
''
|
||||
respawn ${pkgs.gpsd}/sbin/gpsd -D "${toString cfg.debugLevel}" \
|
||||
-S "${toString cfg.port}" \
|
||||
${if cfg.readonly then "-b" else ""} \
|
||||
"${cfg.device}"
|
||||
${pkgs.gpsd}/sbin/gpsd -D "${toString cfg.debugLevel}" \
|
||||
-S "${toString cfg.port}" \
|
||||
${if cfg.readonly then "-b" else ""} \
|
||||
"${cfg.device}"
|
||||
'';
|
||||
};
|
||||
|
||||
|
|
|
@ -94,7 +94,7 @@ in
|
|||
|
||||
exec =
|
||||
''
|
||||
respawn ${pkgs.synergy}/bin/synergys -c ${cfgS.configFile} \
|
||||
${pkgs.synergy}/bin/synergys -c ${cfgS.configFile} \
|
||||
-f ${if cfgS.address == "" then "" else "-a ${cfgS.address}"} \
|
||||
${if cfgS.screenName == "" then "" else "-n ${cfgS.screenName}" }
|
||||
'';
|
||||
|
|
|
@ -205,7 +205,7 @@ in
|
|||
|
||||
exec =
|
||||
''
|
||||
respawn ${pkgs.gnunet}/bin/gnunetd \
|
||||
${pkgs.gnunet}/bin/gnunetd \
|
||||
${if debug then "--debug" else "" } \
|
||||
--user="gnunetd" \
|
||||
--config="${configFile}" \
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
{pkgs, config, ...}:
|
||||
|
||||
with pkgs.lib;
|
||||
|
||||
let
|
||||
inherit (pkgs.lib) mkOption mkIf;
|
||||
|
||||
inherit (pkgs) ifplugd;
|
||||
|
||||
|
@ -54,20 +55,19 @@ in
|
|||
|
||||
config = mkIf config.networking.interfaceMonitor.enable {
|
||||
|
||||
jobs = pkgs.lib.singleton {
|
||||
name = "ifplugd";
|
||||
jobAttrs.ifplugd =
|
||||
{ description = "Network interface connectivity monitor";
|
||||
|
||||
job = ''
|
||||
description "Network interface connectivity monitor"
|
||||
startOn = "network-interfaces/started";
|
||||
stopOn = "network-interfaces/stop";
|
||||
|
||||
start on network-interfaces/started
|
||||
stop on network-interfaces/stop
|
||||
|
||||
respawn ${ifplugd}/sbin/ifplugd --no-daemon --no-startup --no-shutdown \
|
||||
${if config.networking.interfaceMonitor.beep then "" else "--no-beep"} \
|
||||
--run ${plugScript}
|
||||
'';
|
||||
};
|
||||
exec =
|
||||
''
|
||||
${ifplugd}/sbin/ifplugd --no-daemon --no-startup --no-shutdown \
|
||||
${if config.networking.interfaceMonitor.beep then "" else "--no-beep"} \
|
||||
--run ${plugScript}
|
||||
'';
|
||||
};
|
||||
|
||||
environment.systemPackages = [ifplugd];
|
||||
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
{pkgs, config, ...}:
|
||||
{ config, pkgs, ... }:
|
||||
|
||||
with pkgs.lib;
|
||||
|
||||
let
|
||||
|
||||
inherit (pkgs.lib) mkOption mkIf singleton;
|
||||
|
||||
inherit (pkgs) ntp;
|
||||
|
||||
stateDir = "/var/lib/ntp";
|
||||
|
@ -70,19 +70,14 @@ in
|
|||
home = stateDir;
|
||||
};
|
||||
|
||||
jobs = singleton {
|
||||
jobAttrs.ntpd =
|
||||
{ description = "NTP daemon";
|
||||
|
||||
name = "ntpd";
|
||||
|
||||
job = ''
|
||||
description "NTP daemon"
|
||||
|
||||
start on ip-up
|
||||
stop on ip-down
|
||||
stop on shutdown
|
||||
|
||||
start script
|
||||
startOn = "ip-up";
|
||||
stopOn = "ip-down";
|
||||
|
||||
preStart =
|
||||
''
|
||||
mkdir -m 0755 -p ${stateDir}
|
||||
chown ${ntpUser} ${stateDir}
|
||||
|
||||
|
@ -95,13 +90,10 @@ in
|
|||
# phase. Thus a hanging ntpd job can block system
|
||||
# shutdown.
|
||||
# ${ntp}/bin/ntpd -q -g ${ntpFlags}
|
||||
'';
|
||||
|
||||
end script
|
||||
|
||||
respawn ${ntp}/bin/ntpd -g -n ${ntpFlags}
|
||||
'';
|
||||
|
||||
};
|
||||
exec = "${ntp}/bin/ntpd -g -n ${ntpFlags}";
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -39,6 +39,7 @@ in
|
|||
###### implementation
|
||||
|
||||
config = mkIf config.services.uptimed.enable {
|
||||
|
||||
environment.systemPackages = [ uptimed ];
|
||||
|
||||
users.extraUsers = singleton
|
||||
|
@ -48,18 +49,14 @@ in
|
|||
home = stateDir;
|
||||
};
|
||||
|
||||
jobs = singleton {
|
||||
jobAttrs.uptimed =
|
||||
{ description = "Uptimed daemon";
|
||||
|
||||
name = "uptimed";
|
||||
|
||||
job = ''
|
||||
description "Uptimed daemon"
|
||||
|
||||
start on startup
|
||||
stop on shutdown
|
||||
|
||||
start script
|
||||
startOn = "startup";
|
||||
stopOn = "shutdown";
|
||||
|
||||
preStart =
|
||||
''
|
||||
mkdir -m 0755 -p ${stateDir}
|
||||
chown ${uptimedUser} ${stateDir}
|
||||
|
||||
|
@ -69,13 +66,10 @@ in
|
|||
if ! test -f ${stateDir}/bootid ; then
|
||||
${uptimed}/sbin/uptimed -b
|
||||
fi
|
||||
'';
|
||||
|
||||
end script
|
||||
|
||||
respawn ${uptimed}/sbin/uptimed ${uptimedFlags}
|
||||
'';
|
||||
|
||||
};
|
||||
exec = "${uptimed}/sbin/uptimed ${uptimedFlags}";
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -559,59 +559,54 @@ in
|
|||
|
||||
environment.systemPackages = [httpd] ++ concatMap (svc: svc.extraPath) allSubservices;
|
||||
|
||||
jobs = singleton {
|
||||
name = "httpd";
|
||||
jobAttrs.httpd =
|
||||
{ # Statically verify the syntactic correctness of the generated
|
||||
# httpd.conf. !!! this is impure! It doesn't just check for
|
||||
# syntax, but also whether the Apache user/group exist,
|
||||
# whether SSL keys exist, etc.
|
||||
buildHook =
|
||||
''
|
||||
echo
|
||||
echo '=== Checking the generated Apache configuration file ==='
|
||||
${httpd}/bin/httpd -f ${httpdConf} -t || true
|
||||
'';
|
||||
|
||||
# Statically verify the syntactic correctness of the generated
|
||||
# httpd.conf. !!! this is impure! It doesn't just check for
|
||||
# syntax, but also whether the Apache user/group exist, whether SSL
|
||||
# keys exist, etc.
|
||||
buildHook = ''
|
||||
echo
|
||||
echo '=== Checking the generated Apache configuration file ==='
|
||||
${httpd}/bin/httpd -f ${httpdConf} -t || true
|
||||
'';
|
||||
description = "Apache HTTPD";
|
||||
|
||||
job = ''
|
||||
description "Apache HTTPD"
|
||||
startOn = "${startingDependency}/started";
|
||||
stopOn = "shutdown";
|
||||
|
||||
start on ${startingDependency}/started
|
||||
stop on shutdown
|
||||
environment =
|
||||
{ # !!! This should be added in test-instrumentation.nix. It
|
||||
# shouldn't hurt though, since packages usually aren't built
|
||||
# with coverage enabled.
|
||||
GCOV_PREFIX = "/tmp/coverage-data";
|
||||
|
||||
start script
|
||||
mkdir -m 0700 -p ${mainCfg.stateDir}
|
||||
mkdir -m 0700 -p ${mainCfg.logDir}
|
||||
PATH = "${pkgs.coreutils}/bin:${pkgs.gnugrep}/bin:${concatStringsSep ":" (concatMap (svc: svc.extraServerPath) allSubservices)}";
|
||||
} // (listToAttrs (concatMap (svc: svc.globalEnvVars) allSubservices));
|
||||
|
||||
# Get rid of old semaphores. These tend to accumulate across
|
||||
# server restarts, eventually preventing it from restarting
|
||||
# succesfully.
|
||||
for i in $(${pkgs.utillinux}/bin/ipcs -s | grep ' ${mainCfg.user} ' | cut -f2 -d ' '); do
|
||||
${pkgs.utillinux}/bin/ipcrm -s $i
|
||||
done
|
||||
preStart =
|
||||
''
|
||||
mkdir -m 0700 -p ${mainCfg.stateDir}
|
||||
mkdir -m 0700 -p ${mainCfg.logDir}
|
||||
|
||||
# Run the startup hooks for the subservices.
|
||||
for i in ${toString (map (svn: svn.startupScript) allSubservices)}; do
|
||||
echo Running Apache startup hook $i...
|
||||
$i
|
||||
done
|
||||
end script
|
||||
# Get rid of old semaphores. These tend to accumulate across
|
||||
# server restarts, eventually preventing it from restarting
|
||||
# succesfully.
|
||||
for i in $(${pkgs.utillinux}/bin/ipcs -s | grep ' ${mainCfg.user} ' | cut -f2 -d ' '); do
|
||||
${pkgs.utillinux}/bin/ipcrm -s $i
|
||||
done
|
||||
|
||||
${
|
||||
let f = {name, value}: "env ${name}=${value}\n";
|
||||
in concatMapStrings f (concatMap (svc: svc.globalEnvVars) allSubservices)
|
||||
}
|
||||
# Run the startup hooks for the subservices.
|
||||
for i in ${toString (map (svn: svn.startupScript) allSubservices)}; do
|
||||
echo Running Apache startup hook $i...
|
||||
$i
|
||||
done
|
||||
'';
|
||||
|
||||
# !!! This should be added in test-instrumentation.nix. It
|
||||
# shouldn't hurt though, since packages usually aren't built
|
||||
# with coverage enabled.
|
||||
env GCOV_PREFIX=/tmp/coverage-data
|
||||
exec = "${httpd}/bin/httpd -f ${httpdConf} -DNO_DETACH";
|
||||
};
|
||||
|
||||
env PATH=${pkgs.coreutils}/bin:${pkgs.gnugrep}/bin:${concatStringsSep ":" (concatMap (svc: svc.extraServerPath) allSubservices)}
|
||||
|
||||
respawn ${httpd}/bin/httpd -f ${httpdConf} -DNO_DETACH
|
||||
'';
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -1,36 +0,0 @@
|
|||
# This file defines functions to handle upstart-jobs.
|
||||
{pkgs, config, ...}:
|
||||
|
||||
let
|
||||
inherit (pkgs.lib) filter findSingle;
|
||||
jobs = config.services.extraJobs;
|
||||
|
||||
primaryEvents = [
|
||||
"startup"
|
||||
"shutdown"
|
||||
"never"
|
||||
];
|
||||
|
||||
upstartJobsTools = rec {
|
||||
exists = name:
|
||||
let
|
||||
found = filter
|
||||
(j: j ? name && j.name == name)
|
||||
(jobs ++ map (name: {inherit name;}) primaryEvents);
|
||||
in found != [];
|
||||
|
||||
check = name:
|
||||
if exists name then
|
||||
name
|
||||
else
|
||||
abort "Undefined upstart job name: ${name}.";
|
||||
};
|
||||
in
|
||||
|
||||
{
|
||||
services = {
|
||||
tools = {
|
||||
upstartJobs = upstartJobsTools;
|
||||
};
|
||||
};
|
||||
}
|
|
@ -5,11 +5,11 @@ with pkgs.lib;
|
|||
let
|
||||
|
||||
# From a job description, generate an Upstart job file.
|
||||
makeJob = job@{buildHook ? "", ...}:
|
||||
makeJob = job:
|
||||
|
||||
let
|
||||
|
||||
jobText = if job.job != "" then job.job else
|
||||
jobText =
|
||||
''
|
||||
# Upstart job `${job.name}'. This is a generated file. Do not edit.
|
||||
|
||||
|
@ -66,7 +66,7 @@ let
|
|||
|
||||
in
|
||||
pkgs.runCommand ("upstart-" + job.name)
|
||||
{ inherit buildHook; inherit jobText; }
|
||||
{ inherit (job) buildHook; inherit jobText; }
|
||||
''
|
||||
eval "$buildHook"
|
||||
ensureDir $out/etc/event.d
|
||||
|
@ -116,22 +116,6 @@ let
|
|||
'';
|
||||
};
|
||||
|
||||
job = mkOption {
|
||||
default = "";
|
||||
type = types.string;
|
||||
example =
|
||||
''
|
||||
description "nc"
|
||||
start on started network-interfaces
|
||||
respawn
|
||||
env PATH=/var/run/current-system/sw/bin
|
||||
exec sh -c "echo 'hello world' | ${pkgs.netcat}/bin/nc -l -p 9000"
|
||||
'';
|
||||
description = ''
|
||||
Contents of the Upstart job.
|
||||
'';
|
||||
};
|
||||
|
||||
buildHook = mkOption {
|
||||
type = types.string;
|
||||
default = "true";
|
||||
|
|
Loading…
Reference in New Issue