From 3636fa1a0439baeb1f3a614356a3066a4b90f16b Mon Sep 17 00:00:00 2001 From: Marc Weber Date: Thu, 30 Apr 2009 02:29:58 +0000 Subject: [PATCH] fixing assertions using new assertion implementation svn path=/nixos/branches/modular-nixos/; revision=15409 --- system/options.nix | 8 ++++---- upstart-jobs/halt.nix | 7 ------- upstart-jobs/openfire.nix | 8 ++++++-- upstart-jobs/tty-backgrounds.nix | 6 +++--- upstart-jobs/xfs.nix | 6 +++--- 5 files changed, 16 insertions(+), 19 deletions(-) diff --git a/system/options.nix b/system/options.nix index 5d39beb64b4..f9b025ae109 100644 --- a/system/options.nix +++ b/system/options.nix @@ -409,7 +409,7 @@ in (import ../upstart-jobs/nscd.nix) # Name service cache daemon. (import ../upstart-jobs/maintenance-shell.nix) # Handles the maintenance/stalled event (single-user shell). (import ../upstart-jobs/ctrl-alt-delete.nix) # Ctrl-alt-delete action. - (import ../upstart-jobs/halt.nix) # FIXME (assertion) # Handles the reboot/halt events. + (import ../upstart-jobs/halt.nix) (import ../upstart-jobs/ifplugd.nix) # ifplugd daemon for monitoring Ethernet cables. @@ -475,16 +475,16 @@ in (import ../upstart-jobs/udev.nix) # The udev daemon creates devices nodes and runs programs when hardware events occur. (import ../upstart-jobs/samba.nix) # TODO: doesn't start here (?) (import ../upstart-jobs/ircd-hybrid.nix) # TODO: doesn't compile on x86_64-linux, can't test - (import ../upstart-jobs/xfs.nix) # FIXME (assertion) + (import ../upstart-jobs/xfs.nix) (import ../upstart-jobs/mysql.nix) (import ../upstart-jobs/postgresql.nix) - (import ../upstart-jobs/openfire.nix) # FIXME (assertion) + (import ../upstart-jobs/openfire.nix) (import ../upstart-jobs/postfix.nix) (import ../upstart-jobs/dovecot.nix) (import ../upstart-jobs/bind.nix) (import ../upstart-jobs/mingetty.nix) # The terminals on ttyX. - (import ../upstart-jobs/tty-backgrounds.nix) #FIXME (assertion) + (import ../upstart-jobs/tty-backgrounds.nix) (import ../upstart-jobs/synergy.nix) diff --git a/upstart-jobs/halt.nix b/upstart-jobs/halt.nix index d98a3b5eea4..d8a1029dba5 100644 --- a/upstart-jobs/halt.nix +++ b/upstart-jobs/halt.nix @@ -3,13 +3,6 @@ ###### implementation -/* FIXME -assert event == "reboot" - || event == "halt" - || event == "system-halt" - || event == "power-off"; -*/ - let inherit (pkgs) bash utillinux; diff --git a/upstart-jobs/openfire.nix b/upstart-jobs/openfire.nix index 365d34a5b26..fa51ad173a3 100644 --- a/upstart-jobs/openfire.nix +++ b/upstart-jobs/openfire.nix @@ -26,8 +26,6 @@ in ###### implementation -# FIXME (see xfs) -# if (!(config.services.openfire.usePostgreSQL -> config.services.postgresql.enable)) then throw "openfire assertion failed" else let inherit (pkgs) jre openfire coreutils which gnugrep gawk gnused; @@ -41,6 +39,12 @@ let in mkIf config.services.openfire.enable { + + assertions = [ { + assertion = !(config.services.openfire.usePostgreSQL -> config.services.postgresql.enable); + message = "openfire assertion failed"; + } ]; + require = [ options ]; diff --git a/upstart-jobs/tty-backgrounds.nix b/upstart-jobs/tty-backgrounds.nix index 825874aaeed..e4af68b4828 100644 --- a/upstart-jobs/tty-backgrounds.nix +++ b/upstart-jobs/tty-backgrounds.nix @@ -112,10 +112,10 @@ let in -# FIXME see xfs -# assert splashutils != null; +mkIf (config.services.ttyBackgrounds.enable) { + + assertions = [ { assertion = kernelPackages.splashutils != null; message = "kernelPackages.splashutils may not be false"; } ]; -mkIf (config.services.ttyBackgrounds.enable && kernelPackages.splashutils != null) { require = [ options ]; diff --git a/upstart-jobs/xfs.nix b/upstart-jobs/xfs.nix index c7b9d85551d..9cc5c25ec0f 100644 --- a/upstart-jobs/xfs.nix +++ b/upstart-jobs/xfs.nix @@ -23,15 +23,15 @@ in ###### implementation -# FIXME: enable this warning again. It's causing "infinite recursion encountered, why?" -# if ! config.fonts.enableFontDir then throw "Please enable fontDir (fonts.enableFontDir) to use xfs." else - let configFile = ./xfs.conf; startingDependency = if config.services.gw6c.enable && config.services.gw6c.autorun then "gw6c" else "network-interfaces"; in mkIf config.services.xfs.enable { + + assertions = [ { assertion = ! config.fonts.enableFontDir; message = "Please enable fontDir (fonts.enableFontDir) to use xfs."; } ]; + require = [ options ];