at 16.09-beta 1.1 kB view raw
1{ config, lib, pkgs, ... }: 2 3with lib; 4 5# unixODBC drivers (this solution is not perfect.. Because the user has to 6# ask the admin to add a driver.. but it's simple and works 7 8let 9 iniDescription = pkg: '' 10 [${pkg.fancyName}] 11 Description = ${pkg.meta.description} 12 Driver = ${pkg}/${pkg.driver} 13 ''; 14 15in { 16 ###### interface 17 18 options = { 19 environment.unixODBCDrivers = mkOption { 20 type = types.listOf types.package; 21 default = []; 22 example = literalExample "with pkgs.unixODBCDrivers; [ sqlite psql ]"; 23 description = '' 24 Specifies Unix ODBC drivers to be registered in 25 <filename>/etc/odbcinst.ini</filename>. You may also want to 26 add <literal>pkgs.unixODBC</literal> to the system path to get 27 a command line client to connnect to ODBC databases. 28 ''; 29 }; 30 }; 31 32 ###### implementation 33 34 config = mkIf (config.environment.unixODBCDrivers != []) { 35 environment.etc."odbcinst.ini".text = concatMapStringsSep "\n" iniDescription config.environment.unixODBCDrivers; 36 }; 37 38}