Hi Pjotr,

I haven't tested it much, but I believe the attached patch to
nixpkgs/nixos/modules/services/databases/4store.nix should do
what you need.

I hope it helps,
Peter

diff --git a/nixos/modules/services/databases/4store.nix 
b/nixos/modules/services/databases/4store.nix
index 412d14b..e6b21bf 100644
--- a/nixos/modules/services/databases/4store.nix
+++ b/nixos/modules/services/databases/4store.nix
@@ -1,7 +1,6 @@
 { config, pkgs, ... }:
 let
   cfg = config.services.fourStore;
-  stateDir = "/var/lib/4store";
   fourStoreUser = "fourstore";
   run = "${pkgs.su}/bin/su -s ${pkgs.stdenv.shell} ${fourStoreUser}";
 in
@@ -21,7 +20,7 @@ with pkgs.lib;
 
       database = mkOption {
         default = "";
-        description = "RDF database name. If it doesn't exist, it will be 
created. Databases are stored in ${stateDir}.";
+        description = "RDF database name. If it doesn't exist, it will be 
created. Databases are stored in ${cfg.stateDir}.";
       };
 
       options = mkOption {
@@ -29,6 +28,11 @@ with pkgs.lib;
         description = "Extra CLI options to pass to 4Store.";
       };
 
+      stateDir = mkOption {
+        default = "/var/lib/4store";
+        description = "Path of the 4Store RDF database server state 
directory.";
+      };
+
     };
 
   };
@@ -47,7 +51,7 @@ with pkgs.lib;
       { name = fourStoreUser;
         uid = config.ids.uids.fourStore;
         description = "4Store database user";
-        home = stateDir;
+        home = cfg.stateDir;
       };
 
     services.avahi.enable = true;
@@ -57,9 +61,9 @@ with pkgs.lib;
       startOn = "filesystem";
 
       preStart = ''
-        mkdir -p ${stateDir}/
-        chown ${fourStoreUser} ${stateDir}
-        if ! test -e "${stateDir}/${cfg.database}"; then
+        mkdir -p ${cfg.stateDir}/
+        chown ${fourStoreUser} ${cfg.stateDir}
+        if ! test -e "${cfg.stateDir}/${cfg.database}"; then
           ${run} -c '${pkgs.rdf4store}/bin/4s-backend-setup ${cfg.database}'
         fi
       '';
_______________________________________________
nix-dev mailing list
[email protected]
http://lists.science.uu.nl/mailman/listinfo/nix-dev

Reply via email to