* Get rid of the "users" and "groups" fields in jobs.
svn path=/nixos/branches/modular-nixos/; revision=16371
This commit is contained in:
parent
ca8e00cafa
commit
9d1e31117f
@ -1,42 +1,10 @@
|
||||
{pkgs, config, ...}:
|
||||
|
||||
###### interface
|
||||
let
|
||||
inherit (pkgs.lib) mkOption mkIf;
|
||||
|
||||
options = {
|
||||
services = {
|
||||
ntp = {
|
||||
|
||||
enable = mkOption {
|
||||
default = true;
|
||||
description = "
|
||||
Whether to synchronise your machine's time using the NTP
|
||||
protocol.
|
||||
";
|
||||
};
|
||||
|
||||
servers = mkOption {
|
||||
default = [
|
||||
"0.pool.ntp.org"
|
||||
"1.pool.ntp.org"
|
||||
"2.pool.ntp.org"
|
||||
];
|
||||
description = "
|
||||
The set of NTP servers from which to synchronise.
|
||||
";
|
||||
};
|
||||
|
||||
};
|
||||
};
|
||||
};
|
||||
in
|
||||
|
||||
###### implementation
|
||||
|
||||
let
|
||||
|
||||
inherit (pkgs) writeText ntp;
|
||||
inherit (pkgs.lib) mkOption mkIf singleton;
|
||||
|
||||
inherit (pkgs) ntp;
|
||||
|
||||
stateDir = "/var/lib/ntp";
|
||||
|
||||
@ -46,7 +14,7 @@ let
|
||||
|
||||
modprobe = config.system.sbin.modprobe;
|
||||
|
||||
configFile = writeText "ntp.conf" ''
|
||||
configFile = pkgs.writeText "ntp.conf" ''
|
||||
driftfile ${stateDir}/ntp.drift
|
||||
# Keep the drift file in ${stateDir}/ntp.drift. However, since we
|
||||
# chroot to ${stateDir}, we have to specify it as /ntp.drift.
|
||||
@ -59,25 +27,53 @@ let
|
||||
|
||||
in
|
||||
|
||||
{
|
||||
|
||||
mkIf config.services.ntp.enable {
|
||||
require = [
|
||||
options
|
||||
];
|
||||
###### interface
|
||||
|
||||
options = {
|
||||
|
||||
services.ntp = {
|
||||
|
||||
services = {
|
||||
extraJobs = [{
|
||||
enable = mkOption {
|
||||
default = true;
|
||||
description = ''
|
||||
Whether to synchronise your machine's time using the NTP
|
||||
protocol.
|
||||
'';
|
||||
};
|
||||
|
||||
servers = mkOption {
|
||||
default = [
|
||||
"0.pool.ntp.org"
|
||||
"1.pool.ntp.org"
|
||||
"2.pool.ntp.org"
|
||||
];
|
||||
description = ''
|
||||
The set of NTP servers from which to synchronise.
|
||||
'';
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
|
||||
###### implementation
|
||||
|
||||
config = mkIf config.services.ntp.enable {
|
||||
|
||||
users.extraUsers = singleton
|
||||
{ name = ntpUser;
|
||||
uid = config.ids.uids.ntp;
|
||||
description = "NTP daemon user";
|
||||
home = stateDir;
|
||||
};
|
||||
|
||||
jobs = singleton {
|
||||
|
||||
name = "ntpd";
|
||||
|
||||
users = [
|
||||
{ name = ntpUser;
|
||||
uid = config.ids.uids.ntp;
|
||||
description = "NTP daemon user";
|
||||
home = stateDir;
|
||||
}
|
||||
];
|
||||
|
||||
job = ''
|
||||
description "NTP daemon"
|
||||
|
||||
@ -104,6 +100,9 @@ mkIf config.services.ntp.enable {
|
||||
|
||||
respawn ${ntp}/bin/ntpd -g -n ${ntpFlags}
|
||||
'';
|
||||
}];
|
||||
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -1,44 +1,47 @@
|
||||
{pkgs, config, ...}:
|
||||
|
||||
###### implementation
|
||||
|
||||
let
|
||||
|
||||
nssModulesPath = config.system.nssModules.path;
|
||||
|
||||
inherit (pkgs.lib) singleton;
|
||||
|
||||
in
|
||||
|
||||
{
|
||||
services = {
|
||||
extraJobs = [{
|
||||
name = "nscd";
|
||||
config = {
|
||||
|
||||
users.extraUsers = singleton
|
||||
{ name = "nscd";
|
||||
uid = config.ids.uids.nscd;
|
||||
description = "Name service cache daemon user";
|
||||
};
|
||||
|
||||
jobs = singleton {
|
||||
name = "nscd";
|
||||
|
||||
users = [
|
||||
{ name = "nscd";
|
||||
uid = config.ids.uids.nscd;
|
||||
description = "Name service cache daemon user";
|
||||
}
|
||||
];
|
||||
|
||||
job = ''
|
||||
description \"Name Service Cache Daemon\"
|
||||
|
||||
start on startup
|
||||
stop on shutdown
|
||||
|
||||
env LD_LIBRARY_PATH=${nssModulesPath}
|
||||
|
||||
start script
|
||||
|
||||
mkdir -m 0755 -p /var/run/nscd
|
||||
mkdir -m 0755 -p /var/db/nscd
|
||||
|
||||
rm -f /var/db/nscd/* # for testing
|
||||
|
||||
end script
|
||||
|
||||
# !!! -d turns on debug info which probably makes nscd slower
|
||||
# 2>/dev/null is to make it shut up
|
||||
respawn ${pkgs.glibc}/sbin/nscd -f ${./nscd.conf} -d 2> /dev/null
|
||||
job = ''
|
||||
description \"Name Service Cache Daemon\"
|
||||
|
||||
start on startup
|
||||
stop on shutdown
|
||||
|
||||
env LD_LIBRARY_PATH=${nssModulesPath}
|
||||
|
||||
start script
|
||||
|
||||
mkdir -m 0755 -p /var/run/nscd
|
||||
mkdir -m 0755 -p /var/db/nscd
|
||||
|
||||
rm -f /var/db/nscd/* # for testing
|
||||
|
||||
end script
|
||||
|
||||
# !!! -d turns on debug info which probably makes nscd slower
|
||||
# 2>/dev/null is to make it shut up
|
||||
respawn ${pkgs.glibc}/sbin/nscd -f ${./nscd.conf} -d 2> /dev/null
|
||||
'';
|
||||
}];
|
||||
};
|
||||
|
||||
};
|
||||
}
|
||||
|
@ -13,15 +13,3 @@
|
||||
"eval \"$buildHook\"; ensureDir $out/etc/event.d; echo \"$job\" > $out/etc/event.d/$jobName"
|
||||
)
|
||||
)
|
||||
|
||||
//
|
||||
|
||||
{
|
||||
# Allow jobs to declare user accounts that should be created.
|
||||
users = if job ? users then job.users else [];
|
||||
|
||||
# Allow jobs to declare groups that should be created.
|
||||
groups = if job ? groups then job.groups else [];
|
||||
|
||||
passthru = if job ? passthru then job.passthru else {};
|
||||
}
|
||||
|
@ -87,12 +87,6 @@ in
|
||||
}
|
||||
];
|
||||
|
||||
users.extraUsers =
|
||||
pkgs.lib.concatLists (map (job: job.users) jobs);
|
||||
|
||||
users.extraGroups =
|
||||
pkgs.lib.concatLists (map (job: job.groups) jobs);
|
||||
|
||||
services.extraJobs =
|
||||
[ # For the built-in logd job.
|
||||
{ jobDrv = pkgs.upstart; }
|
||||
|
Loading…
Reference in New Issue
Block a user