2018-07-20 22:56:59 +02:00
|
|
|
{ config, lib, ... }:
|
2009-03-06 13:25:33 +01:00
|
|
|
|
2014-04-14 16:26:48 +02:00
|
|
|
with lib;
|
2013-09-04 13:05:09 +02:00
|
|
|
|
|
|
|
# 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
|
|
|
|
|
2016-04-26 20:18:21 +02:00
|
|
|
let
|
|
|
|
iniDescription = pkg: ''
|
|
|
|
[${pkg.fancyName}]
|
|
|
|
Description = ${pkg.meta.description}
|
|
|
|
Driver = ${pkg}/${pkg.driver}
|
|
|
|
'';
|
|
|
|
|
|
|
|
in {
|
2013-09-04 13:05:09 +02:00
|
|
|
###### interface
|
2009-03-06 13:25:33 +01:00
|
|
|
|
|
|
|
options = {
|
2013-09-04 13:05:09 +02:00
|
|
|
environment.unixODBCDrivers = mkOption {
|
2016-01-17 19:34:55 +01:00
|
|
|
type = types.listOf types.package;
|
2013-09-04 13:05:09 +02:00
|
|
|
default = [];
|
2021-10-03 18:06:03 +02:00
|
|
|
example = literalExpression "with pkgs.unixODBCDrivers; [ sqlite psql ]";
|
2013-09-04 13:05:09 +02:00
|
|
|
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
|
2019-10-09 12:43:12 +02:00
|
|
|
a command line client to connect to ODBC databases.
|
2013-09-04 13:05:09 +02:00
|
|
|
'';
|
2009-03-06 13:25:33 +01:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2013-09-04 13:05:09 +02:00
|
|
|
###### implementation
|
2009-03-06 13:25:33 +01:00
|
|
|
|
2013-09-04 13:05:09 +02:00
|
|
|
config = mkIf (config.environment.unixODBCDrivers != []) {
|
2016-04-26 20:18:21 +02:00
|
|
|
environment.etc."odbcinst.ini".text = concatMapStringsSep "\n" iniDescription config.environment.unixODBCDrivers;
|
2009-03-06 13:25:33 +01:00
|
|
|
};
|
2013-09-04 13:05:09 +02:00
|
|
|
|
2009-03-06 13:25:33 +01:00
|
|
|
}
|