* system/options.nix: gone :-)

svn path=/nixos/branches/modular-nixos/; revision=15772
This commit is contained in:
Eelco Dolstra 2009-05-28 16:03:48 +00:00
parent fc9111fadf
commit c6c9304b95
5 changed files with 183 additions and 197 deletions

View File

@ -7,7 +7,7 @@
rec {
configComponents = [
configuration
(import ../system/options.nix)
{ require = import ../modules/module-list.nix; }
];
config =

View File

@ -58,13 +58,7 @@ let
optional = cond: service: pkgs.lib.optional cond (makeJob service);
requiredTTYs = config.requiredTTYs;
jobs = map makeJob []
# User-defined events.
++ (map makeJob (config.services.extraJobs));
jobs = map makeJob config.services.extraJobs;
# Create an etc/event.d directory containing symlinks to the
# specified list of Upstart job files.

View File

@ -1,7 +1,39 @@
{pkgs, config, ...}:
let
inherit (pkgs.lib) mkOption;
###### interface
# most options are defined in i18n.nix
options = {
boot.extraTTYs = pkgs.lib.mkOption {
default = [];
example = [8 9];
description = "
Tty (virtual console) devices, in addition to the consoles on
which mingetty and syslogd run, that must be initialised.
Only useful if you have some program that you want to run on
some fixed console. For example, the NixOS installation CD
opens the manual in a web browser on console 7, so it sets
<option>boot.extraTTYs</option> to <literal>[7]</literal>.
";
};
# dummy option so that requiredTTYs can be passed
requiredTTYs = pkgs.lib.mkOption {
default = [];
description = "
FIXME: find another place for this option.
FIXME: find a good description.
";
};
};
###### implementation
# think about where to put this chunk of code!
# required by other pieces as well
@ -16,26 +48,10 @@ let
in
###### implementation
# most options are defined in i18n.nix
{
require = [options];
inherit requiredTTYs; # pass them to upstart-job/default.nix
# dummy option so that requiredTTYs can be passed, see above (FIXME)
require = [
{
requiredTTYs = mkOption {
default = [];
description = "
FIXME: find another place for this option.
FIXME: find a good description.
";
};
}
];
inherit requiredTTYs; # pass them to ./modules/tasks/tty-backgrounds.nix
services = {
extraJobs = [{

View File

@ -1,9 +1,70 @@
{pkgs, config, ...}:
###### implementation
let
inherit (pkgs.lib) mkOption;
###### interface
options = {
networking.hostName = mkOption {
default = "nixos";
description = "
The name of the machine. Leave it empty if you want to obtain
it from a DHCP server (if using DHCP).
";
};
networking.nativeIPv6 = mkOption {
default = false;
description = "
Whether to use IPv6 even though gw6c is not used. For example,
for Postfix.
";
};
networking.defaultGateway = mkOption {
default = "";
example = "131.211.84.1";
description = "
The default gateway. It can be left empty if it is auto-detected through DHCP.
";
};
networking.nameservers = mkOption {
default = [];
example = ["130.161.158.4" "130.161.33.17"];
description = "
The list of nameservers. It can be left empty if it is auto-detected through DHCP.
";
};
networking.domain = mkOption {
default = "";
example = "home";
description = "
The domain. It can be left empty if it is auto-detected through DHCP.
";
};
networking.localCommands = mkOption {
default = "";
example = "text=anything; echo You can put $text here.";
description = "
Shell commands to be executed at the end of the
<literal>network-interfaces</literal> Upstart job. Note that if
you are using DHCP to obtain the network configuration,
interfaces may not be fully configured yet.
";
};
};
###### implementation
inherit (pkgs) nettools wirelesstools bash writeText;
cfg = config.networking;
@ -18,10 +79,10 @@ let
in
{
services = {
extraJobs = [{
require = [options];
services.extraJobs = [{
name = "network-interfaces";
job = ''
@ -105,5 +166,4 @@ in
end script
'';
}];
};
}

View File

@ -1,84 +0,0 @@
{pkgs, config, ...}:
let
inherit (pkgs.lib) mkOption mergeOneOption;
in
{
boot = {
extraTTYs = mkOption {
default = [];
example = [8 9];
description = "
Tty (virtual console) devices, in addition to the consoles on
which mingetty and syslogd run, that must be initialised.
Only useful if you have some program that you want to run on
some fixed console. For example, the NixOS installation CD
opens the manual in a web browser on console 7, so it sets
<option>boot.extraTTYs</option> to <literal>[7]</literal>.
";
};
};
networking = {
hostName = mkOption {
default = "nixos";
description = "
The name of the machine. Leave it empty if you want to obtain
it from a DHCP server (if using DHCP).
";
};
nativeIPv6 = mkOption {
default = false;
description = "
Whether to use IPv6 even though gw6c is not used. For example,
for Postfix.
";
};
defaultGateway = mkOption {
default = "";
example = "131.211.84.1";
description = "
The default gateway. It can be left empty if it is auto-detected through DHCP.
";
};
nameservers = mkOption {
default = [];
example = ["130.161.158.4" "130.161.33.17"];
description = "
The list of nameservers. It can be left empty if it is auto-detected through DHCP.
";
};
domain = mkOption {
default = "";
example = "home";
description = "
The domain. It can be left empty if it is auto-detected through DHCP.
";
};
localCommands = mkOption {
default = "";
example = "text=anything; echo You can put $text here.";
description = "
Shell commands to be executed at the end of the
<literal>network-interfaces</literal> Upstart job. Note that if
you are using DHCP to obtain the network configuration,
interfaces may not be fully configured yet.
";
};
};
require = import ../modules/module-list.nix;
}