2018-07-20 20:56:59 +00:00
|
|
|
{ config, 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 21:18:21 +03:00
|
|
|
let
|
|
|
|
iniDescription = pkg: ''
|
|
|
|
[${pkg.fancyName}]
|
|
|
|
Description = ${pkg.meta.description}
|
|
|
|
Driver = ${pkg}/${pkg.driver}
|
|
|
|
'';
|
|
|
|
|
2024-12-10 20:26:33 +01:00
|
|
|
in
|
|
|
|
{
|
2013-09-04 13:05:09 +02:00
|
|
|
###### interface
|
2009-03-06 12:25:33 +00:00
|
|
|
|
|
|
|
options = {
|
2024-08-27 20:42:49 +02:00
|
|
|
environment.unixODBCDrivers = lib.mkOption {
|
|
|
|
type = lib.types.listOf lib.types.package;
|
2024-12-10 20:26:33 +01:00
|
|
|
default = [ ];
|
2024-08-27 20:42:49 +02:00
|
|
|
example = lib.literalExpression "with pkgs.unixODBCDrivers; [ sqlite psql ]";
|
2024-04-13 14:54:15 +02:00
|
|
|
description = ''
|
2013-09-04 13:05:09 +02:00
|
|
|
Specifies Unix ODBC drivers to be registered in
|
2022-07-19 15:05:45 +02:00
|
|
|
{file}`/etc/odbcinst.ini`. You may also want to
|
|
|
|
add `pkgs.unixODBC` to the system path to get
|
2019-10-09 19:43:12 +09:00
|
|
|
a command line client to connect to ODBC databases.
|
2013-09-04 13:05:09 +02:00
|
|
|
'';
|
2009-03-06 12:25:33 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2013-09-04 13:05:09 +02:00
|
|
|
###### implementation
|
2009-03-06 12:25:33 +00:00
|
|
|
|
2024-12-10 20:26:33 +01:00
|
|
|
config = lib.mkIf (config.environment.unixODBCDrivers != [ ]) {
|
|
|
|
environment.etc."odbcinst.ini".text =
|
|
|
|
lib.concatMapStringsSep "\n" iniDescription
|
|
|
|
config.environment.unixODBCDrivers;
|
2009-03-06 12:25:33 +00:00
|
|
|
};
|
2013-09-04 13:05:09 +02:00
|
|
|
|
2009-03-06 12:25:33 +00:00
|
|
|
}
|