From 525e4e961d0e132cce50d1bcc6a477164e4434d6 Mon Sep 17 00:00:00 2001 From: Sander van der Burg Date: Thu, 2 Apr 2009 15:02:13 +0000 Subject: [PATCH 01/10] Added console kit upstart job svn path=/nixos/trunk/; revision=14839 --- system/options.nix | 12 +++++++++++- upstart-jobs/consolekit.nix | 24 ++++++++++++++++++++++++ upstart-jobs/default.nix | 7 +++++++ 3 files changed, 42 insertions(+), 1 deletion(-) create mode 100644 upstart-jobs/consolekit.nix diff --git a/system/options.nix b/system/options.nix index 2828863e987..cfd81259fff 100644 --- a/system/options.nix +++ b/system/options.nix @@ -1967,7 +1967,17 @@ in }; }; - + consolekit = { + + enable = mkOption { + default = false; + description = " + Whether to start the ConsoleKit daemon. + "; + }; + + }; + samba = { enable = mkOption { diff --git a/upstart-jobs/consolekit.nix b/upstart-jobs/consolekit.nix new file mode 100644 index 00000000000..fef32159aa6 --- /dev/null +++ b/upstart-jobs/consolekit.nix @@ -0,0 +1,24 @@ +args: with args; + +let + +cfg = config.services.consolekit; + +in +{ + name = "consolekit"; + + job = '' + description "Console Kit Service" + + start on dbus + stop on shutdown + + start script + # !!! quick hack: wait until dbus has started + sleep 3 + end script + + respawn ${pkgs.ConsoleKit}/sbin/console-kit-daemon + ''; +} diff --git a/upstart-jobs/default.nix b/upstart-jobs/default.nix index 0f479e40638..95dbb320ea9 100644 --- a/upstart-jobs/default.nix +++ b/upstart-jobs/default.nix @@ -350,6 +350,7 @@ let dbusServices = pkgs.lib.optional config.services.hal.enable pkgs.hal ++ pkgs.lib.optional config.services.avahi.enable pkgs.avahi ++ + pkgs.lib.optional config.services.consolekit.enable pkgs.ConsoleKit ++ pkgs.lib.optional config.services.disnix.enable pkgs.disnix ; }) @@ -385,6 +386,12 @@ let inherit config pkgs; }) + # ConsoleKit daemon. + ++ optional config.services.consolekit.enable + (import ../upstart-jobs/consolekit.nix { + inherit config pkgs; + }) + # Postfix mail server. ++ optional config.services.postfix.enable (import ../upstart-jobs/postfix.nix { From 46d69d9170e35d0283983de563b463e307c7a9e2 Mon Sep 17 00:00:00 2001 From: Marc Weber Date: Fri, 3 Apr 2009 12:05:15 +0000 Subject: [PATCH 02/10] added hint about cron.{allow,deny} svn path=/nixos/trunk/; revision=14853 --- upstart-jobs/cron.nix | 3 +++ 1 file changed, 3 insertions(+) diff --git a/upstart-jobs/cron.nix b/upstart-jobs/cron.nix index 8216b6baaf2..a5d628f9a65 100644 --- a/upstart-jobs/cron.nix +++ b/upstart-jobs/cron.nix @@ -24,6 +24,9 @@ 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 + + If you neither create /etc/cron.deny nor /etc/cron.allow only root + will be allowed to have its own crontab file. ''; }; From 80f0683a77c8201f17cb5b18ec7a398dc4a32e8a Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Fri, 3 Apr 2009 15:14:00 +0000 Subject: [PATCH 03/10] * Allow users to create crontabs by default. svn path=/nixos/trunk/; revision=14861 --- upstart-jobs/cron.nix | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/upstart-jobs/cron.nix b/upstart-jobs/cron.nix index a5d628f9a65..2c9a75cbc6f 100644 --- a/upstart-jobs/cron.nix +++ b/upstart-jobs/cron.nix @@ -88,6 +88,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 ''; }]; From 15bff21f68b343442a830240f39764e4a6787cc7 Mon Sep 17 00:00:00 2001 From: Marc Weber Date: Fri, 3 Apr 2009 19:48:45 +0000 Subject: [PATCH 04/10] fix hint of previous commit svn path=/nixos/trunk/; revision=14871 --- upstart-jobs/cron.nix | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/upstart-jobs/cron.nix b/upstart-jobs/cron.nix index 2c9a75cbc6f..078cf4766fc 100644 --- a/upstart-jobs/cron.nix +++ b/upstart-jobs/cron.nix @@ -25,8 +25,9 @@ let format. If you want to get the results mailed you must setuid sendmail. See - If you neither create /etc/cron.deny nor /etc/cron.allow only root - will be allowed to have its own crontab file. + 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. ''; }; From 6663af083352b62a2556a90dfbe673af4b461f1d Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Fri, 3 Apr 2009 22:04:31 +0000 Subject: [PATCH 05/10] * dbus: fork() into the background so that the daemon is running by the time the job has finished starting. This obviates the need for the sleep hack in other jobs. svn path=/nixos/trunk/; revision=14875 --- upstart-jobs/consolekit.nix | 5 ----- upstart-jobs/dbus.nix | 15 +++++++++------ upstart-jobs/disnix.nix | 5 ----- upstart-jobs/hal.nix | 3 --- 4 files changed, 9 insertions(+), 19 deletions(-) diff --git a/upstart-jobs/consolekit.nix b/upstart-jobs/consolekit.nix index fef32159aa6..57fb5b9dca6 100644 --- a/upstart-jobs/consolekit.nix +++ b/upstart-jobs/consolekit.nix @@ -14,11 +14,6 @@ in start on dbus stop on shutdown - start script - # !!! quick hack: wait until dbus has started - sleep 3 - end script - respawn ${pkgs.ConsoleKit}/sbin/console-kit-daemon ''; } diff --git a/upstart-jobs/dbus.nix b/upstart-jobs/dbus.nix index a8ce1fddf06..d84ca477b08 100644 --- a/upstart-jobs/dbus.nix +++ b/upstart-jobs/dbus.nix @@ -10,8 +10,7 @@ let name = "dbus-conf"; buildCommand = " ensureDir $out - substitute ${dbus}/etc/dbus-1/system.conf $out/system.conf \\ - --replace '' '' + ln -s ${dbus}/etc/dbus-1/system.conf $out/system.conf ensureDir $out/system.d for i in ${toString dbusServices}; do @@ -49,13 +48,17 @@ in 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 ''; diff --git a/upstart-jobs/disnix.nix b/upstart-jobs/disnix.nix index 2f64afbc4b9..bc24e513bec 100644 --- a/upstart-jobs/disnix.nix +++ b/upstart-jobs/disnix.nix @@ -14,11 +14,6 @@ in 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' ''; } diff --git a/upstart-jobs/hal.nix b/upstart-jobs/hal.nix index 8b59c079eb8..af4038f0fe0 100644 --- a/upstart-jobs/hal.nix +++ b/upstart-jobs/hal.nix @@ -28,9 +28,6 @@ start script - # !!! quick hack: wait until dbus has started - sleep 3 - mkdir -m 0755 -p /var/cache/hald end script From 3b494865b1f1482fda55638c1436425230acc3ac Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Sun, 5 Apr 2009 18:25:21 +0000 Subject: [PATCH 06/10] * Don't symlink all of /share as we don't need it and we end up with a zillion extra symlinks which is somewhat expensive. svn path=/nixos/trunk/; revision=14886 --- system/options.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system/options.nix b/system/options.nix index cfd81259fff..59c3001df3b 100644 --- a/system/options.nix +++ b/system/options.nix @@ -2986,7 +2986,7 @@ root ALL=(ALL) SETENV: ALL environment = { 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'. From d5e97ab056011031be29e760c3e63ecf36371679 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Sun, 5 Apr 2009 18:30:39 +0000 Subject: [PATCH 07/10] * Let KDEDIRS, XDG_CONFIG_DIRS and XDG_DATA_DIRS contain the KDE packages that we need rather than just /var/run/current-system/sw. This ensures consistency when upgrading a system (e.g. you don't end up with a mix of KDE versions at runtime). This partially reverts r14148 (in particular the update-mime-database hack in the systemPath post-build). svn path=/nixos/trunk/; revision=14887 --- etc/bashrc.sh | 12 ++++++------ etc/default.nix | 8 +++++++- system/system.nix | 31 ++++++++++++++++++++----------- upstart-jobs/default.nix | 6 ++++-- upstart-jobs/xserver.nix | 33 ++++++++++++--------------------- 5 files changed, 49 insertions(+), 41 deletions(-) diff --git a/etc/bashrc.sh b/etc/bashrc.sh index baaed726ee1..1a2b45794d9 100644 --- a/etc/bashrc.sh +++ b/etc/bashrc.sh @@ -15,9 +15,9 @@ 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 +export KDEDIRS=@kdeDirs@ +export XDG_CONFIG_DIRS=@xdgConfigDirs@ +export XDG_DATA_DIRS=@xdgDataDirs@ # Set up secure multi-user builds: non-root users build through the @@ -44,11 +44,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 + # 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. diff --git a/etc/default.nix b/etc/default.nix index b9411117971..656e197eca5 100644 --- a/etc/default.nix +++ b/etc/default.nix @@ -1,5 +1,6 @@ { config, pkgs, upstartJobs, systemPath, wrapperDir , defaultShell, extraEtc, nixEnvVars, modulesTree, nssModulesPath, binsh +, kdePackages }: let @@ -19,7 +20,7 @@ let pamConsolePerms = ./security/console.perms; - + in @@ -108,6 +109,11 @@ import ../helpers/make-etc.nix { timeZone = config.time.timeZone; defaultLocale = config.i18n.defaultLocale; inherit nixEnvVars; + # !!! in the modular NixOS these should be declared by the KDE + # component. + kdeDirs = pkgs.lib.concatStringsSep ":" kdePackages; + xdgConfigDirs = pkgs.lib.makeSearchPath "etc/xdg" kdePackages; + xdgDataDirs = pkgs.lib.makeSearchPath "share" kdePackages; }; target = "bashrc"; } diff --git a/system/system.nix b/system/system.nix index 75c64ab7e1a..7fc5974cc39 100644 --- a/system/system.nix +++ b/system/system.nix @@ -117,14 +117,15 @@ rec { # The services (Upstart) configuration for the system. upstartJobs = import ../upstart-jobs/default.nix { inherit config pkgs nix modprobe nssModulesPath nixEnvVars - optionDeclarations kernelPackages mount; + optionDeclarations kernelPackages mount kdePackages; }; # The static parts of /etc. etc = import ../etc/default.nix { inherit config pkgs upstartJobs systemPath wrapperDir - defaultShell nixEnvVars modulesTree nssModulesPath binsh; + defaultShell nixEnvVars modulesTree nssModulesPath binsh + kdePackages; extraEtc = (pkgs.lib.concatLists (map (job: job.extraEtc) upstartJobs.jobs)) ++ config.environment.etc; @@ -262,18 +263,26 @@ rec { inherit (config.environment) pathsToLink; ignoreCollisions = true; - - postBuild = - if config.services.xserver.sessionType == "kde4" 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 ""; }; + # The list of packages that need to appear in KDEDIRS, + # XDG_CONFIG_DIRS and XDG_DATA_DIRS. + # !!! This should be defined somewhere else. + kdePackages = + pkgs.lib.optionals (config.services.xserver.sessionType == "kde4") + [ pkgs.kde42.kdelibs + pkgs.kde42.kdebase + pkgs.kde42.kdebase_runtime + pkgs.kde42.kdebase_workspace + pkgs.shared_mime_info + ] + ++ pkgs.lib.optionals (config.services.xserver.sessionType == "kde") + [ pkgs.kdebase + pkgs.kdelibs + ]; + + usersGroups = import ./users-groups.nix { inherit pkgs config upstartJobs defaultShell; }; diff --git a/upstart-jobs/default.nix b/upstart-jobs/default.nix index 95dbb320ea9..3ecd007dc1c 100644 --- a/upstart-jobs/default.nix +++ b/upstart-jobs/default.nix @@ -1,4 +1,6 @@ -{config, pkgs, nix, modprobe, nssModulesPath, nixEnvVars, optionDeclarations, kernelPackages, mount}: +{ config, pkgs, nix, modprobe, nssModulesPath, nixEnvVars, optionDeclarations +, kernelPackages, mount, kdePackages +}: let @@ -230,7 +232,7 @@ let # X server. ++ optional config.services.xserver.enable (import ../upstart-jobs/xserver.nix { - inherit config pkgs kernelPackages; + inherit config pkgs kernelPackages kdePackages; fontDirectories = import ../system/fonts.nix {inherit pkgs config;}; }) diff --git a/upstart-jobs/xserver.nix b/upstart-jobs/xserver.nix index ff6f34e5de7..772b8f214f0 100644 --- a/upstart-jobs/xserver.nix +++ b/upstart-jobs/xserver.nix @@ -1,4 +1,4 @@ -{ config, pkgs, kernelPackages +{ config, pkgs, kernelPackages, kdePackages , # List of font directories. fontDirectories @@ -7,6 +7,7 @@ let inherit (pkgs.lib) optional isInList getAttr; + # Abbreviations. cfg = config.services.xserver; xorg = cfg.package; @@ -15,14 +16,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]; }; }; @@ -289,9 +290,6 @@ let ${if sessionType == "kde" then '' # 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 '' else if sessionType == "kde4" then '' @@ -384,24 +382,17 @@ rec { gnome.gconfeditor ] ++ optional (sessionType == "kde") [ - pkgs.kdelibs - pkgs.kdebase xorg.xset # used by startkde, non-essential ] ++ optional (sessionType == "kde4") [ xorg.xmessage # so that startkde can show error messages pkgs.qt4 # needed for qdbus - pkgs.kde42.kdelibs - pkgs.kde42.kdebase - pkgs.kde42.kdebase_runtime - pkgs.kde42.kdebase_workspace - pkgs.kde42.kdegames - pkgs.shared_mime_info xorg.xset # used by startkde, non-essential ] ++ optional (videoDriver == "nvidia") [ kernelPackages.nvidia_x11 - ]; + ] + ++ kdePackages; extraEtc = From 4be528a72c3a92cd91bbff30f16144c73e384616 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Sun, 5 Apr 2009 19:10:34 +0000 Subject: [PATCH 08/10] * An option to activate additional KDE packages. svn path=/nixos/trunk/; revision=14888 --- system/options.nix | 17 +++++++++++++++++ system/system.nix | 3 ++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/system/options.nix b/system/options.nix index 59c3001df3b..9128e794e02 100644 --- a/system/options.nix +++ b/system/options.nix @@ -3083,6 +3083,22 @@ root ALL=(ALL) SETENV: ALL }; }; + + kde = { + + extraPackages = mkOption { + default = []; + merge = backwardPkgsFunListMerge; + description = '' + Additional KDE packages to be used when + is + "kde" or "kde4". + By default, you only get the KDE base packages. + ''; + }; + + }; + passthru = mkOption { default = {}; @@ -3093,6 +3109,7 @@ root ALL=(ALL) SETENV: ALL "; }; + require = [ # newtworking (import ../upstart-jobs/dhclient.nix) diff --git a/system/system.nix b/system/system.nix index 7fc5974cc39..607195ab0cb 100644 --- a/system/system.nix +++ b/system/system.nix @@ -280,7 +280,8 @@ rec { ++ pkgs.lib.optionals (config.services.xserver.sessionType == "kde") [ pkgs.kdebase pkgs.kdelibs - ]; + ] + ++ config.kde.extraPackages; usersGroups = import ./users-groups.nix { inherit pkgs config upstartJobs defaultShell; }; From 5dadce8770327903cd029fc36cce7617c9c55ffc Mon Sep 17 00:00:00 2001 From: Michael Raskin <7c6f434c@mail.ru> Date: Sun, 5 Apr 2009 19:13:52 +0000 Subject: [PATCH 09/10] Adding comment about child configurations svn path=/nixos/trunk/; revision=14889 --- system/system.nix | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/system/system.nix b/system/system.nix index 607195ab0cb..b615c99517c 100644 --- a/system/system.nix +++ b/system/system.nix @@ -404,7 +404,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) From d9b6234e9fed951dc3b48783cf4f3817204acf6e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Llu=C3=ADs=20Batlle=20i=20Rossell?= Date: Mon, 6 Apr 2009 19:25:45 +0000 Subject: [PATCH 10/10] Adding nfsutils on mount-helpers. That adds more binaries to mount-helpers, but at least allows mounting nfs paths. svn path=/nixos/trunk/; revision=14905 --- system/system.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/system/system.nix b/system/system.nix index b615c99517c..78063113089 100644 --- a/system/system.nix +++ b/system/system.nix @@ -160,6 +160,7 @@ rec { paths = [ pkgs.ntfs3g pkgs.mount_cifs + pkgs.nfsUtils ]; pathsToLink = "/sbin"; } + "/sbin";