about summary refs log tree commit diff
path: root/nixos/modules/services/databases
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2013-10-30 18:30:23 +0100
committerEelco Dolstra <eelco.dolstra@logicblox.com>2013-10-30 18:47:44 +0100
commit244cf195c88acff952ff0304c8e48a109f4b6754 (patch)
treedfeda2b6b0218e4eaa10efa06292e360bf4d2125 /nixos/modules/services/databases
parentc7171b2c8fc5671cdc989c88aa8f959dac836a98 (diff)
downloadnixlib-244cf195c88acff952ff0304c8e48a109f4b6754.tar
nixlib-244cf195c88acff952ff0304c8e48a109f4b6754.tar.gz
nixlib-244cf195c88acff952ff0304c8e48a109f4b6754.tar.bz2
nixlib-244cf195c88acff952ff0304c8e48a109f4b6754.tar.lz
nixlib-244cf195c88acff952ff0304c8e48a109f4b6754.tar.xz
nixlib-244cf195c88acff952ff0304c8e48a109f4b6754.tar.zst
nixlib-244cf195c88acff952ff0304c8e48a109f4b6754.zip
Use the "assertions" option instead of mkAssert
Diffstat (limited to 'nixos/modules/services/databases')
-rw-r--r--nixos/modules/services/databases/4store-endpoint.nix17
-rw-r--r--nixos/modules/services/databases/4store.nix17
2 files changed, 20 insertions, 14 deletions
diff --git a/nixos/modules/services/databases/4store-endpoint.nix b/nixos/modules/services/databases/4store-endpoint.nix
index 7b03b4d8f1dc..7872ea2dc6a3 100644
--- a/nixos/modules/services/databases/4store-endpoint.nix
+++ b/nixos/modules/services/databases/4store-endpoint.nix
@@ -24,12 +24,12 @@ with pkgs.lib;
       };
 
       listenAddress = mkOption {
-	default = null;
+        default = null;
         description = "IP address to listen on.";
       };
 
       port = mkOption {
-	default = 8080;
+        default = 8080;
         description = "port to listen on.";
       };
 
@@ -45,9 +45,12 @@ with pkgs.lib;
 
   ###### implementation
 
-  config = mkIf cfg.enable (
-    mkAssert (cfg.enable -> cfg.database != "")
-      "Must specify database name" {
+  config = mkIf cfg.enable {
+
+    assertions = singleton
+      { assertion = cfg.enable -> cfg.database != "";
+        message = "Must specify 4Store database name";
+      };
 
     users.extraUsers = singleton
       { name = endpointUser;
@@ -63,10 +66,10 @@ with pkgs.lib;
       startOn = "filesystem";
 
       exec = ''
-	${run} '${pkgs.rdf4store}/bin/4s-httpd -D ${cfg.options} ${if cfg.listenAddress!=null then "-H ${cfg.listenAddress}" else "" } -p ${toString cfg.port} ${cfg.database}'
+        ${run} '${pkgs.rdf4store}/bin/4s-httpd -D ${cfg.options} ${if cfg.listenAddress!=null then "-H ${cfg.listenAddress}" else "" } -p ${toString cfg.port} ${cfg.database}'
       '';
     };
 
-  });
+  };
 
 }
diff --git a/nixos/modules/services/databases/4store.nix b/nixos/modules/services/databases/4store.nix
index 14990e92ea30..412d14b050cb 100644
--- a/nixos/modules/services/databases/4store.nix
+++ b/nixos/modules/services/databases/4store.nix
@@ -36,9 +36,12 @@ with pkgs.lib;
 
   ###### implementation
 
-  config = mkIf cfg.enable (
-    mkAssert (cfg.enable -> cfg.database != "")
-      "Must specify database name" {
+  config = mkIf cfg.enable {
+
+    assertions = singleton
+      { assertion = cfg.enable -> cfg.database != "";
+        message = "Must specify 4Store database name.";
+      };
 
     users.extraUsers = singleton
       { name = fourStoreUser;
@@ -56,16 +59,16 @@ with pkgs.lib;
       preStart = ''
         mkdir -p ${stateDir}/
         chown ${fourStoreUser} ${stateDir}
-	if ! test -e "${stateDir}/${cfg.database}"; then
-	  ${run} -c '${pkgs.rdf4store}/bin/4s-backend-setup ${cfg.database}'
+        if ! test -e "${stateDir}/${cfg.database}"; then
+          ${run} -c '${pkgs.rdf4store}/bin/4s-backend-setup ${cfg.database}'
         fi
       '';
 
       exec = ''
-	${run} -c '${pkgs.rdf4store}/bin/4s-backend -D ${cfg.options} ${cfg.database}'
+        ${run} -c '${pkgs.rdf4store}/bin/4s-backend -D ${cfg.options} ${cfg.database}'
       '';
     };
 
-  });
+  };
 
 }