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 type = types.listOf types.package;
14 default = [];
15 example = literalExample "with pkgs.unixODBCDrivers; [ mysql psql psqlng ]";
16 description = ''
17 Specifies Unix ODBC drivers to be registered in
18 <filename>/etc/odbcinst.ini</filename>. You may also want to
19 add <literal>pkgs.unixODBC</literal> to the system path to get
20 a command line client to connnect to ODBC databases.
21 '';
22 };
23 };
24
25 ###### implementation
26
27 config = mkIf (config.environment.unixODBCDrivers != []) {
28
29 environment.etc."odbcinst.ini".text =
30 let inis = map (x : x.ini) config.environment.unixODBCDrivers;
31 in lib.concatStringsSep "\n" inis;
32
33 };
34
35}