Author: NicolasPierron
Date: Wed Mar 30 17:52:34 2011
New Revision: 26614
URL: https://svn.nixos.org/websvn/nix/?rev=26614&sc=1
Log:
Convert assertion option into mkAssert.
Modified:
nixos/trunk/modules/services/network-filesystems/nfs-kernel.nix
nixos/trunk/modules/services/networking/openfire.nix
nixos/trunk/modules/services/security/tor.nix
nixos/trunk/modules/services/x11/xfs.nix
nixos/trunk/modules/services/x11/xserver.nix
nixos/trunk/modules/tasks/tty-backgrounds.nix
nixos/trunk/modules/testing/test-instrumentation.nix
Modified: nixos/trunk/modules/services/network-filesystems/nfs-kernel.nix
==============================================================================
--- nixos/trunk/modules/services/network-filesystems/nfs-kernel.nix Wed Mar
30 17:04:27 2011 (r26613)
+++ nixos/trunk/modules/services/network-filesystems/nfs-kernel.nix Wed Mar
30 17:52:34 2011 (r26614)
@@ -74,14 +74,13 @@
###### implementation
- config = {
+ config =
+ mkAssert
+ (cfg.client.enable || cfg.server.enable -> config.services.portmap.enable)
"
+ Please enable portmap (services.portmap.enable) to use nfs-kernel.
+ " {
- services.portmap.enable = cfg.client.enable || cfg.server.enable;
-
- assertions = mkIf (cfg.client.enable || cfg.server.enable) (singleton
- { assertion = cfg.client.enable || cfg.server.enable;
- message = "Please enable portmap (services.portmap.enable) to use
nfs-kernel.";
- });
+ services.portmap.enable = mkAlways (cfg.client.enable ||
cfg.server.enable);
environment.etc = mkIf cfg.server.enable (singleton
{ source = exports;
Modified: nixos/trunk/modules/services/networking/openfire.nix
==============================================================================
--- nixos/trunk/modules/services/networking/openfire.nix Wed Mar 30
17:04:27 2011 (r26613)
+++ nixos/trunk/modules/services/networking/openfire.nix Wed Mar 30
17:52:34 2011 (r26614)
@@ -42,12 +42,10 @@
###### implementation
- config = mkIf config.services.openfire.enable {
-
- assertions = singleton
- { assertion = !(config.services.openfire.usePostgreSQL ->
config.services.postgresql.enable);
- message = "openfire assertion failed";
- };
+ config = mkIf config.services.openfire.enable (
+ mkAssert (!(config.services.openfire.usePostgreSQL ->
config.services.postgresql.enable)) "
+ openfire assertion failed
+ " {
jobs.openfire =
{ description = "OpenFire XMPP server";
@@ -69,6 +67,6 @@
''; # */
};
- };
+ });
}
Modified: nixos/trunk/modules/services/security/tor.nix
==============================================================================
--- nixos/trunk/modules/services/security/tor.nix Wed Mar 30 17:04:27
2011 (r26613)
+++ nixos/trunk/modules/services/security/tor.nix Wed Mar 30 17:52:34
2011 (r26614)
@@ -218,12 +218,10 @@
###### implementation
- config = mkIf (cfg.client.enable || cfg.relay.enable) {
-
- assertions = [ {
- assertion = cfg.relay.enable -> !(cfg.relay.isBridge &&
cfg.relay.isExit);
- message = "Can't be both an exit and a bridge relay at the same time";
- } ];
+ config = mkIf (cfg.client.enable || cfg.relay.enable) (
+ mkAssert (cfg.relay.enable -> !(cfg.relay.isBridge && cfg.relay.isExit)) "
+ Can't be both an exit and a bridge relay at the same time
+ " {
users.extraUsers = singleton
{ name = torUser;
@@ -308,6 +306,6 @@
# Extra config goes here
'';
- };
+ });
}
Modified: nixos/trunk/modules/services/x11/xfs.nix
==============================================================================
--- nixos/trunk/modules/services/x11/xfs.nix Wed Mar 30 17:04:27 2011
(r26613)
+++ nixos/trunk/modules/services/x11/xfs.nix Wed Mar 30 17:52:34 2011
(r26614)
@@ -33,12 +33,10 @@
###### implementation
- config = mkIf config.services.xfs.enable {
-
- assertions = singleton
- { assertion = config.fonts.enableFontDir;
- message = "Please enable fontDir (fonts.enableFontDir) to use xfs.";
- };
+ config = mkIf config.services.xfs.enable (
+ mkAssert config.fonts.enableFontDir "
+ Please enable fontDir (fonts.enableFontDir) to use xfs.
+ " {
jobs.xfs =
{ description = "X Font Server";
@@ -48,6 +46,6 @@
exec = "${pkgs.xorg.xfs}/bin/xfs -config ${configFile}";
};
- };
+ });
}
Modified: nixos/trunk/modules/services/x11/xserver.nix
==============================================================================
--- nixos/trunk/modules/services/x11/xserver.nix Wed Mar 30 17:04:27
2011 (r26613)
+++ nixos/trunk/modules/services/x11/xserver.nix Wed Mar 30 17:52:34
2011 (r26614)
@@ -328,23 +328,18 @@
###### implementation
- config = mkIf cfg.enable {
-
- assertions =
- [ { assertion = config.services.hal.enable == true;
- message = "The X server needs HAL running. Set services.hal.enable
to true";
- }
-
- { assertion = if cfg.startOpenSSHAgent
- then !cfg.startGnuPGAgent
- else (if cfg.startGnuPGAgent
- then !cfg.startOpenSSHAgent
- else true);
- message =
- "The OpenSSH agent and GnuPG agent cannot be started both. " +
- "Choose between `startOpenSSHAgent' and `startGnuPGAgent'.";
- }
- ];
+ config = mkIf cfg.enable (
+ mkAssert (config.services.hal.enable == true) "
+ The X server needs HAL running. Set services.hal.enable to true
+ " (
+ mkAssert (if cfg.startOpenSSHAgent
+ then !cfg.startGnuPGAgent
+ else (if cfg.startGnuPGAgent
+ then !cfg.startOpenSSHAgent
+ else true)) "
+ The OpenSSH agent and GnuPG agent cannot be started both.
+ Choose between `startOpenSSHAgent' and `startGnuPGAgent'.
+ " {
boot.extraModulePackages =
optional (elem "nvidia" driverNames) kernelPackages.nvidia_x11 ++
@@ -385,7 +380,8 @@
environment.pathsToLink =
[ "/etc/xdg" "/share/xdg" "/share/applications" "/share/icons"
"/share/pixmaps" ];
-
+
+ services.hal.enable = mkAlways cfg.enable;
services.hal.packages = optional (elem "virtualbox" driverNames)
kernelPackages.virtualboxGuestAdditions;
jobs.xserver =
@@ -538,6 +534,6 @@
'')}
'';
- };
+ }));
}
Modified: nixos/trunk/modules/tasks/tty-backgrounds.nix
==============================================================================
--- nixos/trunk/modules/tasks/tty-backgrounds.nix Wed Mar 30 17:04:27
2011 (r26613)
+++ nixos/trunk/modules/tasks/tty-backgrounds.nix Wed Mar 30 17:52:34
2011 (r26614)
@@ -82,13 +82,11 @@
###### implementation
- config = mkIf config.services.ttyBackgrounds.enable {
-
- assertions = singleton
- { assertion = kernelPackages.splashutils != null;
- message = "The kernelPackages does not provide splashutils, as
required by ttyBackgrounds. " +
- "Either provide kernelPackages with splashutils, or disable
ttyBackgrounds.";
- };
+ config = mkIf config.services.ttyBackgrounds.enable (
+ mkAssert (kernelPackages.splashutils != null) "
+ The kernelPackages does not provide splashutils, as required by
ttyBackgrounds.
+ Either provide kernelPackages with splashutils, or disable ttyBackgrounds.
+ " {
services.ttyBackgrounds.specificThemes = singleton
{ tty = config.services.syslogd.tty;
@@ -145,6 +143,6 @@
'';
};
- };
+ });
}
Modified: nixos/trunk/modules/testing/test-instrumentation.nix
==============================================================================
--- nixos/trunk/modules/testing/test-instrumentation.nix Wed Mar 30
17:04:27 2011 (r26613)
+++ nixos/trunk/modules/testing/test-instrumentation.nix Wed Mar 30
17:52:34 2011 (r26614)
@@ -21,7 +21,11 @@
{
- config = {
+ config =
+ # Require a patch to the kernel to increase the 15s CIFS timeout.
+ mkAssert (config.boot.kernelPackages.kernel.features ? cifsTimeout) "
+ VM tests require that the kernel has the CIFS timeout patch.
+ " {
jobs.backdoor =
{ startOn = "startup";
@@ -95,13 +99,6 @@
networking.defaultGateway = mkOverride 150 "";
networking.nameservers = mkOverride 150 [ ];
- # Require a patch to the kernel to increase the 15s CIFS timeout.
- assertions =
- [ { assertion = config.boot.kernelPackages.kernel.features ? cifsTimeout;
- message = "VM tests require that the kernel has the CIFS timeout
patch.";
- }
- ];
-
system.upstartEnvironment.GCOV_PREFIX = "/tmp/coverage-data";
};
_______________________________________________
nix-commits mailing list
[email protected]
http://mail.cs.uu.nl/mailman/listinfo/nix-commits