Convert "unix-odbc-drivers"

svn path=/nixos/branches/fix-style/; revision=14359
This commit is contained in:
Marc Weber 2009-03-06 12:25:33 +00:00
parent 1c43b4946b
commit e344a2d055
4 changed files with 46 additions and 19 deletions

View File

@ -241,13 +241,6 @@ let
target = "nix.machines";
}
# unixODBC drivers (this solution is not perfect.. Because the user has to
# ask the admin to add a driver.. but it's an easy solution which works)
++ (let inis = config.environment.unixODBCDrivers pkgs;
in optional (inis != [] ) {
source = pkgs.writeText "odbcinst.ini" (pkgs.lib.concatStringsSep "\n" inis);
target = "odbcinst.ini";
})
;
in

View File

@ -2171,12 +2171,6 @@ in
";
};
unixODBCDrivers = mkOption {
default = pkgs : [];
example = "pkgs : map (x : x.ini) (with pkgs.unixODBCDrivers; [ mysql psql psqlng ] )";
description = "specifies unix odbc drivers to be registered at /etc/odbcinst.ini";
};
};
@ -2212,6 +2206,9 @@ in
(import ../upstart-jobs/acpid.nix) # ACPI daemon
(import ../system/unix-odbc-drivers.nix)
# security
(import ../system/sudo.nix)

View File

@ -0,0 +1,43 @@
{pkgs, config, ...}:
###### interface
let
inherit (pkgs.lib) mkOption mkIf;
options = {
environment = {
unixODBCDrivers = mkOption {
default = [];
example = "map (x : x.ini) (with pkgs.unixODBCDrivers; [ mysql psql psqlng ] )";
description = ''
specifies unix odbc drivers to be registered at /etc/odbcinst.ini.
Maybe you also want to add pkgs.unixODBC to the system path to get a
command line client t connnect to odbc databases.
'';
};
};
};
in
###### implementation
# 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
mkIf (config.environment.unixODBCDrivers != []) {
require = [
options
];
environment = {
etc = [
{ source =
let inis = config.environment.unixODBCDrivers;
in pkgs.writeText "odbcinst.ini" (pkgs.lib.concatStringsSep "\n" inis);
target = "odbcinst.ini";
}
];
};
}

View File

@ -305,12 +305,6 @@ let
inherit (config.services.bitlbee) portNumber interface;
})
# ACPI daemon.
++ optional config.powerManagement.enable
(import ../upstart-jobs/acpid.nix {
inherit config pkgs;
})
# Postfix mail server.
++ optional config.services.postfix.enable
(import ../upstart-jobs/postfix.nix {