* Continued refactoring the tree: moved most Upstart jobs (namely

those that run daemons) to modules/services.  This probably broke
  some things since there are a few relative paths in modules
  (e.g. imports of system/ids.nix).
* Moved some PAM modules out of etc/pam.d to the directories of NixOS
  modules that use them.

svn path=/nixos/branches/modular-nixos/; revision=15717
This commit is contained in:
Eelco Dolstra 2009-05-24 23:13:23 +00:00
parent f86e2e5d01
commit 5ebdee3577
91 changed files with 140 additions and 315 deletions

View file

@ -34,7 +34,7 @@ let
# not used (e.g., doesn't own any devices).
group = {
name = "audio";
gid = (import ../system/ids.nix).gids.audio;
gid = (import ../../../system/ids.nix).gids.audio;
};
job = {
@ -72,7 +72,7 @@ in
mkIf config.sound.enable {
require = [
../upstart-jobs/default.nix # config.services.extraJobs
# ../upstart-jobs/default.nix # config.services.extraJobs
# ../system/user.nix # users.*
# ? # config.environment.extraPackages
options

View file

@ -4,8 +4,8 @@
let
inherit (pkgs.lib) mkOption mkIf;
uid = (import ../system/ids.nix).uids.pulseaudio;
gid = (import ../system/ids.nix).gids.pulseaudio;
uid = (import ../../../system/ids.nix).uids.pulseaudio;
gid = (import ../../../system/ids.nix).gids.pulseaudio;
options = {
services = {

View file

@ -36,13 +36,13 @@ let
user = {
name = "haldaemon";
uid = (import ../system/ids.nix).uids.haldaemon;
uid = (import ../../../system/ids.nix).uids.haldaemon;
description = "HAL daemon user";
};
group = {
name = "haldaemon";
gid = (import ../system/ids.nix).gids.haldaemon;
gid = (import ../../../system/ids.nix).gids.haldaemon;
};
fdi =
@ -87,10 +87,10 @@ in
mkIf cfg.enable {
require = [
../upstart-jobs/default.nix # config.services.extraJobs
# ../upstart-jobs/default.nix # config.services.extraJobs
# ../system/user.nix # users.*
# ../upstart-jobs/udev.nix # services.udev.*
../upstart-jobs/dbus.nix # services.dbus.*
# ../upstart-jobs/dbus.nix # services.dbus.*
# ? # config.environment.extraPackages
options
];

View file

@ -44,7 +44,7 @@ let
startingDependency = if config.services.gw6c.enable then "gw6c" else "network-interfaces";
cfg = config.services.dovecot;
idList = import ../system/ids.nix;
idList = import ../../../system/ids.nix;
dovecotConf =
''

View file

@ -156,7 +156,7 @@ let
user = cfg.user;
group = cfg.group;
setgidGroup = cfg.setgidGroup;
idList = import ../system/ids.nix;
idList = import ../../../system/ids.nix;
optionalString = pkgs.lib.optionalString;
concatStringsSep = pkgs.lib.concatStringsSep;

View file

@ -48,8 +48,8 @@ in
mkIf cfg.enable {
require = [
../upstart-jobs/default.nix
../upstart-jobs/dbus.nix # services.dbus.*
#../upstart-jobs/default.nix
#../upstart-jobs/dbus.nix # services.dbus.*
options
];

View file

@ -78,7 +78,7 @@ mkIf enable {
services = {
extraJobs = [{
name = "showManual";
name = "nixos-manual";
job = ''
description "NixOS manual"

View file

@ -137,7 +137,7 @@ let
user = {
name = nagiosUser;
uid = (import ../../system/ids.nix).uids.nagios;
uid = (import ../../../../system/ids.nix).uids.nagios;
description = "Nagios monitoring daemon";
home = nagiosState;
};
@ -175,7 +175,7 @@ in
mkIf cfg.enable {
require = [
../../upstart-jobs/default.nix # config.services.extraJobs
# ../../upstart-jobs/default.nix # config.services.extraJobs
# ../../system/user.nix # users = { .. }
# ? # config.environment.etc
# ? # config.environment.extraPackages

View file

@ -52,7 +52,7 @@ let
user = {
name = "zabbix";
uid = (import ../system/ids.nix).uids.zabbix;
uid = (import ../../../system/ids.nix).uids.zabbix;
description = "Zabbix daemon user";
};
@ -93,7 +93,7 @@ in
{
require = [
../upstart-jobs/default.nix
# ../upstart-jobs/default.nix
# ../system/user.nix # users = { .. }
options
];

View file

@ -42,7 +42,7 @@ let
user = {
name = "zabbix";
uid = (import ../system/ids.nix).uids.zabbix;
uid = (import ../../../system/ids.nix).uids.zabbix;
description = "Zabbix daemon user";
};
@ -86,7 +86,7 @@ in
{
require = [
../upstart-jobs/default.nix
# ../upstart-jobs/default.nix
# ../system/user.nix # users = { .. }
options
];

View file

@ -120,12 +120,12 @@ in
mkIf cfg.enable {
require = [
../upstart-jobs/default.nix # config.services.extraJobs
# ../upstart-jobs/default.nix # config.services.extraJobs
# ../system/? # system.nssModules
# ? # config.environment.etc
# ../system/user.nix # users.*
# ../upstart-jobs/udev.nix # services.udev.*
../upstart-jobs/dbus.nix # services.dbus.*
# ../upstart-jobs/dbus.nix # services.dbus.*
# ? # config.environment.extraPackages
options
];
@ -138,14 +138,17 @@ mkIf cfg.enable {
extraPackages = [avahi];
# Name Service Switch configuration file. Required by the C library.
# !!! This should be done in some other way, e.g., this module
# should define an option used by the hypothetical module that
# generates nsswitch.conf.
etc = mkIf cfg.nssmdns (mkThenElse {
thenPart = [{
source = ../etc/nsswitch-mdns.conf;
source = ../../../etc/nsswitch-mdns.conf;
target = "nsswitch.conf";
}];
elsePart = [{
source = ../etc/nsswitch.conf;
source = ../../../etc/nsswitch.conf;
target = "nsswitch.conf";
}];
});

View file

@ -55,7 +55,7 @@ in
{
require = [
../upstart-jobs/default.nix
#../upstart-jobs/default.nix
options
];

View file

@ -72,7 +72,7 @@ mkIf config.services.ntp.enable {
users = [
{ name = ntpUser;
uid = (import ../system/ids.nix).uids.ntp;
uid = (import ../../../system/ids.nix).uids.ntp;
description = "NTP daemon user";
home = stateDir;
}

View file

@ -37,8 +37,8 @@ in
###### implementation
let uid = (import ../system/ids.nix).uids.portmap;
gid = (import ../system/ids.nix).gids.portmap;
let uid = (import ../../../system/ids.nix).uids.portmap;
gid = (import ../../../system/ids.nix).gids.portmap;
in
mkIf config.services.portmap.enable {

View file

@ -85,7 +85,7 @@ let
'';
sshdUid = (import ../system/ids.nix).uids.sshd;
sshdUid = (import ../../../../system/ids.nix).uids.sshd;
# !!! is this assertion evaluated anywhere???
assertion = cfg.permitRootLogin == "yes" ||
@ -104,7 +104,7 @@ mkIf config.services.sshd.enable {
users = {
extraUsers = [
{ name = "sshd";
uid = (import ../system/ids.nix).uids.sshd;
uid = (import ../../../../system/ids.nix).uids.sshd;
description = "SSH privilege separation user";
home = "/var/empty";
}

View file

@ -95,13 +95,13 @@ mkIf config.services.vsftpd.enable {
users = {
extraUsers = [
{ name = "vsftpd";
uid = (import ../system/ids.nix).uids.vsftpd;
uid = (import ../../../system/ids.nix).uids.vsftpd;
description = "VSFTPD user";
home = "/homeless-shelter";
}
] ++ pkgs.lib.optional anonymousUser
{ name = "ftp";
uid = (import ../system/ids.nix).uids.ftp;
uid = (import ../../../system/ids.nix).uids.ftp;
group = "ftp";
description = "Anonymous ftp user";
home = "/home/ftp";
@ -109,7 +109,7 @@ mkIf config.services.vsftpd.enable {
extraGroups = [
{ name = "ftp";
gid = (import ../system/ids.nix).gids.ftp;
gid = (import ../../../system/ids.nix).gids.ftp;
}
];

View file

@ -37,14 +37,14 @@ let
user = {
name = "atd";
uid = (import ../system/ids.nix).uids.atd;
uid = (import ../../../system/ids.nix).uids.atd;
description = "atd user";
home = "/var/empty";
};
group = {
name = "atd";
gid = (import ../system/ids.nix).gids.atd;
gid = (import ../../../system/ids.nix).gids.atd;
};
job = ''
@ -95,13 +95,13 @@ mkIf cfg.enable {
options
# config.services.extraJobs
../upstart-jobs/default.nix
#../upstart-jobs/default.nix
# config.environment.etc
../etc/default.nix
#../etc/default.nix
# users.*
../system/users-groups.nix
#../system/users-groups.nix
# ? # config.environment.extraPackages
# ? # config.security.extraSetuidPrograms
@ -121,7 +121,7 @@ mkIf cfg.enable {
extraPackages = [ at ];
etc = [{
source = ../etc/pam.d/atd;
source = ./atd.pam;
target = "pam.d/atd";
}];
};

View file

@ -54,7 +54,7 @@ in
{
require = [
../upstart-jobs/default.nix # config.services.extraJobs
# ../upstart-jobs/default.nix # config.services.extraJobs
# ? # config.time.timeZone
# ? # config.environment.etc
# ? # config.environment.extraPackages

View file

@ -43,8 +43,8 @@ in
mkIf cfg.enable {
require = [
../upstart-jobs/default.nix # config.services.extraJobs
../upstart-jobs/dbus.nix # services.dbus.*
#../upstart-jobs/default.nix # config.services.extraJobs
#../upstart-jobs/dbus.nix # services.dbus.*
options
];

View file

@ -55,7 +55,7 @@ let
user = {
name = "messagebus";
uid = (import ../system/ids.nix).uids.messagebus;
uid = (import ../../../system/ids.nix).uids.messagebus;
description = "D-Bus system message bus daemon user";
home = homeDir;
};
@ -96,7 +96,7 @@ in
mkIf cfg.enable {
require = [
../upstart-jobs/default.nix # config.services.extraJobs
# ../upstart-jobs/default.nix # config.services.extraJobs
# ../system/user.nix # users.*
# ? # config.environment.extraPackages
options

View file

@ -13,7 +13,7 @@ in
users = [
{ name = "nscd";
uid = (import ../system/ids.nix).uids.nscd;
uid = (import ../../../system/ids.nix).uids.nscd;
description = "Name service cache daemon user";
}
];

View file

@ -47,7 +47,7 @@ in
mkIf cfg.enable {
require = [
../upstart-jobs/default.nix # config.services.extraJobs
# ../upstart-jobs/default.nix # config.services.extraJobs
# /etc/security/console.perms (should be generated ?)
options
];

View file

@ -195,7 +195,7 @@ let
};
} // # Include the options shared between the main server and virtual hosts.
(import ../../upstart-jobs/apache-httpd/per-server-options.nix {
(import ./per-server-options.nix {
inherit mkOption;
forMainServer = true;
});

View file

@ -73,13 +73,13 @@ mkIf config.services.tomcat.enable {
groups = [
{ name = "tomcat";
gid = (import ../system/ids.nix).gids.tomcat;
gid = (import ../../../system/ids.nix).gids.tomcat;
}
];
users = [
{ name = "tomcat";
uid = (import ../system/ids.nix).uids.tomcat;
uid = (import ../../../system/ids.nix).uids.tomcat;
description = "Tomcat user";
home = "/homeless-shelter";
}

View file

@ -475,13 +475,13 @@ mkIf cfg.enable {
./desktopManager/default.nix
# services.extraJobs
../../upstart-jobs/default.nix
# ../../upstart-jobs/default.nix
# environment.etc
../../etc/default.nix
# ../../etc/default.nix
# fonts.fonts
../../system/fonts.nix
# ../../system/fonts.nix
# boot.extraModulePackages
# security.extraSetuidPrograms

View file

@ -68,7 +68,7 @@ mkIf cfg.enable {
];
etc = [
{ source = ../../../etc/pam.d/kde;
{ source = ./kde.pam;
target = "pam.d/kde";
}
{ source = "${pkgs.xkeyboard_config}/etc/X11/xkb";

View file

@ -64,7 +64,7 @@ mkIf cfg.enable {
];
etc = [
{ source = ../../../etc/pam.d/kde;
{ source = ./kde.pam;
target = "pam.d/kde";
}
{ source = "${pkgs.xkeyboard_config}/etc/X11/xkb";

View file

@ -131,7 +131,7 @@ mkIf cfg.enable {
environment = {
etc = [
{ source = ../../../etc/pam.d/slim;
{ source = ./slim.pam;
target = "pam.d/slim";
}
];

View file

@ -42,7 +42,7 @@ in
activateLib = removeAttrs withHeadlines ["activate"];
activateLibNames = attrNames activateLib;
in {
script = pkgs.writeScript "activationScript"
script = pkgs.writeScript "nixos-activation-script"
("#!/bin/sh\n"
+ textClosureMap id activateLib activateLibNames + "\n"
# make sure that the activate snippet is added last.

View file

@ -379,133 +379,89 @@ in
};
require = [
../system/assertion.nix
# boot (is it the right place ?)
../system/kernel.nix
#../modules/hardware/network/intel-3945abg.nix
../boot/boot-stage-2.nix
../installer/grub.nix
# system
../system/system-options.nix
../system/activate-configuration.nix
../upstart-jobs/default.nix
../upstart-jobs/acpid.nix # ACPI daemon
../system/unix-odbc-drivers.nix
../upstart-jobs/klogd.nix
../upstart-jobs/lvm.nix # Makes LVM logical volumes available.
../upstart-jobs/swraid.nix # Activate software RAID arrays.
../upstart-jobs/filesystems.nix # Mount file systems.
../upstart-jobs/swap.nix
../upstart-jobs/network-interfaces.nix
../upstart-jobs/nscd.nix # Name service cache daemon.
../upstart-jobs/maintenance-shell.nix # Handles the maintenance/stalled event (single-user shell).
../upstart-jobs/ctrl-alt-delete.nix # Ctrl-alt-delete action.
../upstart-jobs/halt.nix
../upstart-jobs/ifplugd.nix # ifplugd daemon for monitoring Ethernet cables.
# security
../system/sudo.nix
# i18n
../system/i18n.nix
# environment
../etc/default.nix
../system/nixos-environment.nix
# users
../system/users-groups.nix
# newtworking
../upstart-jobs/dhclient.nix
# hardware
../upstart-jobs/pcmcia.nix
# security
../system/nixos-security.nix
# services
../upstart-jobs/avahi-daemon.nix
../upstart-jobs/atd.nix
../upstart-jobs/dbus.nix
../upstart-jobs/hal.nix
../upstart-jobs/gpm.nix
../upstart-jobs/nagios/default.nix
../upstart-jobs/xserver/default.nix
../upstart-jobs/zabbix-agent.nix
../upstart-jobs/zabbix-server.nix
../upstart-jobs/disnix.nix
../upstart-jobs/consolekit.nix
../upstart-jobs/cron.nix
../upstart-jobs/fcron.nix
../upstart-jobs/cron/locate.nix
../upstart-jobs/manual.nix
../upstart-jobs/rogue.nix
../upstart-jobs/guest-users.nix
../upstart-jobs/pulseaudio.nix
../upstart-jobs/kbd.nix
../upstart-jobs/gw6c.nix # Gateway6
../upstart-jobs/syslogd.nix
../upstart-jobs/dhcpd.nix
../upstart-jobs/sshd.nix
../upstart-jobs/lshd.nix # GNU lshd SSH2 deamon (TODO: does neither start nor generate seed file ?)
../upstart-jobs/ntpd.nix
../upstart-jobs/portmap.nix
../upstart-jobs/bitlbee.nix
../upstart-jobs/gnunet.nix
../upstart-jobs/ejabberd.nix # untested, dosen't compile on x86_64-linux
../upstart-jobs/jboss.nix
../upstart-jobs/tomcat.nix # untested, too lazy to get that jdk
../upstart-jobs/httpd.nix # Apache httpd (probably this can be removed ?)
../upstart-jobs/apache-httpd # Apache httpd (new style).
../upstart-jobs/vsftpd.nix
../upstart-jobs/cupsd.nix # CUPS printing daemon
../upstart-jobs/udev.nix # The udev daemon creates devices nodes and runs programs when hardware events occur.
../upstart-jobs/samba.nix # TODO: doesn't start here (?)
../upstart-jobs/ircd-hybrid.nix # TODO: doesn't compile on x86_64-linux, can't test
../upstart-jobs/xfs.nix
../upstart-jobs/mysql.nix
../upstart-jobs/postgresql.nix
../upstart-jobs/openfire.nix
../upstart-jobs/postfix.nix
../upstart-jobs/dovecot.nix
../upstart-jobs/bind.nix
../upstart-jobs/mingetty.nix # The terminals on ttyX.
../upstart-jobs/tty-backgrounds.nix
../upstart-jobs/synergy.nix
../upstart-jobs/openvpn.nix
../upstart-jobs/nfs-kernel.nix
../upstart-jobs/autofs.nix
# nix
../upstart-jobs/nix.nix # nix options and daemon
../system/nixos-installer.nix
#users
../upstart-jobs/ldap
# fonts
../installer/grub.nix
../modules/services/audio/alsa.nix
../modules/services/audio/pulseaudio.nix
../modules/services/databases/mysql.nix
../modules/services/databases/postgresql.nix
../modules/services/hardware/acpid.nix
../modules/services/hardware/hal.nix
../modules/services/hardware/udev.nix
../modules/services/logging/klogd.nix
../modules/services/logging/syslogd.nix
../modules/services/mail/dovecot.nix
../modules/services/mail/postfix.nix
../modules/services/misc/autofs.nix
../modules/services/misc/disnix.nix
../modules/services/misc/nix-daemon.nix
../modules/services/misc/nixos-manual.nix
../modules/services/misc/rogue.nix
../modules/services/misc/synergy.nix
../modules/services/monitoring/nagios/default.nix
../modules/services/monitoring/zabbix-agent.nix
../modules/services/monitoring/zabbix-server.nix
../modules/services/network-filesystems/nfs-kernel.nix
../modules/services/network-filesystems/samba.nix # TODO: doesn't start here (?)
../modules/services/networking/avahi-daemon.nix
../modules/services/networking/bind.nix
../modules/services/networking/bitlbee.nix
../modules/services/networking/dhclient.nix
../modules/services/networking/dhcpd.nix
../modules/services/networking/ejabberd.nix # untested, dosen't compile on x86_64-linux
../modules/services/networking/gnunet.nix
../modules/services/networking/gw6c.nix
../modules/services/networking/ifplugd.nix
../modules/services/networking/ircd-hybrid.nix # TODO: doesn't compile on x86_64-linux, can't test
../modules/services/networking/ntpd.nix
../modules/services/networking/openfire.nix
../modules/services/networking/openvpn.nix
../modules/services/networking/portmap.nix
../modules/services/networking/ssh/lshd.nix # GNU lshd SSH2 deamon (TODO: does neither start nor generate seed file ?)
../modules/services/networking/ssh/sshd.nix
../modules/services/networking/vsftpd.nix
../modules/services/printing/cupsd.nix
../modules/services/scheduling/atd.nix
../modules/services/scheduling/cron.nix
../modules/services/scheduling/fcron.nix
../modules/services/system/consolekit.nix
../modules/services/system/dbus.nix
../modules/services/system/nscd.nix
../modules/services/ttys/gpm.nix
../modules/services/ttys/mingetty.nix
../modules/services/web-servers/apache-httpd
../modules/services/web-servers/jboss.nix
../modules/services/web-servers/tomcat.nix # untested, too lazy to get that jdk
../modules/services/x11/xfs.nix
../modules/services/x11/xserver/default.nix
../system/activate-configuration.nix
../system/assertion.nix
../system/fonts.nix
# sound
../upstart-jobs/alsa.nix
../system/i18n.nix
../system/kernel.nix
../system/nixos-environment.nix
../system/nixos-installer.nix
../system/nixos-security.nix
../system/sudo.nix
../system/system-options.nix
../system/unix-odbc-drivers.nix
../system/users-groups.nix
../upstart-jobs/cron/locate.nix
../upstart-jobs/ctrl-alt-delete.nix
../upstart-jobs/default.nix
../upstart-jobs/filesystems.nix
../upstart-jobs/guest-users.nix
../upstart-jobs/halt.nix
../upstart-jobs/kbd.nix
../upstart-jobs/ldap
../upstart-jobs/lvm.nix
../upstart-jobs/maintenance-shell.nix
../upstart-jobs/network-interfaces.nix
../upstart-jobs/pcmcia.nix
../upstart-jobs/swap.nix
../upstart-jobs/swraid.nix
../upstart-jobs/tty-backgrounds.nix
];
}

View file

@ -45,7 +45,7 @@ in
{
require = [
../../upstart-jobs/cron.nix # config.services.cron
# ../../upstart-jobs/cron.nix # config.services.cron
options
];

View file

@ -1,134 +0,0 @@
{pkgs, config, ...}:
###### interface
let
inherit (pkgs.lib) mkOption mkIf;
# options have been moved to the apache-httpd/default.nix file
in
###### implementation
let
cfg = config.services.httpd;
cfgSvn = cfg.subservices.subversion;
optional = pkgs.lib.optional;
documentRoot = cfg.documentRoot;
hostName = cfg.hostName;
httpPort = cfg.port;
httpsPort = 443;
user = cfg.user;
group = cfg.group;
adminAddr = cfg.adminAddr;
logDir = cfg.logDir;
stateDir = cfg.stateDir;
enableSSL = false;
applicationMappings = cfg.mod_jk.applicationMappings;
startingDependency = if config.services.gw6c.enable && config.services.gw6c.autorun then "gw6c" else "network-interfaces";
extraConfig = pkgs.lib.concatStringsSep "\n"
(pkgs.lib.catAttrs "extraHttpdConfig" config.services.extraJobs);
webServer = import ../../services/apache-httpd {
inherit (pkgs) apacheHttpd coreutils;
stdenv = pkgs.stdenv;
php = if cfg.mod_php then pkgs.php else null;
tomcat_connectors = if cfg.mod_jk.enable then pkgs.tomcat_connectors else null;
inherit documentRoot hostName httpPort httpsPort
user group adminAddr logDir stateDir
applicationMappings;
noUserDir = !cfg.enableUserDir;
extraDirectories = extraConfig + "\n" + cfg.extraConfig;
subServices =
# The Subversion subservice.
(optional cfgSvn.enable (
let dataDir = cfgSvn.dataDir; in
import ../../services/subversion ({
reposDir = dataDir + "/repos";
dbDir = dataDir + "/db";
distsDir = dataDir + "/dist";
backupsDir = dataDir + "/backup";
tmpDir = dataDir + "/tmp";
inherit user group logDir adminAddr;
canonicalName =
if webServer.enableSSL then
"https://" + hostName + ":" + (toString httpsPort)
else
"http://" + hostName + ":" + (toString httpPort);
notificationSender = cfgSvn.notificationSender;
autoVersioning = cfgSvn.autoVersioning;
userCreationDomain = cfgSvn.userCreationDomain;
inherit pkgs;
} //
( if cfgSvn.organization.name != null then
{
orgName = cfgSvn.organization.name;
orgLogoFile = cfgSvn.organization.logo;
orgUrl = cfgSvn.organization.url;
}
else
# use the default from the subversion service
{}
)
)
)
);
};
in
mkIf (config.services.httpd.enable && !config.services.httpd.experimental) {
require = [
# options have been moved to the apache-httpd/default.nix file
];
users = {
extraUsers = [
{ name = user;
description = "Apache httpd user";
}
];
extraGroups = [
{ name = group;
}
];
};
services = {
extraJobs = [{
name = "httpd";
job = ''
description \"Apache HTTPD\"
start on ${startingDependency}/started
stop on ${startingDependency}/stop
start script
${webServer}/bin/control prepare
end script
respawn ${webServer}/bin/control run
'';
}];
};
}