summary refs log tree commit diff
path: root/modules/config/unix-odbc-drivers.nix
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2013-09-04 13:05:09 +0200
committerEelco Dolstra <eelco.dolstra@logicblox.com>2013-09-04 13:05:09 +0200
commit17457297cb05461696cfc36844b88294bd38222d (patch)
tree295571acc18df41615e1b9c330260a3af3ae1de5 /modules/config/unix-odbc-drivers.nix
parent3a23e6dd31d39d0a8ea229661d29855361c143cb (diff)
downloadnixpkgs-17457297cb05461696cfc36844b88294bd38222d.tar
nixpkgs-17457297cb05461696cfc36844b88294bd38222d.tar.gz
nixpkgs-17457297cb05461696cfc36844b88294bd38222d.tar.bz2
nixpkgs-17457297cb05461696cfc36844b88294bd38222d.tar.lz
nixpkgs-17457297cb05461696cfc36844b88294bd38222d.tar.xz
nixpkgs-17457297cb05461696cfc36844b88294bd38222d.tar.zst
nixpkgs-17457297cb05461696cfc36844b88294bd38222d.zip
Update all legacy-style modules
I.e., modules that use "require = [options]".  Nowadays that should be
written as

  {
    options = { ... };
    config = { ... };
  };

Also, use "imports" instead of "require" in places where we actually
import another module.
Diffstat (limited to 'modules/config/unix-odbc-drivers.nix')
-rw-r--r--modules/config/unix-odbc-drivers.nix55
1 files changed, 23 insertions, 32 deletions
diff --git a/modules/config/unix-odbc-drivers.nix b/modules/config/unix-odbc-drivers.nix
index 8950898e1dd..0f608469058 100644
--- a/modules/config/unix-odbc-drivers.nix
+++ b/modules/config/unix-odbc-drivers.nix
@@ -1,43 +1,34 @@
-{pkgs, config, ...}:
+{ config, pkgs, ... }:
 
-###### interface
-let
-  inherit (pkgs.lib) mkOption mkIf;
+with pkgs.lib;
+
+# 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
+
+{
+  ###### interface
 
   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.
-        '';
-      };
+    environment.unixODBCDrivers = mkOption {
+      default = [];
+      example = literalExample "map (x : x.ini) (with pkgs.unixODBCDrivers; [ mysql psql psqlng ] )";
+      description = ''
+        Specifies Unix ODBC drivers to be registered in
+        <filename>/etc/odbcinst.ini</filename>.  You may also want to
+        add <literal>pkgs.unixODBC</literal> to the system path to get
+        a command line client to connnect to ODBC databases.
+      '';
     };
   };
-in
 
-###### implementation
+  ###### implementation
 
+  config = mkIf (config.environment.unixODBCDrivers != []) {
 
-# 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 != []) {
+    environment.etc."odbcinst.ini".text =
+      let inis = config.environment.unixODBCDrivers;
+      in pkgs.lib.concatStringsSep "\n" inis;
 
-  require = [
-    options
-  ];
-
-  environment = {
-    etc = [
-      { source =
-          let inis = config.environment.unixODBCDrivers;
-          in pkgs.writeText "odbcinst.ini" (pkgs.lib.concatStringsSep "\n" inis);
-        target = "odbcinst.ini";
-      }
-    ];
   };
+
 }