From 2a983acaffd9382302ebc3a36a2649f9b2f53a6c Mon Sep 17 00:00:00 2001 From: Shea Levy Date: Wed, 1 Aug 2012 21:50:43 -0400 Subject: [PATCH 01/41] Enable specifying which kernel config options are needed for a given module --- modules/system/boot/kernel.nix | 61 +++++++++++++++++++++++++++++++++- 1 file changed, 60 insertions(+), 1 deletion(-) diff --git a/modules/system/boot/kernel.nix b/modules/system/boot/kernel.nix index 1b247a658908..5bb479698352 100644 --- a/modules/system/boot/kernel.nix +++ b/modules/system/boot/kernel.nix @@ -108,6 +108,24 @@ let kernel = config.boot.kernelPackages.kernel; in apply = pkgs.aggregateModules; }; + system.requiredKernelConfig = mkOption { + default = []; + example = literalExample '' + with config.lib.kernelConfig; [ + (isYes "MODULES") + (isEnabled "FB_CON_DECOR") + (isEnabled "BLK_DEV_INITRD") + ] + ''; + internal = true; + type = types.listOf types.attrs; + description = '' + This option allows modules to specify the kernel config options that + must be set (or unset) for the module to work. Please use the + lib.kernelConfig functions to build list elements. + ''; + }; + }; @@ -173,6 +191,47 @@ let kernel = config.boot.kernelPackages.kernel; in # The Linux kernel >= 2.6.27 provides firmware. hardware.firmware = [ "${kernel}/lib/firmware" ]; - }; + lib.kernelConfig = { + isYes = option: { + assertion = config: config.isYes option; + message = "CONFIG_${option} is not yes!"; + }; + isNo = option: { + assertion = config: config.isNo option; + message = "CONFIG_${option} is not no!"; + }; + + isModule = option: { + assertion = config: config.isModule option; + message = "CONFIG_${option} is not built as a module!"; + }; + + ### Usually you will just want to use these two + # True if yes or module + isEnabled = option: { + assertion = config: config.isEnabled option; + message = "CONFIG_${option} is not enabled!"; + }; + + # True if no or omitted + isDisabled = option: { + assertion = config: config.isDisabled option; + message = "CONFIG_${option} is not disabled!"; + }; + }; + + # The config options that all modules can depend upon + system.requiredKernelConfig = with config.lib.kernelConfig; [ + (isYes "MODULES") + (isYes "BLK_DEV_INITRD") + ]; + + # nixpkgs kernels are assumed to have all required features + assertions = if config.boot.kernelPackages.kernel ? features then [] else + let cfg = config.boot.kernelPackages.kernel.config; in map (attrs: + { assertion = attrs.assertion cfg; inherit (attrs) message; } + ) config.system.requiredKernelConfig; + + }; } From 9e300052bd830d48f6016d5f90441030fd556f1c Mon Sep 17 00:00:00 2001 From: Shea Levy Date: Wed, 1 Aug 2012 22:32:16 -0400 Subject: [PATCH 02/41] Add test to check that a machine with a minimal kernel but all of the requiredKernelConfig options set boots and shuts down --- modules/system/boot/kernel.nix | 5 +++++ release.nix | 1 + tests/default.nix | 1 + tests/minimal-kernel.nix | 34 ++++++++++++++++++++++++++++++++++ 4 files changed, 41 insertions(+) create mode 100644 tests/minimal-kernel.nix diff --git a/modules/system/boot/kernel.nix b/modules/system/boot/kernel.nix index 5bb479698352..326cf64d6b85 100644 --- a/modules/system/boot/kernel.nix +++ b/modules/system/boot/kernel.nix @@ -195,16 +195,19 @@ let kernel = config.boot.kernelPackages.kernel; in isYes = option: { assertion = config: config.isYes option; message = "CONFIG_${option} is not yes!"; + configLine = "CONFIG_${option}=y"; }; isNo = option: { assertion = config: config.isNo option; message = "CONFIG_${option} is not no!"; + configLine = "CONFIG_${option}=n"; }; isModule = option: { assertion = config: config.isModule option; message = "CONFIG_${option} is not built as a module!"; + configLine = "CONFIG_${option}=m"; }; ### Usually you will just want to use these two @@ -212,12 +215,14 @@ let kernel = config.boot.kernelPackages.kernel; in isEnabled = option: { assertion = config: config.isEnabled option; message = "CONFIG_${option} is not enabled!"; + configLine = "CONFIG_${option}=y"; }; # True if no or omitted isDisabled = option: { assertion = config: config.isDisabled option; message = "CONFIG_${option} is not disabled!"; + configLine = "CONFIG_${option}=n"; }; }; diff --git a/release.nix b/release.nix index 4ccbd2ef754f..9f76ee4a254c 100644 --- a/release.nix +++ b/release.nix @@ -212,6 +212,7 @@ let kde4 = t.kde4.test; login = t.login.test; misc = t.misc.test; + minimal_kernel = t.minimal_kernel.test; mpich = t.mpich.test; mysql = t.mysql.test; mysql_replication = t.mysql_replication.test; diff --git a/tests/default.nix b/tests/default.nix index 4edcbd2f325b..2433826a9d17 100644 --- a/tests/default.nix +++ b/tests/default.nix @@ -11,6 +11,7 @@ with import ../lib/testing.nix { inherit system; }; ipv6 = makeTest (import ./ipv6.nix); kde4 = makeTest (import ./kde4.nix); login = makeTest (import ./login.nix); + minimal_kernel = makeTest (import ./minimal-kernel.nix); misc = makeTest (import ./misc.nix); mpich = makeTest (import ./mpich.nix); mysql = makeTest (import ./mysql.nix); diff --git a/tests/minimal-kernel.nix b/tests/minimal-kernel.nix new file mode 100644 index 000000000000..04fe17c261b7 --- /dev/null +++ b/tests/minimal-kernel.nix @@ -0,0 +1,34 @@ +{ pkgs, ... }: + + +{ + machine = { config, pkgs, ... }: + let + configfile = builtins.storePath (builtins.toFile "config" (pkgs.lib.concatStringsSep "\n" + (map (builtins.getAttr "configLine") config.system.requiredKernelConfig))); + + kernel = pkgs.lib.overrideDerivation (pkgs.linuxManualConfig { + inherit (pkgs.linux) src version; + inherit configfile; + allowImportFromDerivation = true; + }) (attrs: { + configurePhase = '' + runHook preConfigure + mkdir ../build + make $makeFlags "''${makeFlagsArray[@]}" mrproper + make $makeFlags "''${makeFlagsArray[@]}" KCONFIG_ALLCONFIG=${configfile} allnoconfig + runHook postConfigure + ''; + }); + + kernelPackages = pkgs.linuxPackagesFor kernel kernelPackages; + in { + boot.kernelPackages = kernelPackages; + }; + + testScript = + '' + startAll; + $machine->shutdown; + ''; +} From 3d20a308afb1cde850f63feab990d7d5b4f8e296 Mon Sep 17 00:00:00 2001 From: Shea Levy Date: Wed, 1 Aug 2012 23:36:48 -0400 Subject: [PATCH 03/41] tests/minimal-kernel: Add CIFS timeout patch --- modules/testing/test-instrumentation.nix | 9 ++++++++- tests/minimal-kernel.nix | 9 ++++++--- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/modules/testing/test-instrumentation.nix b/modules/testing/test-instrumentation.nix index 830f1744fa04..b18e4263c2db 100644 --- a/modules/testing/test-instrumentation.nix +++ b/modules/testing/test-instrumentation.nix @@ -5,11 +5,18 @@ with pkgs.lib; +let + kernel = config.boot.kernelPackages.kernel; + + hasCIFSTimeout = if kernel ? features then kernel.features ? cifsTimeout + else (filter (p: p.name == "cifs-timeout") kernel.kernelPatches) != []; +in + { config = # Require a patch to the kernel to increase the 15s CIFS timeout. - mkAssert (config.boot.kernelPackages.kernel.features ? cifsTimeout) " + mkAssert hasCIFSTimeout " VM tests require that the kernel has the CIFS timeout patch. " { diff --git a/tests/minimal-kernel.nix b/tests/minimal-kernel.nix index 04fe17c261b7..e27b39d17643 100644 --- a/tests/minimal-kernel.nix +++ b/tests/minimal-kernel.nix @@ -7,11 +7,14 @@ configfile = builtins.storePath (builtins.toFile "config" (pkgs.lib.concatStringsSep "\n" (map (builtins.getAttr "configLine") config.system.requiredKernelConfig))); - kernel = pkgs.lib.overrideDerivation (pkgs.linuxManualConfig { + origKernel = pkgs.linuxManualConfig { inherit (pkgs.linux) src version; inherit configfile; allowImportFromDerivation = true; - }) (attrs: { + kernelPatches = [ pkgs.kernelPatches.cifs_timeout_2_6_38 ]; + }; + + kernel = origKernel //(derivation (origKernel.drvAttrs // { configurePhase = '' runHook preConfigure mkdir ../build @@ -19,7 +22,7 @@ make $makeFlags "''${makeFlagsArray[@]}" KCONFIG_ALLCONFIG=${configfile} allnoconfig runHook postConfigure ''; - }); + })); kernelPackages = pkgs.linuxPackagesFor kernel kernelPackages; in { From feb010a366c857c7320c37d7152759419b88ca8b Mon Sep 17 00:00:00 2001 From: Shea Levy Date: Thu, 2 Aug 2012 00:47:36 -0400 Subject: [PATCH 04/41] NixOS kernels should support ELF executables --- modules/system/boot/kernel.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/system/boot/kernel.nix b/modules/system/boot/kernel.nix index 326cf64d6b85..ab9961960795 100644 --- a/modules/system/boot/kernel.nix +++ b/modules/system/boot/kernel.nix @@ -230,6 +230,7 @@ let kernel = config.boot.kernelPackages.kernel; in system.requiredKernelConfig = with config.lib.kernelConfig; [ (isYes "MODULES") (isYes "BLK_DEV_INITRD") + (isYes "BINFMT_ELF") ]; # nixpkgs kernels are assumed to have all required features From 1b249eaf0568e9d14915d76690afb43442612cc2 Mon Sep 17 00:00:00 2001 From: Peter Simons Date: Fri, 3 Aug 2012 15:11:28 +0200 Subject: [PATCH 05/41] Initial version of a SpamAssassin service. The configuration is expected to be managed by the user in /etc/spamassassin. --- modules/module-list.nix | 1 + modules/services/mail/spamassassin.nix | 45 ++++++++++++++++++++++++++ 2 files changed, 46 insertions(+) create mode 100644 modules/services/mail/spamassassin.nix diff --git a/modules/module-list.nix b/modules/module-list.nix index e2c9516ac463..bc3948182c31 100644 --- a/modules/module-list.nix +++ b/modules/module-list.nix @@ -88,6 +88,7 @@ ./services/mail/freepops.nix ./services/mail/mail.nix ./services/mail/postfix.nix + ./services/mail/spamassassin.nix ./services/misc/autofs.nix ./services/misc/disnix.nix ./services/misc/felix.nix diff --git a/modules/services/mail/spamassassin.nix b/modules/services/mail/spamassassin.nix new file mode 100644 index 000000000000..e91c709cba2e --- /dev/null +++ b/modules/services/mail/spamassassin.nix @@ -0,0 +1,45 @@ +{ config, pkgs, ... }: + +with pkgs.lib; + +let + + cfg = config.services.spamassassin; + +in + +{ + + ###### interface + + options = { + + services.spamassassin = { + + enable = mkOption { + default = false; + description = "Whether to run the SpamAssassin daemon."; + }; + + }; + + }; + + + ###### implementation + + config = mkIf cfg.enable { + + # This makes comfortable for users to run 'spamassassin'. + environment.systemPackages = [ pkgs.spamassassin ]; + + jobs.spamd = { + description = "Spam Assassin Server"; + startOn = "started networking and filesystem"; + environment.TZ = config.time.timeZone; + exec = "spamd -C /etc/spamassassin/init.pre --siteconfigpath=/etc/spamassassin --debug --pidfile=/var/run/spamd.pid"; + }; + + }; + +} From 29f721ba541588c514cac63f8ba5b675341cb14a Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Fri, 3 Aug 2012 09:34:27 -0400 Subject: [PATCH 06/41] Only create the Apache user/group if it's "wwwrun" --- modules/services/web-servers/apache-httpd/default.nix | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/modules/services/web-servers/apache-httpd/default.nix b/modules/services/web-servers/apache-httpd/default.nix index a101b077e47e..90c0adee2a7b 100644 --- a/modules/services/web-servers/apache-httpd/default.nix +++ b/modules/services/web-servers/apache-httpd/default.nix @@ -557,14 +557,14 @@ in config = mkIf config.services.httpd.enable { - users.extraUsers = singleton - { name = mainCfg.user; - group = mainCfg.group; + users.extraUsers = optionalAttrs (mainCfg.user == "wwwrun") singleton + { name = "wwwrun"; + group = "wwwrun"; description = "Apache httpd user"; }; - users.extraGroups = singleton - { name = mainCfg.group; + users.extraGroups = optionalAttrs (mainCfg.group == "wwwrun") singleton + { name = "wwwrun"; }; environment.systemPackages = [httpd] ++ concatMap (svc: svc.extraPath) allSubservices; From 0ef085d58a8307bfe6ba5a108a063a9e41a2549d Mon Sep 17 00:00:00 2001 From: Peter Simons Date: Fri, 27 Jul 2012 00:38:19 +0200 Subject: [PATCH 07/41] Add services.httpd.fixUidAndGid option to assign reliable numeric UID and GID for the Apache user. The option is disabled by default so that previously existing installations aren't affected. If you'd like to migrate to the fixed numeric id for Apache, set "fixUidAndGid = true", edit the file "/etc/groups" and replace the old GID value with 54. (NixOS can't do that for you because it refuses to change a GID that identifies the primary group of a user.) Then run find / -xdev -uid $oldUID -exec chown 54 {} + find / -xdev -gid $oldGID -exec chgrp 54 {} + to update ownership of all files that are supposed to be owned by Apache. --- modules/misc/ids.nix | 4 ++++ .../web-servers/apache-httpd/default.nix | 24 ++++++++++++++----- 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/modules/misc/ids.nix b/modules/misc/ids.nix index 13ebf954f329..eb78b32f542e 100644 --- a/modules/misc/ids.nix +++ b/modules/misc/ids.nix @@ -72,6 +72,7 @@ in clamav = 51; fprot = 52; bind = 53; + wwwrun = 54; # When adding a uid, make sure it doesn't match an existing gid. @@ -123,6 +124,9 @@ in mpd = 50; clamav = 51; fprot = 52; + # Group id 53 is still free! I didn't use it, because I wanted the + # the same numeric value for the 'wwwrun' user and group. + wwwrun = 54; # When adding a gid, make sure it doesn't match an existing uid. diff --git a/modules/services/web-servers/apache-httpd/default.nix b/modules/services/web-servers/apache-httpd/default.nix index 90c0adee2a7b..248c013bf38a 100644 --- a/modules/services/web-servers/apache-httpd/default.nix +++ b/modules/services/web-servers/apache-httpd/default.nix @@ -407,7 +407,7 @@ in package = mkOption { default = pkgs.apacheHttpd.override { mpm = mainCfg.multiProcessingModule; }; - example = "pkgs.apacheHttpd_2_4"; + example = "pkgs.apacheHttpd_2_4"; description = " Overridable attribute of the Apache HTTP Server package to use. "; @@ -415,7 +415,7 @@ in configFile = mkOption { default = confFile; - example = ''pkgs.writeText "httpd.conf" "# my custom config file ...";''; + example = ''pkgs.writeText "httpd.conf" "# my custom config file ...";''; description = " Overridable config file to use for Apache. By default, use the file automatically generated by nixos. @@ -469,6 +469,18 @@ in "; }; + fixUidAndGid = mkOption { + default = false; + description = " + Use a fixed numeric ID (54) for the wwwrun user + and group. This setting is disabled by default for the sake of + backwards compatibility: we don't want to break pre-existing + installations that alrady have a user/group for Apache with different + values for that ID. If you're installing a fresh server, however, + choosing the fixed numeric values for those IDs is safe. + "; + }; + logDir = mkOption { default = "/var/log/httpd"; description = " @@ -558,14 +570,14 @@ in config = mkIf config.services.httpd.enable { users.extraUsers = optionalAttrs (mainCfg.user == "wwwrun") singleton - { name = "wwwrun"; + ({ name = "wwwrun"; group = "wwwrun"; description = "Apache httpd user"; - }; + } // (if mainCfg.fixUidAndGid then { uid = config.ids.uids.wwwrun; } else {})); users.extraGroups = optionalAttrs (mainCfg.group == "wwwrun") singleton - { name = "wwwrun"; - }; + ({ name = "wwwrun"; + } // (if mainCfg.fixUidAndGid then { gid = config.ids.gids.wwwrun; } else {})); environment.systemPackages = [httpd] ++ concatMap (svc: svc.extraPath) allSubservices; From 0a0c28f8129e81a23163adadb9ca6f65061ab736 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Fri, 3 Aug 2012 10:52:53 -0400 Subject: [PATCH 08/41] Revert "Add services.httpd.fixUidAndGid option to assign reliable numeric UID and GID for the Apache user." This reverts commit 0ef085d58a8307bfe6ba5a108a063a9e41a2549d. --- modules/misc/ids.nix | 4 ---- .../web-servers/apache-httpd/default.nix | 24 +++++-------------- 2 files changed, 6 insertions(+), 22 deletions(-) diff --git a/modules/misc/ids.nix b/modules/misc/ids.nix index eb78b32f542e..13ebf954f329 100644 --- a/modules/misc/ids.nix +++ b/modules/misc/ids.nix @@ -72,7 +72,6 @@ in clamav = 51; fprot = 52; bind = 53; - wwwrun = 54; # When adding a uid, make sure it doesn't match an existing gid. @@ -124,9 +123,6 @@ in mpd = 50; clamav = 51; fprot = 52; - # Group id 53 is still free! I didn't use it, because I wanted the - # the same numeric value for the 'wwwrun' user and group. - wwwrun = 54; # When adding a gid, make sure it doesn't match an existing uid. diff --git a/modules/services/web-servers/apache-httpd/default.nix b/modules/services/web-servers/apache-httpd/default.nix index 248c013bf38a..90c0adee2a7b 100644 --- a/modules/services/web-servers/apache-httpd/default.nix +++ b/modules/services/web-servers/apache-httpd/default.nix @@ -407,7 +407,7 @@ in package = mkOption { default = pkgs.apacheHttpd.override { mpm = mainCfg.multiProcessingModule; }; - example = "pkgs.apacheHttpd_2_4"; + example = "pkgs.apacheHttpd_2_4"; description = " Overridable attribute of the Apache HTTP Server package to use. "; @@ -415,7 +415,7 @@ in configFile = mkOption { default = confFile; - example = ''pkgs.writeText "httpd.conf" "# my custom config file ...";''; + example = ''pkgs.writeText "httpd.conf" "# my custom config file ...";''; description = " Overridable config file to use for Apache. By default, use the file automatically generated by nixos. @@ -469,18 +469,6 @@ in "; }; - fixUidAndGid = mkOption { - default = false; - description = " - Use a fixed numeric ID (54) for the wwwrun user - and group. This setting is disabled by default for the sake of - backwards compatibility: we don't want to break pre-existing - installations that alrady have a user/group for Apache with different - values for that ID. If you're installing a fresh server, however, - choosing the fixed numeric values for those IDs is safe. - "; - }; - logDir = mkOption { default = "/var/log/httpd"; description = " @@ -570,14 +558,14 @@ in config = mkIf config.services.httpd.enable { users.extraUsers = optionalAttrs (mainCfg.user == "wwwrun") singleton - ({ name = "wwwrun"; + { name = "wwwrun"; group = "wwwrun"; description = "Apache httpd user"; - } // (if mainCfg.fixUidAndGid then { uid = config.ids.uids.wwwrun; } else {})); + }; users.extraGroups = optionalAttrs (mainCfg.group == "wwwrun") singleton - ({ name = "wwwrun"; - } // (if mainCfg.fixUidAndGid then { gid = config.ids.gids.wwwrun; } else {})); + { name = "wwwrun"; + }; environment.systemPackages = [httpd] ++ concatMap (svc: svc.extraPath) allSubservices; From 23cb924fbfa4bebd4843cbe61b5c4fe3592c590c Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Fri, 3 Aug 2012 11:03:56 -0400 Subject: [PATCH 09/41] Don't try to change the uid/gid of existing users Unless we search the entire filesystem to do a chown *and* restart existing processes owned by that user, there is no sensible way that we can change uids/gids. So don't try. --- modules/config/users-groups.nix | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/modules/config/users-groups.nix b/modules/config/users-groups.nix index 598d68eb91db..76b6c2854a9c 100644 --- a/modules/config/users-groups.nix +++ b/modules/config/users-groups.nix @@ -265,15 +265,11 @@ in oldIFS="$IFS"; IFS=:; set -- $curEnt; IFS="$oldIFS" prevUid=$3 prevHome=$6 - # Don't change the UID if it's the same, otherwise usermod - # will complain. - if test "$prevUid" = "$uid"; then unset uid; fi # Don't change the home directory if it's the same to prevent # unnecessary warnings about logged in users. if test "$prevHome" = "$home"; then unset home; fi usermod \ --comment "$description" \ - ''${uid:+--uid $uid} \ --gid "$group" \ --groups "$extraGroups" \ ''${home:+--home "$home"} \ @@ -296,13 +292,6 @@ in groupadd --system \ ''${gid:+--gid $gid} \ "$name" - else - #echo "updating group $name..." - oldIFS="$IFS"; IFS=:; set -- $curEnt; IFS="$oldIFS" - prevGid=$3 - if test -n "$gid" -a "$prevGid" != "$gid"; then - groupmod --gid $gid "$name" - fi fi } From d5d8acfacd008bdc2a722101da0e65622c1af73a Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Fri, 3 Aug 2012 11:05:25 -0400 Subject: [PATCH 10/41] Assign uid/gid 54 to wwwrun --- modules/misc/ids.nix | 2 ++ modules/services/web-servers/apache-httpd/default.nix | 2 ++ 2 files changed, 4 insertions(+) diff --git a/modules/misc/ids.nix b/modules/misc/ids.nix index 13ebf954f329..bd38b5f9a42e 100644 --- a/modules/misc/ids.nix +++ b/modules/misc/ids.nix @@ -72,6 +72,7 @@ in clamav = 51; fprot = 52; bind = 53; + wwwrun = 54; # When adding a uid, make sure it doesn't match an existing gid. @@ -123,6 +124,7 @@ in mpd = 50; clamav = 51; fprot = 52; + wwwrun = 54; # When adding a gid, make sure it doesn't match an existing uid. diff --git a/modules/services/web-servers/apache-httpd/default.nix b/modules/services/web-servers/apache-httpd/default.nix index 90c0adee2a7b..9ceb66a85a0a 100644 --- a/modules/services/web-servers/apache-httpd/default.nix +++ b/modules/services/web-servers/apache-httpd/default.nix @@ -561,10 +561,12 @@ in { name = "wwwrun"; group = "wwwrun"; description = "Apache httpd user"; + uid = config.ids.uids.wwwrun; }; users.extraGroups = optionalAttrs (mainCfg.group == "wwwrun") singleton { name = "wwwrun"; + gid = config.ids.gids.wwwrun; }; environment.systemPackages = [httpd] ++ concatMap (svc: svc.extraPath) allSubservices; From d13a3c741a151cae307be52a26ed9f17f2c000b4 Mon Sep 17 00:00:00 2001 From: Peter Simons Date: Fri, 3 Aug 2012 18:07:06 +0200 Subject: [PATCH 11/41] spamassassin: call daemon with complete path --- modules/services/mail/spamassassin.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/services/mail/spamassassin.nix b/modules/services/mail/spamassassin.nix index e91c709cba2e..69d3c390bc93 100644 --- a/modules/services/mail/spamassassin.nix +++ b/modules/services/mail/spamassassin.nix @@ -30,14 +30,14 @@ in config = mkIf cfg.enable { - # This makes comfortable for users to run 'spamassassin'. + # Allow users to run 'spamc'. environment.systemPackages = [ pkgs.spamassassin ]; jobs.spamd = { description = "Spam Assassin Server"; startOn = "started networking and filesystem"; environment.TZ = config.time.timeZone; - exec = "spamd -C /etc/spamassassin/init.pre --siteconfigpath=/etc/spamassassin --debug --pidfile=/var/run/spamd.pid"; + exec = "${pkgs.spamassassin}/bin/spamd -C /etc/spamassassin/init.pre --siteconfigpath=/etc/spamassassin --debug --pidfile=/var/run/spamd.pid"; }; }; From 1b615f460bc40cf2697d7e972bad3091cf87ceaf Mon Sep 17 00:00:00 2001 From: Shea Levy Date: Sat, 4 Aug 2012 09:45:26 -0400 Subject: [PATCH 12/41] Allow overriding all NixOS tests to run with the minimal kernel possible for that test's config(s) (based on requiredKernelConfig) --- lib/build-vms.nix | 4 ++-- lib/testing.nix | 4 ++-- modules/testing/minimal-kernel.nix | 28 ++++++++++++++++++++++ release.nix | 6 ++--- tests/default.nix | 5 ++-- tests/minimal-kernel.nix | 37 ------------------------------ 6 files changed, 37 insertions(+), 47 deletions(-) create mode 100644 modules/testing/minimal-kernel.nix delete mode 100644 tests/minimal-kernel.nix diff --git a/lib/build-vms.nix b/lib/build-vms.nix index e8e5885137d6..aacd0e99cb18 100644 --- a/lib/build-vms.nix +++ b/lib/build-vms.nix @@ -1,4 +1,4 @@ -{ system }: +{ system, minimal ? false }: let pkgs = import { config = {}; inherit system; }; in @@ -27,7 +27,7 @@ rec { [ ../modules/virtualisation/qemu-vm.nix ../modules/testing/test-instrumentation.nix # !!! should only get added for automated test runs { key = "no-manual"; services.nixosManual.enable = false; } - ]; + ] ++ lib.optional minimal ../modules/testing/minimal-kernel.nix; extraArgs = { inherit nodes; }; }; diff --git a/lib/testing.nix b/lib/testing.nix index 6a39df8c865d..a27f4344c6ae 100644 --- a/lib/testing.nix +++ b/lib/testing.nix @@ -1,6 +1,6 @@ -{ system }: +{ system, minimal ? false }: -with import ./build-vms.nix { inherit system; }; +with import ./build-vms.nix { inherit system minimal; }; with pkgs; rec { diff --git a/modules/testing/minimal-kernel.nix b/modules/testing/minimal-kernel.nix new file mode 100644 index 000000000000..0ad20bbf75a2 --- /dev/null +++ b/modules/testing/minimal-kernel.nix @@ -0,0 +1,28 @@ +{ config, pkgs, ... }: + +let + configfile = builtins.storePath (builtins.toFile "config" (pkgs.lib.concatStringsSep "\n" + (map (builtins.getAttr "configLine") config.system.requiredKernelConfig)) + ); + + origKernel = pkgs.linuxManualConfig { + inherit (pkgs.linux) src version; + inherit configfile; + allowImportFromDerivation = true; + kernelPatches = [ pkgs.kernelPatches.cifs_timeout_2_6_38 ]; + }; + + kernel = origKernel // (derivation (origKernel.drvAttrs // { + configurePhase = '' + runHook preConfigure + mkdir ../build + make $makeFlags "''${makeFlagsArray[@]}" mrproper + make $makeFlags "''${makeFlagsArray[@]}" KCONFIG_ALLCONFIG=${configfile} allnoconfig + runHook postConfigure + ''; + })); + + kernelPackages = pkgs.linuxPackagesFor kernel kernelPackages; +in { + boot.kernelPackages = kernelPackages; +} diff --git a/release.nix b/release.nix index 9f76ee4a254c..10cea94881f2 100644 --- a/release.nix +++ b/release.nix @@ -1,5 +1,6 @@ { nixosSrc ? {outPath = ./.; revCount = 1234; shortRev = "abcdef"; } , nixpkgs ? {outPath = ; revCount = 5678; shortRev = "fedcba"; } +, minimal ? false }: let @@ -194,8 +195,8 @@ let tests = let - t = import ./tests { system = "i686-linux"; }; - t_64 = import ./tests { system = "x86_64-linux"; }; + t = import ./tests { system = "i686-linux"; inherit minimal; }; + t_64 = import ./tests { system = "x86_64-linux"; inherit minimal; }; in { avahi = t.avahi.test; bittorrent = t.bittorrent.test; @@ -212,7 +213,6 @@ let kde4 = t.kde4.test; login = t.login.test; misc = t.misc.test; - minimal_kernel = t.minimal_kernel.test; mpich = t.mpich.test; mysql = t.mysql.test; mysql_replication = t.mysql_replication.test; diff --git a/tests/default.nix b/tests/default.nix index 2433826a9d17..0d2c3102a646 100644 --- a/tests/default.nix +++ b/tests/default.nix @@ -1,6 +1,6 @@ -{ system ? builtins.currentSystem }: +{ system ? builtins.currentSystem, minimal ? false }: -with import ../lib/testing.nix { inherit system; }; +with import ../lib/testing.nix { inherit system minimal; }; { avahi = makeTest (import ./avahi.nix); @@ -11,7 +11,6 @@ with import ../lib/testing.nix { inherit system; }; ipv6 = makeTest (import ./ipv6.nix); kde4 = makeTest (import ./kde4.nix); login = makeTest (import ./login.nix); - minimal_kernel = makeTest (import ./minimal-kernel.nix); misc = makeTest (import ./misc.nix); mpich = makeTest (import ./mpich.nix); mysql = makeTest (import ./mysql.nix); diff --git a/tests/minimal-kernel.nix b/tests/minimal-kernel.nix deleted file mode 100644 index e27b39d17643..000000000000 --- a/tests/minimal-kernel.nix +++ /dev/null @@ -1,37 +0,0 @@ -{ pkgs, ... }: - - -{ - machine = { config, pkgs, ... }: - let - configfile = builtins.storePath (builtins.toFile "config" (pkgs.lib.concatStringsSep "\n" - (map (builtins.getAttr "configLine") config.system.requiredKernelConfig))); - - origKernel = pkgs.linuxManualConfig { - inherit (pkgs.linux) src version; - inherit configfile; - allowImportFromDerivation = true; - kernelPatches = [ pkgs.kernelPatches.cifs_timeout_2_6_38 ]; - }; - - kernel = origKernel //(derivation (origKernel.drvAttrs // { - configurePhase = '' - runHook preConfigure - mkdir ../build - make $makeFlags "''${makeFlagsArray[@]}" mrproper - make $makeFlags "''${makeFlagsArray[@]}" KCONFIG_ALLCONFIG=${configfile} allnoconfig - runHook postConfigure - ''; - })); - - kernelPackages = pkgs.linuxPackagesFor kernel kernelPackages; - in { - boot.kernelPackages = kernelPackages; - }; - - testScript = - '' - startAll; - $machine->shutdown; - ''; -} From e66bcbd58a1a4691023c0d3c466d3ad4bd28255f Mon Sep 17 00:00:00 2001 From: Shea Levy Date: Mon, 6 Aug 2012 08:13:06 -0400 Subject: [PATCH 13/41] The kernel needs SERIAL_8250_CONSOLE when using a real serial port as a console --- modules/testing/test-instrumentation.nix | 4 ++++ modules/virtualisation/qemu-vm.nix | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/modules/testing/test-instrumentation.nix b/modules/testing/test-instrumentation.nix index b18e4263c2db..6a7f559c3795 100644 --- a/modules/testing/test-instrumentation.nix +++ b/modules/testing/test-instrumentation.nix @@ -94,6 +94,10 @@ in system.upstartEnvironment.GCOV_PREFIX = "/tmp/xchg/coverage-data"; + system.requiredKernelConfig = with config.lib.kernelConfig; [ + (isYes "SERIAL_8250_CONSOLE") + (isYes "SERIAL_8250") + ]; }; } diff --git a/modules/virtualisation/qemu-vm.nix b/modules/virtualisation/qemu-vm.nix index dd8b457d43c7..0e9804751bec 100644 --- a/modules/virtualisation/qemu-vm.nix +++ b/modules/virtualisation/qemu-vm.nix @@ -385,4 +385,9 @@ in # Wireless won't work in the VM. networking.wireless.enable = mkOverride 50 false; + + system.requiredKernelConfig = optional (!cfg.graphics) (with config.lib.kernelConfig; [ + (isYes "SERIAL_8250_CONSOLE") + (isYes "SERIAL_8250") + ]); } From e33dfa936f9c16545fe85f1b837ed402651b75df Mon Sep 17 00:00:00 2001 From: Rickard Nilsson Date: Mon, 6 Aug 2012 20:05:35 +0200 Subject: [PATCH 14/41] Use busybox mount instead of klibc nfsmount for nfs mounts in initrd. --- modules/system/boot/stage-1-init.sh | 6 +----- modules/tasks/filesystems/nfs.nix | 6 ------ 2 files changed, 1 insertion(+), 11 deletions(-) diff --git a/modules/system/boot/stage-1-init.sh b/modules/system/boot/stage-1-init.sh index 112d3798aec5..824c19f0df58 100644 --- a/modules/system/boot/stage-1-init.sh +++ b/modules/system/boot/stage-1-init.sh @@ -266,11 +266,7 @@ mountFS() { # For CIFS mounts, retry a few times before giving up. local n=0 while true; do - if [ "$fsType" = "nfs" ]; then - nfsmount "$device" "/mnt-root$mountPoint" && break - else - mount "/mnt-root$mountPoint" && break - fi + mount "/mnt-root$mountPoint" && break if [ "$fsType" != cifs -o "$n" -ge 10 ]; then fail; break; fi echo "retrying..." n=$((n + 1)) diff --git a/modules/tasks/filesystems/nfs.nix b/modules/tasks/filesystems/nfs.nix index 0ed76a9db774..491d2de8f24e 100644 --- a/modules/tasks/filesystems/nfs.nix +++ b/modules/tasks/filesystems/nfs.nix @@ -40,12 +40,6 @@ in boot.initrd.kernelModules = mkIf inInitrd [ "nfs" ]; - boot.initrd.extraUtilsCommands = mkIf inInitrd - '' - # !!! Uh, why don't we just install mount.nfs? - cp -v ${pkgs.klibc}/lib/klibc/bin.static/nfsmount $out/bin - ''; - # Ensure that statd and idmapd are started before mountall. jobs.mountall.preStart = '' From 64d0069be30f0a8358a1dc178cd15d0d9892ee35 Mon Sep 17 00:00:00 2001 From: Shea Levy Date: Mon, 6 Aug 2012 17:02:35 -0400 Subject: [PATCH 15/41] udev requires unix sockets and inotify --- modules/services/hardware/udev.nix | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/modules/services/hardware/udev.nix b/modules/services/hardware/udev.nix index 3bbf24bb3791..174d31c6c008 100644 --- a/modules/services/hardware/udev.nix +++ b/modules/services/hardware/udev.nix @@ -263,6 +263,11 @@ in ''; }; + system.requiredKernelConfig = with config.lib.kernelConfig; [ + (isEnabled "UNIX") + (isYes "INOTIFY_USER") + (isYes "NET") + ]; }; } From 11e5207a2d20d4eb557bc60339e193283141d0d9 Mon Sep 17 00:00:00 2001 From: Shea Levy Date: Mon, 6 Aug 2012 17:10:54 -0400 Subject: [PATCH 16/41] qemu requires VIRTIO_BLK (and dependencies) for virtio drives --- modules/virtualisation/qemu-vm.nix | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/modules/virtualisation/qemu-vm.nix b/modules/virtualisation/qemu-vm.nix index 0e9804751bec..e0561d479cf0 100644 --- a/modules/virtualisation/qemu-vm.nix +++ b/modules/virtualisation/qemu-vm.nix @@ -386,8 +386,14 @@ in # Wireless won't work in the VM. networking.wireless.enable = mkOverride 50 false; - system.requiredKernelConfig = optional (!cfg.graphics) (with config.lib.kernelConfig; [ + system.requiredKernelConfig = with config.lib.kernelConfig; [ + (isEnabled "VIRTIO_BLK") + (isEnabled "VIRTIO_PCI") + (isYes "BLK_DEV") + (isYes "PCI") + (isYes "EXPERIMENTAL") + ] ++ optional (!cfg.graphics) [ (isYes "SERIAL_8250_CONSOLE") (isYes "SERIAL_8250") - ]); + ]; } From 0ea2643c630640a274c1bd720e8f3138d74717db Mon Sep 17 00:00:00 2001 From: Shea Levy Date: Tue, 7 Aug 2012 06:57:01 -0400 Subject: [PATCH 17/41] The initrd mounts some tmpfses --- modules/system/boot/stage-1.nix | 3 +++ 1 file changed, 3 insertions(+) diff --git a/modules/system/boot/stage-1.nix b/modules/system/boot/stage-1.nix index 02a75ae21c46..aa86f14066da 100644 --- a/modules/system/boot/stage-1.nix +++ b/modules/system/boot/stage-1.nix @@ -321,4 +321,7 @@ in { system.build.initialRamdisk = initialRamdisk; system.build.extraUtils = extraUtils; + system.requiredKernelConfig = with config.lib.kernelConfig; [ + (isYes "TMPFS") + ]; } From 805d37db481431ec2a1a007a4c82dcca554f1092 Mon Sep 17 00:00:00 2001 From: Shea Levy Date: Tue, 7 Aug 2012 07:02:08 -0400 Subject: [PATCH 18/41] qemu-vm creates an ext3 filesystem --- modules/virtualisation/qemu-vm.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/virtualisation/qemu-vm.nix b/modules/virtualisation/qemu-vm.nix index e0561d479cf0..3d71a5356c63 100644 --- a/modules/virtualisation/qemu-vm.nix +++ b/modules/virtualisation/qemu-vm.nix @@ -389,6 +389,7 @@ in system.requiredKernelConfig = with config.lib.kernelConfig; [ (isEnabled "VIRTIO_BLK") (isEnabled "VIRTIO_PCI") + (isEnabled "EXT3_FS") (isYes "BLK_DEV") (isYes "PCI") (isYes "EXPERIMENTAL") From 66ff6a382a9b992d41a13f5112ce80e35b409f4a Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Tue, 7 Aug 2012 10:05:33 -0400 Subject: [PATCH 19/41] stage-1-init: Close temporary file descriptor Otherwise this fd will be inherited all the way into the Upstart jobs. --- modules/system/boot/stage-1-init.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/modules/system/boot/stage-1-init.sh b/modules/system/boot/stage-1-init.sh index 824c19f0df58..593b9397e66b 100644 --- a/modules/system/boot/stage-1-init.sh +++ b/modules/system/boot/stage-1-init.sh @@ -329,6 +329,8 @@ while read -u 3 mountPoint; do mountFS "$device" "$mountPoint" "$options" "$fsType" done +exec 3>&- + @postMountCommands@ From 13d8856a4f431be07b9e6335583ab1e82276f9b7 Mon Sep 17 00:00:00 2001 From: Shea Levy Date: Tue, 7 Aug 2012 16:25:11 -0400 Subject: [PATCH 20/41] qemu requires VIRTIO_NET (and dependencies) for virtio networking --- modules/virtualisation/qemu-vm.nix | 3 +++ 1 file changed, 3 insertions(+) diff --git a/modules/virtualisation/qemu-vm.nix b/modules/virtualisation/qemu-vm.nix index 3d71a5356c63..d04b39763416 100644 --- a/modules/virtualisation/qemu-vm.nix +++ b/modules/virtualisation/qemu-vm.nix @@ -389,10 +389,13 @@ in system.requiredKernelConfig = with config.lib.kernelConfig; [ (isEnabled "VIRTIO_BLK") (isEnabled "VIRTIO_PCI") + (isEnabled "VIRTIO_NET") (isEnabled "EXT3_FS") (isYes "BLK_DEV") (isYes "PCI") (isYes "EXPERIMENTAL") + (isYes "NETDEVICES") + (isYes "NET_CORE") ] ++ optional (!cfg.graphics) [ (isYes "SERIAL_8250_CONSOLE") (isYes "SERIAL_8250") From 9d8ddd90f9e98b82b56655705b35aecf6181ee14 Mon Sep 17 00:00:00 2001 From: Shea Levy Date: Tue, 7 Aug 2012 16:44:15 -0400 Subject: [PATCH 21/41] qemu mounts /nix/store via CIFS --- modules/virtualisation/qemu-vm.nix | 3 +++ 1 file changed, 3 insertions(+) diff --git a/modules/virtualisation/qemu-vm.nix b/modules/virtualisation/qemu-vm.nix index d04b39763416..17f19537115e 100644 --- a/modules/virtualisation/qemu-vm.nix +++ b/modules/virtualisation/qemu-vm.nix @@ -391,11 +391,14 @@ in (isEnabled "VIRTIO_PCI") (isEnabled "VIRTIO_NET") (isEnabled "EXT3_FS") + (isEnabled "CIFS") (isYes "BLK_DEV") (isYes "PCI") (isYes "EXPERIMENTAL") (isYes "NETDEVICES") (isYes "NET_CORE") + (isYes "INET") + (isYes "NETWORK_FILESYSTEMS") ] ++ optional (!cfg.graphics) [ (isYes "SERIAL_8250_CONSOLE") (isYes "SERIAL_8250") From d28876ea70ff939b4555deca5dad6e532d420825 Mon Sep 17 00:00:00 2001 From: Shea Levy Date: Tue, 7 Aug 2012 17:04:00 -0400 Subject: [PATCH 22/41] qemu tests use the virtio console to run commands --- modules/testing/test-instrumentation.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/testing/test-instrumentation.nix b/modules/testing/test-instrumentation.nix index 6a7f559c3795..9d36538ea088 100644 --- a/modules/testing/test-instrumentation.nix +++ b/modules/testing/test-instrumentation.nix @@ -97,6 +97,7 @@ in system.requiredKernelConfig = with config.lib.kernelConfig; [ (isYes "SERIAL_8250_CONSOLE") (isYes "SERIAL_8250") + (isEnabled "VIRTIO_CONSOLE") ]; }; From d9c03b64479cc04d3f78b3c43b6ddecd52c17add Mon Sep 17 00:00:00 2001 From: Shea Levy Date: Tue, 7 Aug 2012 17:34:10 -0400 Subject: [PATCH 23/41] The kernel needs swap support if swapDevices are enabled --- modules/config/swap.nix | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/modules/config/swap.nix b/modules/config/swap.nix index 163de568d0f7..5b20f657e129 100644 --- a/modules/config/swap.nix +++ b/modules/config/swap.nix @@ -73,4 +73,10 @@ with pkgs.lib; }; + config = mkIf ((length config.swapDevices) != 0) { + system.requiredKernelConfig = with config.lib.kernelConfig; [ + (isYes "SWAP") + ]; + }; + } From c39f493ebb4b619e2b6d2cfd4e12c531861213c8 Mon Sep 17 00:00:00 2001 From: Shea Levy Date: Tue, 7 Aug 2012 18:09:08 -0400 Subject: [PATCH 24/41] Minor reorganization --- modules/system/boot/kernel.nix | 2 +- modules/system/boot/stage-1.nix | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/system/boot/kernel.nix b/modules/system/boot/kernel.nix index ab9961960795..62b68c560d13 100644 --- a/modules/system/boot/kernel.nix +++ b/modules/system/boot/kernel.nix @@ -228,8 +228,8 @@ let kernel = config.boot.kernelPackages.kernel; in # The config options that all modules can depend upon system.requiredKernelConfig = with config.lib.kernelConfig; [ + # !!! Should this really be needed? (isYes "MODULES") - (isYes "BLK_DEV_INITRD") (isYes "BINFMT_ELF") ]; diff --git a/modules/system/boot/stage-1.nix b/modules/system/boot/stage-1.nix index aa86f14066da..01ecd839f556 100644 --- a/modules/system/boot/stage-1.nix +++ b/modules/system/boot/stage-1.nix @@ -323,5 +323,6 @@ in { system.requiredKernelConfig = with config.lib.kernelConfig; [ (isYes "TMPFS") + (isYes "BLK_DEV_INITRD") ]; } From da787e307140b4f4144f592d16e3a2dfbfd40cf1 Mon Sep 17 00:00:00 2001 From: Shea Levy Date: Wed, 8 Aug 2012 23:02:46 -0400 Subject: [PATCH 25/41] efi-boot-stub: List required kernel config --- .../system/boot/loader/efi-boot-stub/efi-boot-stub.nix | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/modules/system/boot/loader/efi-boot-stub/efi-boot-stub.nix b/modules/system/boot/loader/efi-boot-stub/efi-boot-stub.nix index a4e0ebd9845f..099cdefe1428 100644 --- a/modules/system/boot/loader/efi-boot-stub/efi-boot-stub.nix +++ b/modules/system/boot/loader/efi-boot-stub/efi-boot-stub.nix @@ -113,6 +113,7 @@ let platform = pkgs.stdenv.platform; in { + assertions = [ { assertion = ! config.boot.kernelPackages.kernel ? features || config.boot.kernelPackages.kernel.features ? efiBootStub; message = "This kernel does not support the EFI boot stub"; } ]; require = [ options @@ -120,11 +121,13 @@ in # ../system/system-options.nix ]; - system = mkIf (config.boot.loader.efiBootStub.enable && (assert - (config.boot.kernelPackages.kernel.features ? efiBootStub && - config.boot.kernelPackages.kernel.features.efiBootStub); true)) { + system = { build.installBootLoader = efiBootStubBuilder; boot.loader.id = "efiBootStub"; boot.loader.kernelFile = platform.kernelTarget; + requiredKernelConfig = with config.lib.kernelConfig; [ + (isYes "EFI_STUB") + ]; }; + } From 5ae63851756bade63377f8de9dc6dd3bf3f90d1d Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Wed, 8 Aug 2012 14:20:41 -0400 Subject: [PATCH 26/41] qemu-vm.nix: Use ext4 instead of ext3 --- modules/virtualisation/qemu-vm.nix | 40 +++++++++++++++--------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/modules/virtualisation/qemu-vm.nix b/modules/virtualisation/qemu-vm.nix index 17f19537115e..1de8d5b82ed7 100644 --- a/modules/virtualisation/qemu-vm.nix +++ b/modules/virtualisation/qemu-vm.nix @@ -211,7 +211,7 @@ let . /sys/class/block/vda1/uevent mknod /dev/vda1 b $MAJOR $MINOR . /sys/class/block/vda/uevent - ${pkgs.e2fsprogs}/sbin/mkfs.ext3 -L boot /dev/vda1 + ${pkgs.e2fsprogs}/sbin/mkfs.ext4 -L boot /dev/vda1 ${pkgs.e2fsprogs}/sbin/tune2fs -c 0 -i 0 /dev/vda1 # Mount /boot. @@ -264,7 +264,7 @@ in # initialise. FSTYPE=$(blkid -o value -s TYPE /dev/vda || true) if test -z "$FSTYPE"; then - mke2fs -t ext3 /dev/vda + mke2fs -t ext4 /dev/vda fi ''; @@ -331,7 +331,7 @@ in ] ++ optional cfg.useBootLoader { mountPoint = "/boot"; device = "/dev/disk/by-label/boot"; - fsType = "ext3"; + fsType = "ext4"; options = "ro"; noCheck = true; # fsck fails on a r/o filesystem }); @@ -386,21 +386,21 @@ in # Wireless won't work in the VM. networking.wireless.enable = mkOverride 50 false; - system.requiredKernelConfig = with config.lib.kernelConfig; [ - (isEnabled "VIRTIO_BLK") - (isEnabled "VIRTIO_PCI") - (isEnabled "VIRTIO_NET") - (isEnabled "EXT3_FS") - (isEnabled "CIFS") - (isYes "BLK_DEV") - (isYes "PCI") - (isYes "EXPERIMENTAL") - (isYes "NETDEVICES") - (isYes "NET_CORE") - (isYes "INET") - (isYes "NETWORK_FILESYSTEMS") - ] ++ optional (!cfg.graphics) [ - (isYes "SERIAL_8250_CONSOLE") - (isYes "SERIAL_8250") - ]; + system.requiredKernelConfig = with config.lib.kernelConfig; + [ (isEnabled "VIRTIO_BLK") + (isEnabled "VIRTIO_PCI") + (isEnabled "VIRTIO_NET") + (isEnabled "EXT4_FS") + (isEnabled "CIFS") + (isYes "BLK_DEV") + (isYes "PCI") + (isYes "EXPERIMENTAL") + (isYes "NETDEVICES") + (isYes "NET_CORE") + (isYes "INET") + (isYes "NETWORK_FILESYSTEMS") + ] ++ optional (!cfg.graphics) [ + (isYes "SERIAL_8250_CONSOLE") + (isYes "SERIAL_8250") + ]; } From 6b2a14d69842cb3aed970fecb13375e18bce6e92 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Thu, 9 Aug 2012 10:04:25 -0400 Subject: [PATCH 27/41] Fix NixOS evaluation --- modules/system/boot/loader/efi-boot-stub/efi-boot-stub.nix | 3 ++- release.nix | 6 +++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/modules/system/boot/loader/efi-boot-stub/efi-boot-stub.nix b/modules/system/boot/loader/efi-boot-stub/efi-boot-stub.nix index 099cdefe1428..59d9957ef5fa 100644 --- a/modules/system/boot/loader/efi-boot-stub/efi-boot-stub.nix +++ b/modules/system/boot/loader/efi-boot-stub/efi-boot-stub.nix @@ -113,7 +113,8 @@ let platform = pkgs.stdenv.platform; in { - assertions = [ { assertion = ! config.boot.kernelPackages.kernel ? features || config.boot.kernelPackages.kernel.features ? efiBootStub; message = "This kernel does not support the EFI boot stub"; } ]; + #assertions = [ { assertion = ! config.boot.kernelPackages.kernel ? features || config.boot.kernelPackages.kernel.features ? efiBootStub; message = "This kernel does not support the EFI boot stub"; } ]; + require = [ options diff --git a/release.nix b/release.nix index 10cea94881f2..b32ce233ec05 100644 --- a/release.nix +++ b/release.nix @@ -1,6 +1,6 @@ { nixosSrc ? {outPath = ./.; revCount = 1234; shortRev = "abcdef"; } , nixpkgs ? {outPath = ; revCount = 5678; shortRev = "fedcba"; } -, minimal ? false +#, minimal ? false }: let @@ -195,8 +195,8 @@ let tests = let - t = import ./tests { system = "i686-linux"; inherit minimal; }; - t_64 = import ./tests { system = "x86_64-linux"; inherit minimal; }; + t = import ./tests { system = "i686-linux"; }; + t_64 = import ./tests { system = "x86_64-linux"; }; in { avahi = t.avahi.test; bittorrent = t.bittorrent.test; From 20d4dee4263246b7f056cb6a4202f18f60c6ba34 Mon Sep 17 00:00:00 2001 From: Shea Levy Date: Thu, 9 Aug 2012 10:37:43 -0400 Subject: [PATCH 28/41] The efi boot stub code should only be run if it is enabled --- .../loader/efi-boot-stub/efi-boot-stub.nix | 102 ++++++++---------- 1 file changed, 46 insertions(+), 56 deletions(-) diff --git a/modules/system/boot/loader/efi-boot-stub/efi-boot-stub.nix b/modules/system/boot/loader/efi-boot-stub/efi-boot-stub.nix index 59d9957ef5fa..2b35aadc623d 100644 --- a/modules/system/boot/loader/efi-boot-stub/efi-boot-stub.nix +++ b/modules/system/boot/loader/efi-boot-stub/efi-boot-stub.nix @@ -1,9 +1,42 @@ {pkgs, config, ...}: -###### interface -let - inherit (pkgs.lib) mkOption mkIf; +with pkgs.lib; +let + efiBootStubBuilder = pkgs.substituteAll { + src = ./efi-boot-stub-builder.sh; + isExecutable = true; + inherit (pkgs) bash; + path = [pkgs.coreutils pkgs.gnused pkgs.gnugrep pkgs.glibc] ++ (pkgs.stdenv.lib.optionals config.boot.loader.efiBootStub.runEfibootmgr [pkgs.efibootmgr pkgs.module_init_tools]); + inherit (config.boot.loader.efiBootStub) efiSysMountPoint runEfibootmgr installStartupNsh efiDisk efiPartition; + + efiShell = if config.boot.loader.efiBootStub.installShell then + if pkgs.stdenv.isi686 then + pkgs.fetchurl { + url = "https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2/EdkShellBinPkg/FullShell/Ia32/Shell_Full.efi"; + sha256 = "1gv6kyaspczdp7x8qnx5x76ilriaygkfs99ay7ihhdi6riclkhfl"; + } + else + pkgs.fetchurl { + url = "https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2/EdkShellBinPkg/FullShell/X64/Shell_Full.efi"; + sha256 = "1g18z84rlavxr5gsrh2g942rfr6znv9fs3fqww5m7dhmnysgyv8p"; + } + else + null; + + kernelFile = platform.kernelTarget; + targetArch = if pkgs.stdenv.isi686 then + "IA32" + else if pkgs.stdenv.isx86_64 then + "X64" + else + throw "Unsupported architecture"; + }; + + # Temporary check, for nixos to cope both with nixpkgs stdenv-updates and trunk + platform = pkgs.stdenv.platform; +in +{ options = { boot = { loader = { @@ -75,60 +108,17 @@ let }; }; -in - -###### implementation -let - efiBootStubBuilder = pkgs.substituteAll { - src = ./efi-boot-stub-builder.sh; - isExecutable = true; - inherit (pkgs) bash; - path = [pkgs.coreutils pkgs.gnused pkgs.gnugrep pkgs.glibc] ++ (pkgs.stdenv.lib.optionals config.boot.loader.efiBootStub.runEfibootmgr [pkgs.efibootmgr pkgs.module_init_tools]); - inherit (config.boot.loader.efiBootStub) efiSysMountPoint runEfibootmgr installStartupNsh efiDisk efiPartition; - - efiShell = if config.boot.loader.efiBootStub.installShell then - if pkgs.stdenv.isi686 then - pkgs.fetchurl { - url = "https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2/EdkShellBinPkg/FullShell/Ia32/Shell_Full.efi"; - sha256 = "1gv6kyaspczdp7x8qnx5x76ilriaygkfs99ay7ihhdi6riclkhfl"; - } - else - pkgs.fetchurl { - url = "https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2/EdkShellBinPkg/FullShell/X64/Shell_Full.efi"; - sha256 = "1g18z84rlavxr5gsrh2g942rfr6znv9fs3fqww5m7dhmnysgyv8p"; - } - else - null; - - kernelFile = platform.kernelTarget; - targetArch = if pkgs.stdenv.isi686 then - "IA32" - else if pkgs.stdenv.isx86_64 then - "X64" - else - throw "Unsupported architecture"; - }; - - # Temporary check, for nixos to cope both with nixpkgs stdenv-updates and trunk - platform = pkgs.stdenv.platform; -in -{ - #assertions = [ { assertion = ! config.boot.kernelPackages.kernel ? features || config.boot.kernelPackages.kernel.features ? efiBootStub; message = "This kernel does not support the EFI boot stub"; } ]; + config = mkIf config.boot.loader.efiBootStub.enable { + assertions = [ { assertion = ! config.boot.kernelPackages.kernel ? features || config.boot.kernelPackages.kernel.features ? efiBootStub; message = "This kernel does not support the EFI boot stub"; } ]; - require = [ - options - - # config.system.build - # ../system/system-options.nix - ]; - - system = { - build.installBootLoader = efiBootStubBuilder; - boot.loader.id = "efiBootStub"; - boot.loader.kernelFile = platform.kernelTarget; - requiredKernelConfig = with config.lib.kernelConfig; [ - (isYes "EFI_STUB") - ]; + system = { + build.installBootLoader = efiBootStubBuilder; + boot.loader.id = "efiBootStub"; + boot.loader.kernelFile = platform.kernelTarget; + requiredKernelConfig = with config.lib.kernelConfig; [ + (isYes "EFI_STUB") + ]; + }; }; } From f31ab09b859887f8ca7e8ff441b77ae81601b5dc Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Thu, 9 Aug 2012 11:00:35 -0400 Subject: [PATCH 29/41] Set uniq type on boot.loader.kernelFile --- modules/system/activation/top-level.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/system/activation/top-level.nix b/modules/system/activation/top-level.nix index 35b6d0bff0c9..118a5c6266e3 100644 --- a/modules/system/activation/top-level.nix +++ b/modules/system/activation/top-level.nix @@ -37,6 +37,7 @@ let system.boot.loader.kernelFile = mkOption { default = pkgs.stdenv.platform.kernelTarget; + type = types.uniq types.string; description = '' Name of the kernel file to be passed to the bootloader. ''; From 746b572ee64b432d99e0de38fb247710125e570d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Llu=C3=ADs=20Batlle=20i=20Rossell?= Date: Fri, 10 Aug 2012 20:46:36 +0200 Subject: [PATCH 30/41] stage2init: fix respecting 'noatime' mount options for / We had a "mount -o remount,rw none /" that was setting back 'relatime', although we had set 'noatime' at initrd mount. Removing the word 'none' fixed it. Specifying a device (in this case 'none'), makes mount to forget previous device options. According to manpage, it says not to read fstab or mtab. But the effect is that of setting 'relatime', if it was mounted 'noatime. --- modules/system/boot/stage-2-init.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/system/boot/stage-2-init.sh b/modules/system/boot/stage-2-init.sh index 0a42083144df..f0e04aed179b 100644 --- a/modules/system/boot/stage-2-init.sh +++ b/modules/system/boot/stage-2-init.sh @@ -28,7 +28,7 @@ setPath "@path@" # However, in some environments (such as Amazon EC2), stage 2 is # executed directly, and the root is read-only. So make it writable # here. -mount -n -o remount,rw none / +mount -n -o remount,rw / # Likewise, stage 1 mounts /proc, /dev and /sys, so if we don't have a From 9e753f3a46eee13a8ef6eec7a2418379c9831b29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Llu=C3=ADs=20Batlle=20i=20Rossell?= Date: Sat, 11 Aug 2012 14:52:45 +0200 Subject: [PATCH 31/41] Removing rt73 module, adding ralink module. The rt73 fw were a subset of ralink, and the nixpkgs url for rt73 didn't work either. Ralink should make any rt73 card work. --- modules/hardware/network/{rt73.nix => ralink.nix} | 6 +++--- modules/module-list.nix | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) rename modules/hardware/network/{rt73.nix => ralink.nix} (61%) diff --git a/modules/hardware/network/rt73.nix b/modules/hardware/network/ralink.nix similarity index 61% rename from modules/hardware/network/rt73.nix rename to modules/hardware/network/ralink.nix index 6e96f21104d6..5924a23fe3c3 100644 --- a/modules/hardware/network/rt73.nix +++ b/modules/hardware/network/ralink.nix @@ -6,7 +6,7 @@ options = { - networking.enableRT73Firmware = pkgs.lib.mkOption { + networking.enableRalinkFirmware = pkgs.lib.mkOption { default = false; type = pkgs.lib.types.bool; description = '' @@ -19,8 +19,8 @@ ###### implementation - config = pkgs.lib.mkIf config.networking.enableRT73Firmware { - hardware.firmware = [ pkgs.rt73fw ]; + config = pkgs.lib.mkIf config.networking.enableRalinkFirmware { + hardware.firmware = [ pkgs.ralink_fw ]; }; } diff --git a/modules/module-list.nix b/modules/module-list.nix index bc3948182c31..697cc60e35e5 100644 --- a/modules/module-list.nix +++ b/modules/module-list.nix @@ -20,7 +20,7 @@ ./hardware/network/intel-2100bg.nix ./hardware/network/intel-2200bg.nix ./hardware/network/intel-3945abg.nix - ./hardware/network/rt73.nix + ./hardware/network/ralink.nix ./hardware/network/rtl8192c.nix ./hardware/pcmcia.nix ./installer/tools/nixos-checkout.nix From 50350a15f1a46c6efa30b93e41b0b8681815bfb4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Llu=C3=ADs=20Batlle=20i=20Rossell?= Date: Sat, 11 Aug 2012 14:54:43 +0200 Subject: [PATCH 32/41] Adding a rename line for rt73 -> ralink. --- modules/rename.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/rename.nix b/modules/rename.nix index 7f6fd6383a0a..43566bab22f9 100644 --- a/modules/rename.nix +++ b/modules/rename.nix @@ -69,6 +69,7 @@ in zipModules ([] ++ rename obsolete "security.extraSetuidPrograms" "security.setuidPrograms" ++ rename obsolete "networking.enableWLAN" "networking.wireless.enable" +++ rename obsolete "networking.enableRT73Firmware" "networking.enableRalinkFirmware" # Old Grub-related options. ++ rename obsolete "boot.copyKernels" "boot.loader.grub.copyKernels" From 15a1efe023b7ffe90ccc79efba2133bdc2bdb275 Mon Sep 17 00:00:00 2001 From: Shea Levy Date: Sat, 11 Aug 2012 12:34:35 -0400 Subject: [PATCH 33/41] find modules/ -name \*.nix -print0 | xargs -0 sed -i 's/RT73Firmware/RalinkFirmware/g' --- modules/installer/cd-dvd/system-tarball-fuloong2f.nix | 2 +- modules/installer/cd-dvd/system-tarball-sheevaplug.nix | 2 +- modules/installer/scan/not-detected.nix | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/installer/cd-dvd/system-tarball-fuloong2f.nix b/modules/installer/cd-dvd/system-tarball-fuloong2f.nix index 5b6e0036639b..e988647cf139 100644 --- a/modules/installer/cd-dvd/system-tarball-fuloong2f.nix +++ b/modules/installer/cd-dvd/system-tarball-fuloong2f.nix @@ -128,7 +128,7 @@ in ''; # Include the firmware for various wireless cards. - networking.enableRT73Firmware = true; + networking.enableRalinkFirmware = true; networking.enableIntel2200BGFirmware = true; # To speed up further installation of packages, include the complete stdenv diff --git a/modules/installer/cd-dvd/system-tarball-sheevaplug.nix b/modules/installer/cd-dvd/system-tarball-sheevaplug.nix index f53079ecd9b0..52df5a56ee7b 100644 --- a/modules/installer/cd-dvd/system-tarball-sheevaplug.nix +++ b/modules/installer/cd-dvd/system-tarball-sheevaplug.nix @@ -152,7 +152,7 @@ in services.nixosManual.enable = false; # Include the firmware for various wireless cards. - networking.enableRT73Firmware = true; + networking.enableRalinkFirmware = true; networking.enableIntel2200BGFirmware = true; # To speed up further installation of packages, include the complete stdenv diff --git a/modules/installer/scan/not-detected.nix b/modules/installer/scan/not-detected.nix index 34e71479322c..f79a3f09e050 100644 --- a/modules/installer/scan/not-detected.nix +++ b/modules/installer/scan/not-detected.nix @@ -19,6 +19,6 @@ with pkgs.lib; config = mkDefault { # That wireless card firmware not enabled because the corresponding # build expression 'rt73fw' is broken. - networking.enableRT73Firmware = false; + networking.enableRalinkFirmware = false; }; } From d809a9e6b2e7cc249fe6134065ba8d119a69c73c Mon Sep 17 00:00:00 2001 From: aszlig Date: Sun, 12 Aug 2012 07:15:56 +0200 Subject: [PATCH 34/41] mingetty: Option to not restart on service change. This especially annoyed me whenver I was doing nixos-rebuild switch and getting logged out on all consoles. With this there now is services.mingetty.dontRestart for heavy VT users to deactivate this behaviour. --- modules/services/ttys/mingetty.nix | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/modules/services/ttys/mingetty.nix b/modules/services/ttys/mingetty.nix index e5dbc07aeb0f..23cdf861d168 100644 --- a/modules/services/ttys/mingetty.nix +++ b/modules/services/ttys/mingetty.nix @@ -46,6 +46,14 @@ with pkgs.lib; ''; }; + dontRestart = mkOption { + default = false; + description = '' + Don't restart mingetty processes as this will result in active + sessions to be logged out, for example on activation of the system's + configuration. + ''; + }; }; }; @@ -69,6 +77,8 @@ with pkgs.lib; exec = "mingetty --loginprog=${pkgs.shadow}/bin/login --noclear ${tty}"; + restartIfChanged = !config.services.mingetty.dontRestart; + environment.LOCALE_ARCHIVE = "/run/current-system/sw/lib/locale/locale-archive"; }) config.services.mingetty.ttys); From 85997a669248e57d9d556725973723f60c5dffbb Mon Sep 17 00:00:00 2001 From: Shea Levy Date: Sun, 12 Aug 2012 11:44:00 -0400 Subject: [PATCH 35/41] mingetty: Don't make restartIfChanged optional --- modules/services/ttys/mingetty.nix | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/modules/services/ttys/mingetty.nix b/modules/services/ttys/mingetty.nix index 23cdf861d168..ecc4fd4630eb 100644 --- a/modules/services/ttys/mingetty.nix +++ b/modules/services/ttys/mingetty.nix @@ -46,14 +46,6 @@ with pkgs.lib; ''; }; - dontRestart = mkOption { - default = false; - description = '' - Don't restart mingetty processes as this will result in active - sessions to be logged out, for example on activation of the system's - configuration. - ''; - }; }; }; @@ -77,7 +69,7 @@ with pkgs.lib; exec = "mingetty --loginprog=${pkgs.shadow}/bin/login --noclear ${tty}"; - restartIfChanged = !config.services.mingetty.dontRestart; + restartIfChanged = false; environment.LOCALE_ARCHIVE = "/run/current-system/sw/lib/locale/locale-archive"; From a025e848e0c60b327745c2a59712aeece3153632 Mon Sep 17 00:00:00 2001 From: Peter Simons Date: Mon, 13 Aug 2012 14:37:32 +0200 Subject: [PATCH 36/41] modules/security/sudo.nix: added 'wheelNeedsPassword' option (default: true) Change this setting to 'false' to allow users in the 'wheel' group to execute commands as super user without entering a password. --- modules/security/sudo.nix | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/modules/security/sudo.nix b/modules/security/sudo.nix index e3e463e155f0..211ff8a96096 100644 --- a/modules/security/sudo.nix +++ b/modules/security/sudo.nix @@ -25,6 +25,15 @@ in ''; }; + security.sudo.wheelNeedsPassword = mkOption { + default = true; + description = + '' + Whether users of the wheel group can execute + commands as super user without entering a password. + ''; + }; + security.sudo.configFile = mkOption { # Note: if syntax errors are detected in this file, the NixOS # configuration will fail to build. @@ -45,7 +54,7 @@ in root ALL=(ALL) SETENV: ALL # Users in the "wheel" group can do anything. - %wheel ALL=(ALL) SETENV: ALL + %wheel ALL=(ALL) ${if cfg.wheelNeedsPassword then "" else "NOPASSWD: ALL, "}SETENV: ALL ''; description = '' From 0e3f03106f1f3ae039d978c4c307537b293b6fb3 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Wed, 15 Aug 2012 17:01:19 -0400 Subject: [PATCH 37/41] postgresql.nix: Add an option for overriding the PostgreSQL package --- modules/services/databases/postgresql.nix | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/modules/services/databases/postgresql.nix b/modules/services/databases/postgresql.nix index 1633b9d0fdd0..398fdbd86114 100644 --- a/modules/services/databases/postgresql.nix +++ b/modules/services/databases/postgresql.nix @@ -20,7 +20,7 @@ let ''; }; - postgresql = postgresqlAndPlugins pkgs.postgresql; + postgresql = postgresqlAndPlugins cfg.package; run = "su -s ${pkgs.stdenv.shell} postgres"; @@ -54,6 +54,13 @@ in ''; }; + package = mkOption { + default = pkgs.postgresql; + description = '' + PostgreSQL package to use. + ''; + }; + port = mkOption { default = "5432"; description = '' From a025e7e7e287c2539d883bd40a769ae29f9087ff Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Thu, 16 Aug 2012 10:47:33 -0400 Subject: [PATCH 38/41] Provide a common share between VMs to allow easy communication Every VM now mounts a common SMB share on /tmp/shared. --- lib/test-driver/Machine.pm | 10 +++++++++- modules/virtualisation/qemu-vm.nix | 14 ++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/lib/test-driver/Machine.pm b/lib/test-driver/Machine.pm index 9018dc589e40..3e6a1c8d158c 100644 --- a/lib/test-driver/Machine.pm +++ b/lib/test-driver/Machine.pm @@ -8,10 +8,13 @@ use POSIX qw(dup2); use FileHandle; use Cwd; use File::Basename; +use File::Path qw(make_path); my $showGraphics = defined $ENV{'DISPLAY'}; +my $sharedDir; + sub new { my ($class, $args) = @_; @@ -40,7 +43,11 @@ sub new { } my $tmpDir = $ENV{'TMPDIR'} || "/tmp"; - + unless (defined $sharedDir) { + $sharedDir = $tmpDir . "/xchg-shared"; + make_path($sharedDir, { mode => 0700, owner => $< }); + } + my $self = { startCommand => $startCommand, name => $name, @@ -123,6 +130,7 @@ sub start { dup2(fileno($serialC), fileno(STDOUT)); dup2(fileno($serialC), fileno(STDERR)); $ENV{TMPDIR} = $self->{stateDir}; + $ENV{SHARED_DIR} = $sharedDir; $ENV{USE_TMPDIR} = 1; $ENV{QEMU_OPTS} = "-no-reboot -monitor unix:./monitor -chardev socket,id=shell,path=./shell " . diff --git a/modules/virtualisation/qemu-vm.nix b/modules/virtualisation/qemu-vm.nix index 1de8d5b82ed7..f71e0ba51126 100644 --- a/modules/virtualisation/qemu-vm.nix +++ b/modules/virtualisation/qemu-vm.nix @@ -155,6 +155,14 @@ let cd $TMPDIR mkdir -p $TMPDIR/xchg + EXTRA_SAMBA_CONF=" + [shared] + force user = $WHO + path = ''${SHARED_DIR:-$TMPDIR/xchg} + read only = no + guest ok = yes + " + ${pkgs.vmTools.startSamba} # Start QEMU. @@ -328,6 +336,12 @@ in options = "guest,sec=none,noperm,noacl"; neededForBoot = true; } + { mountPoint = "/tmp/shared"; + device = "//10.0.2.4/shared"; + fsType = "cifs"; + options = "guest,sec=none,noperm,noacl"; + neededForBoot = true; + } ] ++ optional cfg.useBootLoader { mountPoint = "/boot"; device = "/dev/disk/by-label/boot"; From 7e99541afed8951cd27a61c30c419c3b36a60ccf Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Thu, 16 Aug 2012 15:37:13 -0400 Subject: [PATCH 39/41] Fix initrd for the latest lvm2 --- modules/system/boot/stage-1.nix | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/modules/system/boot/stage-1.nix b/modules/system/boot/stage-1.nix index 01ecd839f556..265adf163fcb 100644 --- a/modules/system/boot/stage-1.nix +++ b/modules/system/boot/stage-1.nix @@ -230,6 +230,7 @@ let cp -v ${pkgs.mdadm}/lib/udev/rules.d/*.rules $out/ for i in $out/*.rules; do + substituteInPlace $i \ --replace ata_id ${extraUtils}/bin/ata_id \ --replace usb_id ${extraUtils}/bin/usb_id \ @@ -237,9 +238,10 @@ let --replace path_id ${extraUtils}/bin/path_id \ --replace vol_id ${extraUtils}/bin/vol_id \ --replace cdrom_id ${extraUtils}/bin/cdrom_id \ + --replace ${pkgs.utillinux}/sbin/blkid ${extraUtils}/bin/blkid \ --replace /sbin/blkid ${extraUtils}/bin/blkid \ --replace /sbin/modprobe ${extraUtils}/bin/modprobe \ - --replace 'ENV{DM_SBIN_PATH}="${pkgs.lvm2}/sbin"' 'ENV{DM_SBIN_PATH}="${extraUtils}/bin"' \ + --replace ${pkgs.lvm2}/sbin ${extraUtils}/bin \ --replace /sbin/mdadm ${extraUtils}/bin/mdadm done # !!! Remove this after merging the x-updates branch: From 5dc8bc5f2a426ba653eaf14f9d76d4bfe5d0b806 Mon Sep 17 00:00:00 2001 From: Petr Rockai Date: Sat, 18 Aug 2012 14:25:09 +0200 Subject: [PATCH 40/41] Do not assume that /dev/console can always be written. --- modules/system/upstart/upstart.nix | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/modules/system/upstart/upstart.nix b/modules/system/upstart/upstart.nix index 961b3ad3cba2..c5bdd5c66c4f 100644 --- a/modules/system/upstart/upstart.nix +++ b/modules/system/upstart/upstart.nix @@ -45,9 +45,7 @@ let ${optionalString (job.console != "") "console ${job.console}"} pre-start script - ${optionalString (job.console == "") '' - exec >> ${log} 2>&1 - ''} + ${optionalString (job.console != "") "echo || "} exec >> ${log} 2>&1 ln -sfn "$(readlink -f "/etc/init/${job.name}.conf")" /var/run/upstart-jobs/${job.name} ${optionalString (job.preStart != "") '' source ${jobHelpers} @@ -60,9 +58,7 @@ let else if job.script != "" then '' script - ${optionalString (job.console == "") '' - exec >> ${log} 2>&1 - ''} + ${optionalString (job.console != "") "echo || "} exec >> ${log} 2>&1 source ${jobHelpers} ${job.script} end script @@ -83,9 +79,7 @@ let ${optionalString (job.postStart != "") '' post-start script - ${optionalString (job.console == "") '' - exec >> ${log} 2>&1 - ''} + ${optionalString (job.console != "") "echo || "} exec >> ${log} 2>&1 source ${jobHelpers} ${job.postStart} end script @@ -98,9 +92,7 @@ let # (upstart 0.6.5, job.c:562) optionalString (job.preStop != "") (assert hasMain; '' pre-stop script - ${optionalString (job.console == "") '' - exec >> ${log} 2>&1 - ''} + ${optionalString (job.console != "") "echo || "} exec >> ${log} 2>&1 source ${jobHelpers} ${job.preStop} end script @@ -108,9 +100,7 @@ let ${optionalString (job.postStop != "") '' post-stop script - ${optionalString (job.console == "") '' - exec >> ${log} 2>&1 - ''} + ${optionalString (job.console != "") "echo || "} exec >> ${log} 2>&1 source ${jobHelpers} ${job.postStop} end script From 16713db4e294689c55c44615754b08576640f6c4 Mon Sep 17 00:00:00 2001 From: Peter Simons Date: Mon, 20 Aug 2012 16:37:14 +0200 Subject: [PATCH 41/41] modules/programs/bash/bashrc.sh: adapt bash completion for version 2.0 of the package --- modules/programs/bash/bashrc.sh | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/modules/programs/bash/bashrc.sh b/modules/programs/bash/bashrc.sh index 79583a73174d..745506561519 100644 --- a/modules/programs/bash/bashrc.sh +++ b/modules/programs/bash/bashrc.sh @@ -31,13 +31,9 @@ fi # programmable completion. If we do, and if the current user has # installed the package 'bash-completion' in her $HOME/.nix-profile, # then completion is enabled automatically. -if [ -f "$HOME/.nix-profile/etc/bash_completion" ]; then - if [ -d "$HOME/.nix-profile/etc/bash_completion.d" ]; then - if shopt -q progcomp &>/dev/null; then - BASH_COMPLETION_DIR="$HOME/.nix-profile/etc/bash_completion.d" - BASH_COMPLETION="$HOME/.nix-profile/etc/bash_completion" - . "$BASH_COMPLETION" - fi +if [ -f "$HOME/.nix-profile/etc/profile.d/bash_completion.sh" ]; then + if shopt -q progcomp &>/dev/null; then + . "$HOME/.nix-profile/etc/profile.d/bash_completion.sh" fi fi