2020-04-24 23:36:52 +00:00
|
|
|
{ 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 = {
|
2024-09-19 14:19:46 +00:00
|
|
|
environment.unixODBCDrivers = lib.mkOption {
|
|
|
|
type = lib.types.listOf lib.types.package;
|
2020-04-24 23:36:52 +00:00
|
|
|
default = [];
|
2024-09-19 14:19:46 +00:00
|
|
|
example = lib.literalExpression "with pkgs.unixODBCDrivers; [ sqlite psql ]";
|
2024-04-21 15:54:59 +00:00
|
|
|
description = ''
|
2020-04-24 23:36:52 +00:00
|
|
|
Specifies Unix ODBC drivers to be registered in
|
2022-08-12 12:06:08 +00:00
|
|
|
{file}`/etc/odbcinst.ini`. You may also want to
|
|
|
|
add `pkgs.unixODBC` to the system path to get
|
2020-04-24 23:36:52 +00:00
|
|
|
a command line client to connect to ODBC databases.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
###### implementation
|
|
|
|
|
2024-09-19 14:19:46 +00:00
|
|
|
config = lib.mkIf (config.environment.unixODBCDrivers != []) {
|
|
|
|
environment.etc."odbcinst.ini".text = lib.concatMapStringsSep "\n" iniDescription config.environment.unixODBCDrivers;
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|