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