* Move the /etc generation to modules/system/etc.

svn path=/nixos/branches/modular-nixos/; revision=15767
This commit is contained in:
Eelco Dolstra 2009-05-28 13:17:56 +00:00
parent 14f1c81822
commit 3c84d56273
6 changed files with 35 additions and 41 deletions

View file

@ -1,6 +1,5 @@
{
require = [
../etc/default.nix
../system/assertion.nix
../system/nixos-environment.nix
../system/nixos-installer.nix

View file

@ -117,6 +117,7 @@
./system/boot/kernel.nix
./system/boot/stage-1.nix
./system/boot/stage-2.nix
./system/etc/etc.nix
./system/upstart-events/ctrl-alt-delete.nix
./system/upstart-events/halt.nix
./system/upstart-events/maintenance-shell.nix

View file

@ -3,7 +3,26 @@
{config, pkgs, ...}:
let
options = {
environment.shellInit = pkgs.lib.mkOption {
default = "";
example = ''export PATH=/godi/bin/:$PATH'';
description = "
Script used to initialized user shell environments.
";
merge = pkgs.lib.mergeStringOption;
};
};
in
{
require = [options];
environment.etc =
[ { # /etc/bashrc: script executed when the shell starts as a
# non-login shell. /etc/profile also sources this file, so

View file

@ -6,41 +6,23 @@ let
inherit (pkgs.lib) mkOption;
option = {
environment = {
etc = mkOption {
default = [];
example = [
{ source = "/nix/store/.../etc/dir/file.conf.example";
target = "dir/file.conf";
mode = "0440";
}
];
description = "
List of files that have to be linked in /etc.
";
};
# !!! This should be moved outside of /etc/default.nix.
shellInit = mkOption {
default = "";
example = ''export PATH=/godi/bin/:$PATH'';
description = "
Script used to initialized user shell environments.
";
merge = pkgs.lib.mergeStringOption;
};
environment.etc = mkOption {
default = [];
example = [
{ source = "/nix/store/.../etc/dir/file.conf.example";
target = "dir/file.conf";
mode = "0440";
}
];
description = ''
List of files that have to be linked in /etc.
'';
};
};
in
###### implementation
let
optional = pkgs.lib.optional;
in
let
inherit (pkgs.stringsWithDeps) noDepEntry fullDepEntry packEntry;
copyScript = {source, target, mode ? "644", own ? "root.root"}:
assert target != "nixos";
@ -54,22 +36,15 @@ let
chmod ${mode} "$target"
'';
makeEtc = import ../helpers/make-etc.nix {
makeEtc = import ./make-etc.nix {
inherit (pkgs) stdenv;
configFiles = config.environment.etc;
};
in
{
require = [
option
# config.system.build
# ../system/system-options.nix
# config.system.activationScripts
# ../system/activate-configuration.nix
];
require = [option];
system = {
build = {
@ -77,7 +52,7 @@ in
};
activationScripts = {
etc = fullDepEntry ''
etc = pkgs.lib.fullDepEntry ''
# Set up the statically computed bits of /etc.
staticEtc=/etc/static
rm -f $staticEtc