* Synced with trunk @ 14905

svn path=/nixos/branches/modular-nixos/; revision=14986
This commit is contained in:
Nicolas Pierron 2009-04-11 22:12:02 +00:00
commit 16a916f297
16 changed files with 191 additions and 53 deletions

View File

@ -15,9 +15,7 @@ export LANG=@defaultLocale@
export EDITOR=nano
export INFOPATH=/var/run/current-system/sw/info:/var/run/current-system/sw/share/info
export LOCATE_PATH=/var/cache/locatedb
export KDEDIRS=/var/run/current-system/sw
export XDG_CONFIG_DIRS=/var/run/current-system/sw/etc/xdg
export XDG_DATA_DIRS=/var/run/current-system/sw/share
@shellInit@
# Set up secure multi-user builds: non-root users build through the
# Nix daemon.
@ -43,11 +41,11 @@ for i in $NIX_PROFILES; do # !!! reverse
export PKG_CONFIG_PATH="$i/lib/pkgconfig:$PKG_CONFIG_PATH"
# Automake's `aclocal' bails out if it finds non-existent directories
# in its path. !!! We should fix aclocal instead.
if [ -d "$i/share/aclocal" ]
then
export ACLOCAL_PATH="$i/share/aclocal:$ACLOCAL_PATH"
# in its path. !!! This has been fixed in the stdenv branch.
if [ -d "$i/share/aclocal" ]; then
export ACLOCAL_PATH="$i/share/aclocal:$ACLOCAL_PATH"
fi
export PERL5LIB="$i/lib/site_perl:$PERL5LIB"
# GStreamer.

View File

@ -19,12 +19,23 @@ let
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;
};
};
};
in
###### implementation
let
shellInit = config.environment.shellInit;
nixEnvVars = config.nix.envVars;
modulesTree = config.system.modulesTree;
nssModulesPath = config.system.nssModules.path;
@ -114,7 +125,7 @@ let
inherit (pkgs) glibc;
timeZone = config.time.timeZone;
defaultLocale = config.i18n.defaultLocale;
inherit nixEnvVars;
inherit nixEnvVars shellInit;
};
target = "bashrc";
}

View File

@ -43,7 +43,7 @@ in
pathsToLink = mkOption {
default = ["/bin" "/sbin" "/lib" "/share" "/man" "/info" "/etc"];
default = ["/bin" "/sbin" "/lib" "/share/man" "/share/info" "/man" "/info"];
example = ["/"];
description = "
Lists directories to be symlinked in `/var/run/current-system/sw'.

View File

@ -162,6 +162,7 @@ in
";
};
# !!! The mount option should not stay in /system/option.nix
mount = mkOption {
internal = true;
default = pkgs.utillinuxng.override {
@ -171,6 +172,7 @@ in
paths = [
pkgs.ntfs3g
pkgs.mount_cifs
pkgs.nfsUtils
];
pathsToLink = "/sbin";
} + "/sbin";
@ -442,6 +444,7 @@ in
(import ../upstart-jobs/zabbix-agent.nix)
(import ../upstart-jobs/zabbix-server.nix)
(import ../upstart-jobs/disnix.nix)
(import ../upstart-jobs/consolekit.nix)
(import ../upstart-jobs/cron.nix)
(import ../upstart-jobs/fcron.nix)
(import ../upstart-jobs/cron/locate.nix)

View File

@ -64,16 +64,6 @@ let
inherit (config.environment) pathsToLink;
ignoreCollisions = true;
# TODO: move this to upstart-jobs/xserver/desktopManager/kde4.nix
postBuild =
if config.services.xserver.desktopManager.kde4.enable then
# Rebuild the MIME database. Otherwise KDE won't be able to
# find many MIME types.
''
${pkgs.shared_mime_info}/bin/update-mime-database $out/share/mime
''
else "";
};
};

View File

@ -224,7 +224,11 @@ rec {
pkgs.diffutils
pkgs.upstart # for initctl
];
# !!! wtf does this do???
# This attribute is responsible for creating boot entries for
# child configuration. They are only (directly) accessible
# when the parent configuration is boot default. For example,
# you can provide an easy way to boot the same configuration
# as you use, but with another kernel
children = map (x: ((import ./system.nix)
{ inherit platform;
configuration = x//{boot=((x.boot)//{grubDevice = "";});};}).system)

View File

@ -0,0 +1,59 @@
{pkgs, config, ...}:
###### interface
let
inherit (pkgs.lib) mkOption;
options = {
services = {
consolekit = {
enable = mkOption {
default = false;
description = "
Whether to start the ConsoleKit daemon.
";
};
};
};
};
in
###### implementation
let
cfg = config.services.consolekit;
inherit (pkgs.lib) mkIf;
inherit (pkgs) ConsoleKit;
job = {
name = "consolekit";
job = ''
description "Console Kit Service"
start on dbus
stop on shutdown
respawn ${ConsoleKit}/sbin/console-kit-daemon
'';
};
in
mkIf cfg.enable {
require = [
(import ../upstart-jobs/default.nix) # config.services.extraJobs
(import ../upstart-jobs/dbus.nix) # services.dbus.*
options
];
services = {
extraJobs = [job];
dbus = {
enable = true;
services = [ConsoleKit];
};
};
}

View File

@ -24,6 +24,10 @@ let
crontab. See the manual page for crontab for the expected
format. If you want to get the results mailed you must setuid
sendmail. See <option>security.setuidOwners</option>
If neither /var/cron/cron.deny nor /var/cron/cron.allow exist only root
will is allowed to have its own crontab file. The /var/cron/cron.deny file
is created automatically for you. So every user can use a crontab.
'';
};
@ -86,6 +90,16 @@ in
# Needed to interpret times in the local timezone.
env TZ=${config.time.timeZone}
start script
mkdir -m 710 -p /var/cron
# By default, allow all users to create a crontab. This
# is denoted by the existence of an empty cron.deny file.
if ! test -e /var/cron/cron.allow -o -e /var/cron/cron.deny; then
touch /var/cron/cron.deny
fi
end script
respawn ${pkgs.cron}/sbin/cron -n
'';
}];

View File

@ -44,8 +44,7 @@ let
name = "dbus-conf";
buildCommand = "
ensureDir $out
substitute ${dbus}/etc/dbus-1/system.conf $out/system.conf \\
--replace '<fork/>' ''
ln -s ${dbus}/etc/dbus-1/system.conf $out/system.conf
ensureDir $out/system.d
for i in ${toString services}; do
@ -77,14 +76,18 @@ let
mkdir -m 0755 -p /var/lib/dbus
${dbus.tools}/bin/dbus-uuidgen --ensure
rm -f ${homeDir}/pid
${dbus}/bin/dbus-daemon --config-file=${configFile}/system.conf
end script
respawn
respawn sleep 1000000
script
rm -f ${homeDir}/pid
exec ${dbus}/bin/dbus-daemon --config-file=${configFile}/system.conf
stop script
pid=$(cat ${homeDir}/pid)
if test -n "$pid"; then
kill -9 $pid
fi
end script
'';
};

View File

@ -41,11 +41,6 @@ let
start on dbus
stop on shutdown
start script
# !!! quick hack: wait until dbus has started
sleep 3
end script
respawn ${pkgs.bash}/bin/sh -c 'export PATH=/var/run/current-system/sw/bin:$PATH; export HOME=/root; export DISNIX_ACTIVATE_HOOK=${cfg.activateHook}; export DISNIX_DEACTIVATE_HOOK=${cfg.deactivateHook}; ${pkgs.disnix}/bin/disnix-service'
'';
};

View File

@ -51,9 +51,6 @@ let
start script
# !!! quick hack: wait until dbus has started
sleep 3
mkdir -m 0755 -p /var/cache/hald
end script

View File

@ -98,6 +98,7 @@ let
};
# Environment variables for running Nix.
# !!! Fix description.
envVars = mkOption {
internal = true;
default = "";

View File

@ -290,14 +290,14 @@ let
knownVideoDrivers = {
nvidia = { modulesFirst = [ kernelPackages.nvidia_x11 ]; }; #make sure it first loads the nvidia libs
vesa = { modules = [xorg.xf86videovesa]; };
vga = { modules = [xorg.xf86videovga]; };
sis = { modules = [xorg.xf86videosis]; };
i810 = { modules = [xorg.xf86videoi810]; };
intel = { modules = [xorg.xf86videointel]; };
nv = { modules = [xorg.xf86videonv]; };
ati = { modules = [xorg.xf86videoati]; };
via = { modules = [xorg.xf86videovia]; };
vesa = { modules = [xorg.xf86videovesa]; };
vga = { modules = [xorg.xf86videovga]; };
sis = { modules = [xorg.xf86videosis]; };
i810 = { modules = [xorg.xf86videoi810]; };
intel = { modules = [xorg.xf86videointel]; };
nv = { modules = [xorg.xf86videonv]; };
ati = { modules = [xorg.xf86videoati]; };
via = { modules = [xorg.xf86videovia]; };
cirrus = { modules = [xorg.xf86videocirrus]; };
};

View File

@ -19,7 +19,12 @@ let
in
mkIf cfg.enable {
require = options;
require = [
options
# environment.kdePackages
(import ./kdeEnvironment.nix)
];
services = {
xserver = {
@ -29,9 +34,6 @@ mkIf cfg.enable {
name = "kde";
start = ''
# Start KDE.
export KDEDIRS=$HOME/.nix-profile:/nix/var/nix/profiles/default:${pkgs.kdebase}:${pkgs.kdelibs}
export XDG_CONFIG_DIRS=${pkgs.kdebase}/etc/xdg:${pkgs.kdelibs}/etc/xdg
export XDG_DATA_DIRS=${pkgs.kdebase}/share
exec ${pkgs.kdebase}/bin/startkde
'';
}];
@ -47,9 +49,12 @@ mkIf cfg.enable {
};
environment = {
extraPackages = [
kdePackages = [
pkgs.kdelibs
pkgs.kdebase
];
extraPackages = [
xorg.xset # used by startkde, non-essential
];

View File

@ -19,7 +19,12 @@ let
in
mkIf cfg.enable {
require = options;
require = [
options
# environment.kdePackages
(import ./kdeEnvironment.nix)
];
services = {
xserver = {
@ -44,15 +49,17 @@ mkIf cfg.enable {
};
environment = {
extraPackages = [
xorg.xmessage # so that startkde can show error messages
pkgs.qt4 # needed for qdbus
kdePackages = [
pkgs.kde42.kdelibs
pkgs.kde42.kdebase
pkgs.kde42.kdebase_runtime
pkgs.kde42.kdebase_workspace
pkgs.kde42.kdegames
pkgs.shared_mime_info
];
extraPackages = [
xorg.xmessage # so that startkde can show error messages
pkgs.qt4 # needed for qdbus
xorg.xset # used by startkde, non-essential
];

View File

@ -0,0 +1,51 @@
{pkgs, config, ...}:
let
inherit (pkgs.lib) mkOption mkIf;
kdePackages = config.environment.kdePackages;
options = {
kde = {
extraPackages = mkOption {
default = [];
merge = builtins.trace "!!! kde.extraPackages is obsolete, you should use environment.kdePackages." pkgs.lib.mergeDefaultOption;
description = ''
** Obsolete **
Additional KDE packages to be used when you use KDE as a desktop
manager. By default, you only get the KDE base packages.
'';
};
};
environment = {
kdePackages = mkOption {
default = [];
example = [ pkgs.kde42.kdegames ];
description = ''
Additional KDE packages to be used when you use KDE as a desktop
manager. By default, you only get the KDE base packages.
'';
apply = pkgs: pkgs ++ config.kde.extraPackages
};
};
};
in
mkIf (kdePackages != []) {
require = options;
environment = {
extraPackages = kdePackages;
shellInit = ''
export KDEDIRS="${pkgs.lib.concatStringsSep ":" kdePackages}"
export XDG_CONFIG_DIRS="${pkgs.lib.makeSearchPath "etc/xdg" kdePackages}"
export XDG_DATA_DIRS="${pkgs.lib.makeSearchPath "share" kdePackages}"
'';
};
}