From 707e515f828c0c44ed11d6af3784e8442c67ac04 Mon Sep 17 00:00:00 2001
From: Eelco Dolstra <eelco.dolstra@logicblox.com>
Date: Mon, 4 Feb 2008 10:52:58 +0000
Subject: [PATCH] * Option to enable support for the WIS GO7007.

svn path=/nixos/trunk/; revision=10491
---
 configuration/rescue-cd.nix           |  4 ++++
 system/options.nix                    | 22 ++++++++++++++++++++++
 system/system.nix                     |  1 +
 upstart-jobs/default.nix              |  9 ++++-----
 upstart-jobs/udev-rules/50-udev.rules |  1 +
 upstart-jobs/udev.nix                 |  7 ++++---
 6 files changed, 36 insertions(+), 8 deletions(-)

diff --git a/configuration/rescue-cd.nix b/configuration/rescue-cd.nix
index 2d9fa54b318d..7aca76d0257a 100644
--- a/configuration/rescue-cd.nix
+++ b/configuration/rescue-cd.nix
@@ -22,6 +22,10 @@ rec {
         ];
       };
     };
+
+    networking = {
+      enableIntel3945ABGFirmware = true;
+    };
     
     services = {
     
diff --git a/system/options.nix b/system/options.nix
index 98fc589b675b..f3c683220ac2 100644
--- a/system/options.nix
+++ b/system/options.nix
@@ -273,6 +273,21 @@
   };
 
 
+  # Hm, this sounds like a catch-all...
+  hardware = {
+
+    enableGo7007 = mkOption {
+      default = false;
+      description = ''
+        Enable this option to get support for the WIS GO7007SB
+        multi-format video encoder, which is used in a number of
+        devices such as the Plextor ConvertX TV402U USB TV device.
+      '';
+    };
+  
+  };
+
+
   networking = {
 
     hostName = mkOption {
@@ -1107,6 +1122,13 @@
         ";
       };
 
+      experimental = mkOption {
+        default = false;
+        description = "
+          Whether to use the new-style Apache configuration.
+        ";
+      };
+
       user = mkOption {
         default = "wwwrun";
         description = "
diff --git a/system/system.nix b/system/system.nix
index 4bc22890cb1a..4e793a5c039f 100644
--- a/system/system.nix
+++ b/system/system.nix
@@ -152,6 +152,7 @@ rec {
     ++ pkgs.lib.optional config.networking.enableIntel3945ABGFirmware pkgs.iwlwifi
     # !!! this should be declared by the xserver Upstart job.
     ++ pkgs.lib.optional (config.services.xserver.enable && config.services.xserver.videoDriver == "nvidia") pkgs.nvidiaDrivers
+    ++ pkgs.lib.optional config.hardware.enableGo7007 pkgs.wis_go7007
     ++ config.boot.extraModulePackages
   );
 
diff --git a/upstart-jobs/default.nix b/upstart-jobs/default.nix
index c2af3fff3456..0e1dfbf506ab 100644
--- a/upstart-jobs/default.nix
+++ b/upstart-jobs/default.nix
@@ -30,7 +30,8 @@ let
         ++ pkgs.lib.optional config.networking.enableIntel3945ABGFirmware pkgs.iwlwifi3945ucode
 	++ config.services.udev.addFirmware;
       extraUdevPkgs =
-        pkgs.lib.optional config.services.hal.enable pkgs.hal;
+           pkgs.lib.optional config.services.hal.enable pkgs.hal
+        ++ pkgs.lib.optional config.hardware.enableGo7007 pkgs.wis_go7007;
       sndMode = config.services.udev.sndMode;
     })
       
@@ -152,7 +153,7 @@ let
     })
 
   # Apache httpd.
-  ++ optional config.services.httpd.enable
+  ++ optional (config.services.httpd.enable && !config.services.httpd.experimental)
     (import ../upstart-jobs/httpd.nix {
       inherit config pkgs;
       inherit (pkgs) glibc;
@@ -161,12 +162,10 @@ let
     })
 
   # Apache httpd (new style).
-  /*
-  ++ optional config.services.httpd.enable
+  ++ optional (config.services.httpd.enable && config.services.httpd.experimental)
     (import ../upstart-jobs/apache-httpd {
       inherit config pkgs;
     })
-  */
 
   # MySQL server
   ++ optional config.services.mysql.enable
diff --git a/upstart-jobs/udev-rules/50-udev.rules b/upstart-jobs/udev-rules/50-udev.rules
index fde4e8687722..f6ac572cedb9 100644
--- a/upstart-jobs/udev-rules/50-udev.rules
+++ b/upstart-jobs/udev-rules/50-udev.rules
@@ -43,5 +43,6 @@ KERNEL=="seq",                  NAME="snd/%k", MODE="@sndMode@"
 
 KERNEL=="kqemu",		NAME="%k", MODE="0666"
 
+
 # Firmware loading.
 SUBSYSTEM=="firmware", ACTION=="add", RUN+="@firmwareLoader@"
diff --git a/upstart-jobs/udev.nix b/upstart-jobs/udev.nix
index e006db3587d9..3baf80533276 100644
--- a/upstart-jobs/udev.nix
+++ b/upstart-jobs/udev.nix
@@ -32,9 +32,10 @@ let
   };
 
   # The udev configuration file
-  conf = writeText "udev.conf" "
-    udev_rules=\"${udevRules}\"
-  ";
+  conf = writeText "udev.conf" ''
+    udev_rules="${udevRules}"
+    #udev_log="debug"
+  '';
 
   # Dummy file indicating whether we've run udevtrigger/udevsettle.
   # Since that *recreates* all device nodes with default permissions,