1{ config, lib, pkgs, ... }:
2
3with lib;
4
5# unixODBC drivers (this solution is not perfect.. Because the user has to
6# ask the admin to add a driver.. but it's simple and works
7
8{
9 ###### interface
10
11 options = {
12 environment.unixODBCDrivers = mkOption {
13 default = [];
14 example = literalExample "map (x : x.ini) (with pkgs.unixODBCDrivers; [ mysql psql psqlng ] )";
15 description = ''
16 Specifies Unix ODBC drivers to be registered in
17 <filename>/etc/odbcinst.ini</filename>. You may also want to
18 add <literal>pkgs.unixODBC</literal> to the system path to get
19 a command line client to connnect to ODBC databases.
20 '';
21 };
22 };
23
24 ###### implementation
25
26 config = mkIf (config.environment.unixODBCDrivers != []) {
27
28 environment.etc."odbcinst.ini".text =
29 let inis = config.environment.unixODBCDrivers;
30 in lib.concatStringsSep "\n" inis;
31
32 };
33
34}