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
|
|
|
|
|
|
|
|
optional = option: file:
|
|
|
|
if config.get option then [file] else [];
|
|
|
|
|
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-02-06 10:17:13 +00:00
|
|
|
" /* ${pkgs.openssh}/bin is a hack to get remote scp to work */;
|
2007-01-26 15:32:49 +00:00
|
|
|
|
2007-01-16 16:09:43 +00:00
|
|
|
in
|
|
|
|
|
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.
|
|
|
|
source = ./etc/hosts;
|
|
|
|
target = "hosts";
|
|
|
|
}
|
|
|
|
|
|
|
|
{ # Name Service Switch configuration file. Required by the C library.
|
|
|
|
source = ./etc/nsswitch.conf;
|
|
|
|
target = "nsswitch.conf";
|
|
|
|
}
|
|
|
|
|
|
|
|
{ # Configuration file for the system logging daemon.
|
|
|
|
source = ./etc/syslog.conf;
|
|
|
|
target = "syslog.conf";
|
|
|
|
}
|
|
|
|
|
|
|
|
{ # Friendly greeting on the virtual consoles.
|
|
|
|
source = ./etc/issue;
|
|
|
|
target = "issue";
|
|
|
|
}
|
|
|
|
|
|
|
|
{ # Configuration for pwdutils (login, passwd, useradd, etc.).
|
|
|
|
# You cannot login without it!
|
|
|
|
source = ./etc/login.defs;
|
|
|
|
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).
|
|
|
|
source = ./etc/default/passwd;
|
|
|
|
target = "default/passwd";
|
|
|
|
}
|
|
|
|
|
2007-03-20 13:30:14 +00:00
|
|
|
{ # Configuration for useradd.
|
|
|
|
source = pkgs.substituteAll {
|
|
|
|
src = ./etc/default/useradd;
|
|
|
|
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 {
|
|
|
|
src = ./etc/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 {
|
|
|
|
src = ./etc/profile.sh;
|
|
|
|
inherit systemPath wrapperDir;
|
2007-03-29 17:46:36 +00:00
|
|
|
inherit (pkgs) kernel glibc;
|
2007-01-17 12:33:23 +00:00
|
|
|
timeZone = config.get ["time" "timeZone"];
|
2007-01-15 14:43:56 +00:00
|
|
|
};
|
|
|
|
target = "profile";
|
|
|
|
}
|
2007-01-16 16:09:43 +00:00
|
|
|
|
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-02-25 15:53:57 +00:00
|
|
|
fontDirectories = import ./fonts.nix {inherit pkgs;};
|
2007-01-22 16:42:29 +00:00
|
|
|
buildInputs = [pkgs.libxslt];
|
|
|
|
inherit (pkgs) fontconfig;
|
|
|
|
}
|
|
|
|
"xsltproc --stringparam fontDirectories \"$fontDirectories\" \\
|
|
|
|
${./etc/fonts/make-fonts-conf.xsl} $fontconfig/etc/fonts/fonts.conf \\
|
|
|
|
> $out
|
|
|
|
";
|
|
|
|
target = "fonts/fonts.conf";
|
|
|
|
})
|
|
|
|
|
2007-01-16 16:09:43 +00:00
|
|
|
# LDAP configuration.
|
|
|
|
++ (optional ["users" "ldap" "enable"] {
|
|
|
|
source = import etc/ldap.conf.nix {
|
|
|
|
inherit (pkgs) writeText;
|
|
|
|
inherit config;
|
|
|
|
};
|
|
|
|
target = "ldap.conf";
|
|
|
|
})
|
|
|
|
|
2006-12-11 15:32:10 +00:00
|
|
|
# A bunch of PAM configuration files for various programs.
|
|
|
|
++ (map
|
|
|
|
(program:
|
|
|
|
{ source = pkgs.substituteAll {
|
|
|
|
src = ./etc/pam.d + ("/" + program);
|
2007-01-16 16:09:43 +00:00
|
|
|
inherit (pkgs) pam_unix2;
|
|
|
|
pam_ldap =
|
|
|
|
if config.get ["users" "ldap" "enable"]
|
|
|
|
then pkgs.pam_ldap
|
|
|
|
else "/no-such-path";
|
2007-01-16 22:25:28 +00:00
|
|
|
inherit (pkgs.xorg) xauth;
|
2007-01-30 14:58:04 +00:00
|
|
|
inherit envConf;
|
2006-12-11 15:32:10 +00:00
|
|
|
};
|
|
|
|
target = "pam.d/" + program;
|
|
|
|
}
|
|
|
|
)
|
|
|
|
[
|
|
|
|
"login"
|
2007-01-11 15:32:48 +00:00
|
|
|
"su"
|
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"
|
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
|
|
|
}
|