2007-03-30 13:55:09 +01: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.
|
2007-03-30 13:59:43 +01: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 13:59:43 +01: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 13:59:43 +01:00
|
|
|
source = ./syslog.conf;
|
2006-12-11 15:32:10 +00:00
|
|
|
target = "syslog.conf";
|
|
|
|
}
|
|
|
|
|
|
|
|
{ # Friendly greeting on the virtual consoles.
|
2007-03-30 13:59:43 +01: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 13:59:43 +01: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 13:59:43 +01: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 13:59:43 +01: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 13:59:43 +01: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 13:59:43 +01:00
|
|
|
src = ./profile.sh;
|
2007-01-15 14:43:56 +00:00
|
|
|
inherit systemPath wrapperDir;
|
2007-03-29 18:46:36 +01:00
|
|
|
inherit (pkgs) kernel glibc;
|
2007-01-17 12:33:23 +00:00
|
|
|
timeZone = config.get ["time" "timeZone"];
|
2007-04-04 14:47:54 +01: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 10:55:35 +01: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-03-30 13:59:43 +01:00
|
|
|
fontDirectories = import ../system/fonts.nix {inherit pkgs;};
|
2007-01-22 16:42:29 +00:00
|
|
|
buildInputs = [pkgs.libxslt];
|
|
|
|
inherit (pkgs) fontconfig;
|
|
|
|
}
|
|
|
|
"xsltproc --stringparam fontDirectories \"$fontDirectories\" \\
|
2007-03-30 13:59:43 +01: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 15:10:45 +01:00
|
|
|
source = import ./ldap.conf.nix {
|
2007-01-16 16:09:43 +00:00
|
|
|
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 {
|
2007-03-30 13:59:43 +01:00
|
|
|
src = ./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 13:55:09 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
# Additional /etc files declared by Upstart jobs.
|
|
|
|
++ extraEtc;
|
|
|
|
|
2007-02-26 21:18:13 +00:00
|
|
|
}
|