* 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.bootMount" to "boot.loader.grub.bootDevice"
|
||||||
++ rename obsolete "boot.grubSplashImage" to "boot.loader.grub.splashImage"
|
++ rename obsolete "boot.grubSplashImage" to "boot.loader.grub.splashImage"
|
||||||
|
|
||||||
# jobs
|
# KDE
|
||||||
++ rename obsolete "services.extraJobs" to "jobs"
|
|
||||||
|
|
||||||
# kde
|
|
||||||
++ rename deprecated "kde.extraPackages" to "environment.kdePackages"
|
++ rename deprecated "kde.extraPackages" to "environment.kdePackages"
|
||||||
|
|
||||||
|
|
||||||
|
@ -113,26 +113,23 @@ in
|
|||||||
|
|
||||||
environment.systemPackages = [postgresql];
|
environment.systemPackages = [postgresql];
|
||||||
|
|
||||||
jobs = singleton {
|
jobAttrs.postgresql =
|
||||||
name = "postgresql";
|
{ description = "PostgreSQL server";
|
||||||
|
|
||||||
job = ''
|
startOn = "${startDependency}/started";
|
||||||
description "PostgreSQL server"
|
stopOn = "shutdown";
|
||||||
|
|
||||||
start on ${startDependency}/started
|
preStart =
|
||||||
stop on shutdown
|
''
|
||||||
|
|
||||||
start script
|
|
||||||
if ! test -e ${cfg.dataDir}; then
|
if ! test -e ${cfg.dataDir}; then
|
||||||
mkdir -m 0700 -p ${cfg.dataDir}
|
mkdir -m 0700 -p ${cfg.dataDir}
|
||||||
chown -R postgres ${cfg.dataDir}
|
chown -R postgres ${cfg.dataDir}
|
||||||
${run} -c '${postgresql}/bin/initdb -D ${cfg.dataDir} -U root'
|
${run} -c '${postgresql}/bin/initdb -D ${cfg.dataDir} -U root'
|
||||||
fi
|
fi
|
||||||
cp -f ${pkgs.writeText "pg_hba.conf" cfg.authentication} ${cfg.dataDir}/pg_hba.conf
|
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,7 +93,7 @@ in
|
|||||||
|
|
||||||
exec =
|
exec =
|
||||||
''
|
''
|
||||||
respawn ${pkgs.gpsd}/sbin/gpsd -D "${toString cfg.debugLevel}" \
|
${pkgs.gpsd}/sbin/gpsd -D "${toString cfg.debugLevel}" \
|
||||||
-S "${toString cfg.port}" \
|
-S "${toString cfg.port}" \
|
||||||
${if cfg.readonly then "-b" else ""} \
|
${if cfg.readonly then "-b" else ""} \
|
||||||
"${cfg.device}"
|
"${cfg.device}"
|
||||||
|
@ -94,7 +94,7 @@ in
|
|||||||
|
|
||||||
exec =
|
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}"} \
|
-f ${if cfgS.address == "" then "" else "-a ${cfgS.address}"} \
|
||||||
${if cfgS.screenName == "" then "" else "-n ${cfgS.screenName}" }
|
${if cfgS.screenName == "" then "" else "-n ${cfgS.screenName}" }
|
||||||
'';
|
'';
|
||||||
|
@ -205,7 +205,7 @@ in
|
|||||||
|
|
||||||
exec =
|
exec =
|
||||||
''
|
''
|
||||||
respawn ${pkgs.gnunet}/bin/gnunetd \
|
${pkgs.gnunet}/bin/gnunetd \
|
||||||
${if debug then "--debug" else "" } \
|
${if debug then "--debug" else "" } \
|
||||||
--user="gnunetd" \
|
--user="gnunetd" \
|
||||||
--config="${configFile}" \
|
--config="${configFile}" \
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
{pkgs, config, ...}:
|
{pkgs, config, ...}:
|
||||||
|
|
||||||
|
with pkgs.lib;
|
||||||
|
|
||||||
let
|
let
|
||||||
inherit (pkgs.lib) mkOption mkIf;
|
|
||||||
|
|
||||||
inherit (pkgs) ifplugd;
|
inherit (pkgs) ifplugd;
|
||||||
|
|
||||||
@ -54,16 +55,15 @@ in
|
|||||||
|
|
||||||
config = mkIf config.networking.interfaceMonitor.enable {
|
config = mkIf config.networking.interfaceMonitor.enable {
|
||||||
|
|
||||||
jobs = pkgs.lib.singleton {
|
jobAttrs.ifplugd =
|
||||||
name = "ifplugd";
|
{ description = "Network interface connectivity monitor";
|
||||||
|
|
||||||
job = ''
|
startOn = "network-interfaces/started";
|
||||||
description "Network interface connectivity monitor"
|
stopOn = "network-interfaces/stop";
|
||||||
|
|
||||||
start on network-interfaces/started
|
exec =
|
||||||
stop on network-interfaces/stop
|
''
|
||||||
|
${ifplugd}/sbin/ifplugd --no-daemon --no-startup --no-shutdown \
|
||||||
respawn ${ifplugd}/sbin/ifplugd --no-daemon --no-startup --no-shutdown \
|
|
||||||
${if config.networking.interfaceMonitor.beep then "" else "--no-beep"} \
|
${if config.networking.interfaceMonitor.beep then "" else "--no-beep"} \
|
||||||
--run ${plugScript}
|
--run ${plugScript}
|
||||||
'';
|
'';
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
{pkgs, config, ...}:
|
{ config, pkgs, ... }:
|
||||||
|
|
||||||
|
with pkgs.lib;
|
||||||
|
|
||||||
let
|
let
|
||||||
|
|
||||||
inherit (pkgs.lib) mkOption mkIf singleton;
|
|
||||||
|
|
||||||
inherit (pkgs) ntp;
|
inherit (pkgs) ntp;
|
||||||
|
|
||||||
stateDir = "/var/lib/ntp";
|
stateDir = "/var/lib/ntp";
|
||||||
@ -70,19 +70,14 @@ in
|
|||||||
home = stateDir;
|
home = stateDir;
|
||||||
};
|
};
|
||||||
|
|
||||||
jobs = singleton {
|
jobAttrs.ntpd =
|
||||||
|
{ description = "NTP daemon";
|
||||||
|
|
||||||
name = "ntpd";
|
startOn = "ip-up";
|
||||||
|
stopOn = "ip-down";
|
||||||
job = ''
|
|
||||||
description "NTP daemon"
|
|
||||||
|
|
||||||
start on ip-up
|
|
||||||
stop on ip-down
|
|
||||||
stop on shutdown
|
|
||||||
|
|
||||||
start script
|
|
||||||
|
|
||||||
|
preStart =
|
||||||
|
''
|
||||||
mkdir -m 0755 -p ${stateDir}
|
mkdir -m 0755 -p ${stateDir}
|
||||||
chown ${ntpUser} ${stateDir}
|
chown ${ntpUser} ${stateDir}
|
||||||
|
|
||||||
@ -95,12 +90,9 @@ in
|
|||||||
# phase. Thus a hanging ntpd job can block system
|
# phase. Thus a hanging ntpd job can block system
|
||||||
# shutdown.
|
# shutdown.
|
||||||
# ${ntp}/bin/ntpd -q -g ${ntpFlags}
|
# ${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
|
###### implementation
|
||||||
|
|
||||||
config = mkIf config.services.uptimed.enable {
|
config = mkIf config.services.uptimed.enable {
|
||||||
|
|
||||||
environment.systemPackages = [ uptimed ];
|
environment.systemPackages = [ uptimed ];
|
||||||
|
|
||||||
users.extraUsers = singleton
|
users.extraUsers = singleton
|
||||||
@ -48,18 +49,14 @@ in
|
|||||||
home = stateDir;
|
home = stateDir;
|
||||||
};
|
};
|
||||||
|
|
||||||
jobs = singleton {
|
jobAttrs.uptimed =
|
||||||
|
{ description = "Uptimed daemon";
|
||||||
|
|
||||||
name = "uptimed";
|
startOn = "startup";
|
||||||
|
stopOn = "shutdown";
|
||||||
job = ''
|
|
||||||
description "Uptimed daemon"
|
|
||||||
|
|
||||||
start on startup
|
|
||||||
stop on shutdown
|
|
||||||
|
|
||||||
start script
|
|
||||||
|
|
||||||
|
preStart =
|
||||||
|
''
|
||||||
mkdir -m 0755 -p ${stateDir}
|
mkdir -m 0755 -p ${stateDir}
|
||||||
chown ${uptimedUser} ${stateDir}
|
chown ${uptimedUser} ${stateDir}
|
||||||
|
|
||||||
@ -69,12 +66,9 @@ in
|
|||||||
if ! test -f ${stateDir}/bootid ; then
|
if ! test -f ${stateDir}/bootid ; then
|
||||||
${uptimed}/sbin/uptimed -b
|
${uptimed}/sbin/uptimed -b
|
||||||
fi
|
fi
|
||||||
|
|
||||||
end script
|
|
||||||
|
|
||||||
respawn ${uptimed}/sbin/uptimed ${uptimedFlags}
|
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
exec = "${uptimed}/sbin/uptimed ${uptimedFlags}";
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@ -559,26 +559,34 @@ in
|
|||||||
|
|
||||||
environment.systemPackages = [httpd] ++ concatMap (svc: svc.extraPath) allSubservices;
|
environment.systemPackages = [httpd] ++ concatMap (svc: svc.extraPath) allSubservices;
|
||||||
|
|
||||||
jobs = singleton {
|
jobAttrs.httpd =
|
||||||
name = "httpd";
|
{ # Statically verify the syntactic correctness of the generated
|
||||||
|
|
||||||
# Statically verify the syntactic correctness of the generated
|
|
||||||
# httpd.conf. !!! this is impure! It doesn't just check for
|
# httpd.conf. !!! this is impure! It doesn't just check for
|
||||||
# syntax, but also whether the Apache user/group exist, whether SSL
|
# syntax, but also whether the Apache user/group exist,
|
||||||
# keys exist, etc.
|
# whether SSL keys exist, etc.
|
||||||
buildHook = ''
|
buildHook =
|
||||||
|
''
|
||||||
echo
|
echo
|
||||||
echo '=== Checking the generated Apache configuration file ==='
|
echo '=== Checking the generated Apache configuration file ==='
|
||||||
${httpd}/bin/httpd -f ${httpdConf} -t || true
|
${httpd}/bin/httpd -f ${httpdConf} -t || true
|
||||||
'';
|
'';
|
||||||
|
|
||||||
job = ''
|
description = "Apache HTTPD";
|
||||||
description "Apache HTTPD"
|
|
||||||
|
|
||||||
start on ${startingDependency}/started
|
startOn = "${startingDependency}/started";
|
||||||
stop on shutdown
|
stopOn = "shutdown";
|
||||||
|
|
||||||
start script
|
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";
|
||||||
|
|
||||||
|
PATH = "${pkgs.coreutils}/bin:${pkgs.gnugrep}/bin:${concatStringsSep ":" (concatMap (svc: svc.extraServerPath) allSubservices)}";
|
||||||
|
} // (listToAttrs (concatMap (svc: svc.globalEnvVars) allSubservices));
|
||||||
|
|
||||||
|
preStart =
|
||||||
|
''
|
||||||
mkdir -m 0700 -p ${mainCfg.stateDir}
|
mkdir -m 0700 -p ${mainCfg.stateDir}
|
||||||
mkdir -m 0700 -p ${mainCfg.logDir}
|
mkdir -m 0700 -p ${mainCfg.logDir}
|
||||||
|
|
||||||
@ -594,22 +602,9 @@ in
|
|||||||
echo Running Apache startup hook $i...
|
echo Running Apache startup hook $i...
|
||||||
$i
|
$i
|
||||||
done
|
done
|
||||||
end script
|
|
||||||
|
|
||||||
${
|
|
||||||
let f = {name, value}: "env ${name}=${value}\n";
|
|
||||||
in concatMapStrings f (concatMap (svc: svc.globalEnvVars) allSubservices)
|
|
||||||
}
|
|
||||||
|
|
||||||
# !!! 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
|
|
||||||
|
|
||||||
env PATH=${pkgs.coreutils}/bin:${pkgs.gnugrep}/bin:${concatStringsSep ":" (concatMap (svc: svc.extraServerPath) allSubservices)}
|
|
||||||
|
|
||||||
respawn ${httpd}/bin/httpd -f ${httpdConf} -DNO_DETACH
|
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
exec = "${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
|
let
|
||||||
|
|
||||||
# From a job description, generate an Upstart job file.
|
# From a job description, generate an Upstart job file.
|
||||||
makeJob = job@{buildHook ? "", ...}:
|
makeJob = job:
|
||||||
|
|
||||||
let
|
let
|
||||||
|
|
||||||
jobText = if job.job != "" then job.job else
|
jobText =
|
||||||
''
|
''
|
||||||
# Upstart job `${job.name}'. This is a generated file. Do not edit.
|
# Upstart job `${job.name}'. This is a generated file. Do not edit.
|
||||||
|
|
||||||
@ -66,7 +66,7 @@ let
|
|||||||
|
|
||||||
in
|
in
|
||||||
pkgs.runCommand ("upstart-" + job.name)
|
pkgs.runCommand ("upstart-" + job.name)
|
||||||
{ inherit buildHook; inherit jobText; }
|
{ inherit (job) buildHook; inherit jobText; }
|
||||||
''
|
''
|
||||||
eval "$buildHook"
|
eval "$buildHook"
|
||||||
ensureDir $out/etc/event.d
|
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 {
|
buildHook = mkOption {
|
||||||
type = types.string;
|
type = types.string;
|
||||||
default = "true";
|
default = "true";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user