summary refs log tree commit diff
path: root/system/unix-odbc-drivers.nix
diff options
context:
space:
mode:
authorMarc Weber <marco-oweber@gmx.de>2009-03-06 12:25:33 +0000
committerMarc Weber <marco-oweber@gmx.de>2009-03-06 12:25:33 +0000
commite344a2d055e01a2b98d03961b99a8c7c9efaf4bd (patch)
tree4cef3ebe064ff3f05693ce06d11584e635ca45aa /system/unix-odbc-drivers.nix
parent1c43b4946b6c4fd121a5a1c650d81aabaa8340ef (diff)
downloadnixpkgs-e344a2d055e01a2b98d03961b99a8c7c9efaf4bd.tar
nixpkgs-e344a2d055e01a2b98d03961b99a8c7c9efaf4bd.tar.gz
nixpkgs-e344a2d055e01a2b98d03961b99a8c7c9efaf4bd.tar.bz2
nixpkgs-e344a2d055e01a2b98d03961b99a8c7c9efaf4bd.tar.lz
nixpkgs-e344a2d055e01a2b98d03961b99a8c7c9efaf4bd.tar.xz
nixpkgs-e344a2d055e01a2b98d03961b99a8c7c9efaf4bd.tar.zst
nixpkgs-e344a2d055e01a2b98d03961b99a8c7c9efaf4bd.zip
Convert "unix-odbc-drivers"
svn path=/nixos/branches/fix-style/; revision=14359
Diffstat (limited to 'system/unix-odbc-drivers.nix')
-rw-r--r--system/unix-odbc-drivers.nix43
1 files changed, 43 insertions, 0 deletions
diff --git a/system/unix-odbc-drivers.nix b/system/unix-odbc-drivers.nix
new file mode 100644
index 00000000000..7df87db8577
--- /dev/null
+++ b/system/unix-odbc-drivers.nix
@@ -0,0 +1,43 @@
+{pkgs, config, ...}:
+
+###### interface
+let
+  inherit (pkgs.lib) mkOption mkIf;
+
+  options = {
+    environment = {
+      unixODBCDrivers = mkOption {
+        default = [];
+        example = "map (x : x.ini) (with pkgs.unixODBCDrivers; [ mysql psql psqlng ] )";
+        description = ''
+          specifies unix odbc drivers to be registered at /etc/odbcinst.ini. 
+          Maybe you also want to add pkgs.unixODBC to the system path to get a
+          command line client t connnect to odbc databases.
+        '';
+      };
+    };
+  };
+in
+
+###### implementation
+
+
+# unixODBC drivers (this solution is not perfect.. Because the user has to
+# ask the admin to add a driver.. but it's simple and works
+
+mkIf (config.environment.unixODBCDrivers != []) {
+
+  require = [
+    options
+  ];
+  
+  environment = {
+    etc = [
+      { source = 
+          let inis = config.environment.unixODBCDrivers;
+          in pkgs.writeText "odbcinst.ini" (pkgs.lib.concatStringsSep "\n" inis);
+        target = "odbcinst.ini";
+      }
+    ];
+  };
+}