From e344a2d055e01a2b98d03961b99a8c7c9efaf4bd Mon Sep 17 00:00:00 2001 From: Marc Weber Date: Fri, 6 Mar 2009 12:25:33 +0000 Subject: [PATCH] Convert "unix-odbc-drivers" svn path=/nixos/branches/fix-style/; revision=14359 --- etc/default.nix | 7 ------ system/options.nix | 9 +++----- system/unix-odbc-drivers.nix | 43 ++++++++++++++++++++++++++++++++++++ upstart-jobs/default.nix | 6 ----- 4 files changed, 46 insertions(+), 19 deletions(-) create mode 100644 system/unix-odbc-drivers.nix diff --git a/etc/default.nix b/etc/default.nix index fc07a39f9be7..5e8406d6ffae 100644 --- a/etc/default.nix +++ b/etc/default.nix @@ -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 diff --git a/system/options.nix b/system/options.nix index 1b924accb5df..9e30c5053453 100644 --- a/system/options.nix +++ b/system/options.nix @@ -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) diff --git a/system/unix-odbc-drivers.nix b/system/unix-odbc-drivers.nix new file mode 100644 index 000000000000..7df87db8577c --- /dev/null +++ b/system/unix-odbc-drivers.nix @@ -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"; + } + ]; + }; +} diff --git a/upstart-jobs/default.nix b/upstart-jobs/default.nix index 39bc6b3b8493..f96b9cb30844 100644 --- a/upstart-jobs/default.nix +++ b/upstart-jobs/default.nix @@ -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 {