blob: 293021dd868fa55e2808dd5d1ba8f254a8fb8e1c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
{ config, 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
let
iniDescription = pkg: ''
[${pkg.fancyName}]
Description = ${pkg.meta.description}
Driver = ${pkg}/${pkg.driver}
'';
in
{
###### interface
options = {
environment.unixODBCDrivers = lib.mkOption {
type = lib.types.listOf lib.types.package;
default = [ ];
example = lib.literalExpression "with pkgs.unixodbcDrivers; [ sqlite psql ]";
description = ''
Specifies Unix ODBC drivers to be registered in
{file}`/etc/odbcinst.ini`. You may also want to
add `pkgs.unixodbc` to the system path to get
a command line client to connect to ODBC databases.
'';
};
};
###### implementation
config = lib.mkIf (config.environment.unixODBCDrivers != [ ]) {
environment.etc."odbcinst.ini".text =
lib.concatMapStringsSep "\n" iniDescription
config.environment.unixODBCDrivers;
};
}
|