2007-03-30 12:55:09 +00:00
|
|
|
{config, pkgs, upstartJobs, systemPath, wrapperDir, defaultShell, extraEtc}:
|
2006-12-11 15:32:10 +00:00
|
|
|
|
2007-01-16 16:09:43 +00:00
|
|
|
let
|
|
|
|
|
2007-06-10 20:02:07 +00:00
|
|
|
|
2007-01-16 16:09:43 +00:00
|
|
|
optional = option: file:
|
|
|
|
if config.get option then [file] else [];
|
|
|
|
|
2007-06-10 20:02:07 +00:00
|
|
|
|
|
|
|
# !!! ugh, these files shouldn't be created here.
|
|
|
|
|
|
|
|
|
2007-01-30 14:58:04 +00:00
|
|
|
envConf = pkgs.writeText "environment" "
|
2007-02-06 10:17:13 +00:00
|
|
|
PATH=${systemPath}/bin:${systemPath}/sbin:${pkgs.openssh}/bin
|
2007-03-01 15:31:05 +00:00
|
|
|
NIX_REMOTE=daemon
|
2007-06-10 20:02:07 +00:00
|
|
|
" /* ${pkgs.openssh}/bin is a hack to get remote scp to work */;
|
|
|
|
|
|
|
|
|
|
|
|
# Don't indent this file!
|
|
|
|
pamConsoleHandlers = pkgs.writeText "console.handlers" "
|
|
|
|
console consoledevs /dev/tty[0-9][0-9]* :[0-9]\.[0-9] :[0-9]
|
|
|
|
${pkgs.pam_console}/sbin/pam_console_apply lock logfail wait -t tty -s -c ${pamConsolePerms}
|
|
|
|
${pkgs.pam_console}/sbin/pam_console_apply unlock logfail wait -r -t tty -s -c ${pamConsolePerms}
|
|
|
|
";
|
|
|
|
|
|
|
|
pamConsolePerms = ./security/console.perms;
|
|
|
|
|
2007-01-26 15:32:49 +00:00
|
|
|
|
2007-01-16 16:09:43 +00:00
|
|
|
in
|
2007-06-10 20:02:07 +00:00
|
|
|
|
2007-01-16 16:09:43 +00:00
|
|
|
|
2006-12-11 15:32:10 +00:00
|
|
|
import ../helpers/make-etc.nix {
|
|
|
|
inherit (pkgs) stdenv;
|
|
|
|
|
|
|
|
configFiles = [
|
|
|
|
|
|
|
|
{ # TCP/UDP port assignments.
|
|
|
|
source = pkgs.iana_etc + "/etc/services";
|
|
|
|
target = "services";
|
|
|
|
}
|
|
|
|
|
|
|
|
{ # IP protocol numbers.
|
|
|
|
source = pkgs.iana_etc + "/etc/protocols";
|
|
|
|
target = "protocols";
|
|
|
|
}
|
|
|
|
|
|
|
|
{ # Hostname-to-IP mappings.
|
2007-03-30 12:59:43 +00:00
|
|
|
source = ./hosts;
|
2006-12-11 15:32:10 +00:00
|
|
|
target = "hosts";
|
|
|
|
}
|
|
|
|
|
|
|
|
{ # Name Service Switch configuration file. Required by the C library.
|
2007-03-30 12:59:43 +00:00
|
|
|
source = ./nsswitch.conf;
|
2006-12-11 15:32:10 +00:00
|
|
|
target = "nsswitch.conf";
|
|
|
|
}
|
|
|
|
|
|
|
|
{ # Configuration file for the system logging daemon.
|
2007-03-30 12:59:43 +00:00
|
|
|
source = ./syslog.conf;
|
2006-12-11 15:32:10 +00:00
|
|
|
target = "syslog.conf";
|
|
|
|
}
|
|
|
|
|
|
|
|
{ # Friendly greeting on the virtual consoles.
|
2007-03-30 12:59:43 +00:00
|
|
|
source = ./issue;
|
2006-12-11 15:32:10 +00:00
|
|
|
target = "issue";
|
|
|
|
}
|
|
|
|
|
|
|
|
{ # Configuration for pwdutils (login, passwd, useradd, etc.).
|
|
|
|
# You cannot login without it!
|
2007-03-30 12:59:43 +00:00
|
|
|
source = ./login.defs;
|
2006-12-11 15:32:10 +00:00
|
|
|
target = "login.defs";
|
|
|
|
}
|
|
|
|
|
|
|
|
{ # The Upstart events defined above.
|
|
|
|
source = upstartJobs + "/etc/event.d";
|
|
|
|
target = "event.d";
|
|
|
|
}
|
|
|
|
|
|
|
|
{ # Configuration for passwd and friends (e.g., hash algorithm
|
|
|
|
# for /etc/passwd).
|
2007-03-30 12:59:43 +00:00
|
|
|
source = ./default/passwd;
|
2006-12-11 15:32:10 +00:00
|
|
|
target = "default/passwd";
|
|
|
|
}
|
|
|
|
|
2007-03-20 13:30:14 +00:00
|
|
|
{ # Configuration for useradd.
|
|
|
|
source = pkgs.substituteAll {
|
2007-03-30 12:59:43 +00:00
|
|
|
src = ./default/useradd;
|
2007-03-20 13:30:14 +00:00
|
|
|
inherit defaultShell;
|
|
|
|
};
|
|
|
|
target = "default/useradd";
|
|
|
|
}
|
|
|
|
|
2006-12-22 17:28:25 +00:00
|
|
|
{ # Dhclient hooks for emitting ip-up/ip-down events.
|
|
|
|
source = pkgs.substituteAll {
|
2007-03-30 12:59:43 +00:00
|
|
|
src = ./dhclient-exit-hooks;
|
2007-01-23 10:22:00 +00:00
|
|
|
inherit (pkgs) upstart glibc;
|
2006-12-22 17:28:25 +00:00
|
|
|
};
|
|
|
|
target = "dhclient-exit-hooks";
|
|
|
|
}
|
2007-01-15 14:43:56 +00:00
|
|
|
|
|
|
|
{ # Script executed when the shell starts.
|
|
|
|
source = pkgs.substituteAll {
|
2007-03-30 12:59:43 +00:00
|
|
|
src = ./profile.sh;
|
2007-01-15 14:43:56 +00:00
|
|
|
inherit systemPath wrapperDir;
|
2007-09-28 11:14:39 +00:00
|
|
|
inherit (pkgs) systemKernel glibc;
|
2007-01-17 12:33:23 +00:00
|
|
|
timeZone = config.get ["time" "timeZone"];
|
2007-04-04 13:47:54 +00:00
|
|
|
defaultLocale = config.get ["i18n" "defaultLocale"];
|
2007-01-15 14:43:56 +00:00
|
|
|
};
|
|
|
|
target = "profile";
|
|
|
|
}
|
2007-01-16 16:09:43 +00:00
|
|
|
|
2007-05-02 09:55:35 +00:00
|
|
|
{ # Configuration for readline in bash.
|
|
|
|
source = ./inputrc;
|
|
|
|
target = "inputrc";
|
|
|
|
}
|
|
|
|
|
2006-12-11 15:32:10 +00:00
|
|
|
]
|
|
|
|
|
2007-01-22 16:42:29 +00:00
|
|
|
# Configuration file for fontconfig used to locate
|
|
|
|
# (X11) client-rendered fonts.
|
|
|
|
++ (optional ["fonts" "enableFontConfig"] {
|
|
|
|
source = pkgs.runCommand "fonts.conf"
|
|
|
|
{
|
2007-09-25 19:00:20 +00:00
|
|
|
fontDirectories = import ../system/fonts.nix {inherit pkgs config;};
|
2007-01-22 16:42:29 +00:00
|
|
|
buildInputs = [pkgs.libxslt];
|
|
|
|
inherit (pkgs) fontconfig;
|
|
|
|
}
|
|
|
|
"xsltproc --stringparam fontDirectories \"$fontDirectories\" \\
|
2007-10-05 12:56:44 +00:00
|
|
|
--stringparam fontconfig \"$fontconfig\" \\
|
2007-03-30 12:59:43 +00:00
|
|
|
${./fonts/make-fonts-conf.xsl} $fontconfig/etc/fonts/fonts.conf \\
|
2007-01-22 16:42:29 +00:00
|
|
|
> $out
|
|
|
|
";
|
|
|
|
target = "fonts/fonts.conf";
|
|
|
|
})
|
|
|
|
|
2007-01-16 16:09:43 +00:00
|
|
|
# LDAP configuration.
|
|
|
|
++ (optional ["users" "ldap" "enable"] {
|
2007-04-10 14:10:45 +00:00
|
|
|
source = import ./ldap.conf.nix {
|
2007-01-16 16:09:43 +00:00
|
|
|
inherit (pkgs) writeText;
|
|
|
|
inherit config;
|
|
|
|
};
|
|
|
|
target = "ldap.conf";
|
|
|
|
})
|
|
|
|
|
2007-08-16 15:09:06 +00:00
|
|
|
# "sudo" configuration.
|
|
|
|
++ (optional ["security" "sudo" "enable"] {
|
|
|
|
source = pkgs.runCommand "sudoers"
|
|
|
|
{ src = pkgs.writeText "sudoers-in" (config.get ["security" "sudo" "configFile"]);
|
|
|
|
}
|
|
|
|
# Make sure that the sudoers file is syntactically valid.
|
|
|
|
"${pkgs.sudo}/sbin/visudo -f $src -c && cp $src $out";
|
|
|
|
target = "sudoers";
|
|
|
|
mode = "0440";
|
|
|
|
})
|
|
|
|
|
2006-12-11 15:32:10 +00:00
|
|
|
# A bunch of PAM configuration files for various programs.
|
|
|
|
++ (map
|
|
|
|
(program:
|
2007-06-10 20:02:07 +00:00
|
|
|
let isLDAPEnabled = config.get ["users" "ldap" "enable"]; in
|
2006-12-11 15:32:10 +00:00
|
|
|
{ source = pkgs.substituteAll {
|
2007-03-30 12:59:43 +00:00
|
|
|
src = ./pam.d + ("/" + program);
|
2007-06-10 20:02:07 +00:00
|
|
|
inherit (pkgs) pam_unix2 pam_console;
|
2007-01-16 16:09:43 +00:00
|
|
|
pam_ldap =
|
2007-06-10 20:02:07 +00:00
|
|
|
if isLDAPEnabled
|
2007-01-16 16:09:43 +00:00
|
|
|
then pkgs.pam_ldap
|
|
|
|
else "/no-such-path";
|
2007-01-16 22:25:28 +00:00
|
|
|
inherit (pkgs.xorg) xauth;
|
2007-06-10 20:02:07 +00:00
|
|
|
inherit envConf pamConsoleHandlers;
|
|
|
|
isLDAPEnabled = if isLDAPEnabled then "" else "#";
|
2006-12-11 15:32:10 +00:00
|
|
|
};
|
|
|
|
target = "pam.d/" + program;
|
|
|
|
}
|
|
|
|
)
|
|
|
|
[
|
|
|
|
"login"
|
2007-06-05 11:28:18 +00:00
|
|
|
"slim"
|
2007-01-11 15:32:48 +00:00
|
|
|
"su"
|
2007-07-09 11:21:04 +00:00
|
|
|
"sudo"
|
2006-12-16 21:48:12 +00:00
|
|
|
"other"
|
2006-12-11 15:32:10 +00:00
|
|
|
"passwd"
|
2006-12-16 21:48:12 +00:00
|
|
|
"shadow"
|
|
|
|
"sshd"
|
2006-12-11 15:32:10 +00:00
|
|
|
"useradd"
|
2007-02-26 21:18:13 +00:00
|
|
|
"chsh"
|
2007-01-30 15:03:43 +00:00
|
|
|
"common"
|
2007-06-10 20:02:07 +00:00
|
|
|
"common-console" # shared stuff for interactive local sessions
|
2006-12-11 15:32:10 +00:00
|
|
|
]
|
2007-03-30 12:55:09 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
# Additional /etc files declared by Upstart jobs.
|
|
|
|
++ extraEtc;
|
|
|
|
|
2007-02-26 21:18:13 +00:00
|
|
|
}
|