3
0
Fork 0
forked from mirrors/nixpkgs

unix-odbc-drivers module: update for new unixODBCDrivers

This commit is contained in:
Nikolay Amiantov 2016-04-26 21:18:21 +03:00
parent 1a3f7d553d
commit 5a40332d70

View file

@ -5,14 +5,21 @@ with 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 = mkOption {
type = types.listOf types.package;
default = [];
example = literalExample "with pkgs.unixODBCDrivers; [ mysql psql psqlng ]";
example = literalExample "with pkgs.unixODBCDrivers; [ sqlite psql ]";
description = ''
Specifies Unix ODBC drivers to be registered in
<filename>/etc/odbcinst.ini</filename>. You may also want to
@ -25,11 +32,7 @@ with lib;
###### implementation
config = mkIf (config.environment.unixODBCDrivers != []) {
environment.etc."odbcinst.ini".text =
let inis = map (x : x.ini) config.environment.unixODBCDrivers;
in lib.concatStringsSep "\n" inis;
environment.etc."odbcinst.ini".text = concatMapStringsSep "\n" iniDescription config.environment.unixODBCDrivers;
};
}