about summary refs log tree commit diff
path: root/modules/hardware
diff options
context:
space:
mode:
authoraszlig <aszlig@redmoonstudios.org>2016-03-01 07:50:57 +0100
committeraszlig <aszlig@redmoonstudios.org>2016-03-01 08:20:27 +0100
commitce50e0af04c827ba6468031cd8b4cf0e08b1c89c (patch)
treefd4ed8739f604cbd7bc6cac2ecabc63f0f79ba80 /modules/hardware
parent5fa440e9cd3e54c6f6b36e8bddc240dd14a3fb53 (diff)
modules: Add hardware module for RTL8192CU
It's actually a backport of Realtek's own USB WiFi driver that is not
(yet?) in mainline. I'm using this for tyree (the T100HA) because the
internal WiFi card isn't recognized by SDHCI yet.

Signed-off-by: aszlig <aszlig@redmoonstudios.org>
Diffstat (limited to 'modules/hardware')
-rw-r--r--modules/hardware/rtl8192cu.nix47
1 files changed, 47 insertions, 0 deletions
diff --git a/modules/hardware/rtl8192cu.nix b/modules/hardware/rtl8192cu.nix
new file mode 100644
index 00000000..7ffdc63d
--- /dev/null
+++ b/modules/hardware/rtl8192cu.nix
@@ -0,0 +1,47 @@
+{ config, pkgs, lib, ... }:
+
+let
+  inherit (config.boot.kernelPackages) kernel;
+
+  modBaseDir = "kernel/drivers/net/wireless";
+
+  rtl8192cu = pkgs.stdenv.mkDerivation {
+    name = "rtl8192cu-${kernel.version}";
+
+    src = pkgs.fetchFromGitHub {
+      owner = "pvaret";
+      repo = "rtl8192cu-fixes";
+      rev = "f3edeeef68808f0f6fc06b5e36b559e1d06232ab";
+      sha256 = "0v0rrxfmvi9flrg3xns826a6n1mlgd3vs5z2x59aqvwfj5b4rv7b";
+    };
+
+    postPatch = ''
+      substituteInPlace Makefile --replace /sbin/depmod :
+    '';
+
+    makeFlags = [
+      "BUILD_KERNEL=${kernel.modDirVersion}"
+      "KSRC=${kernel.dev}/lib/modules/${kernel.modDirVersion}/build"
+      "MODDESTDIR=$(out)/lib/modules/${kernel.modDirVersion}/${modBaseDir}/"
+    ];
+
+    preInstall = ''
+      mkdir -p "$out/lib/modules/${kernel.modDirVersion}/${modBaseDir}"
+    '';
+
+    enableParallelBuilding = true;
+  };
+
+in {
+  options.vuizvui.hardware.rtl8192cu = {
+    enable = lib.mkEnableOption "support for RTL8192CU wireless chipset";
+  };
+
+  config = lib.mkIf config.vuizvui.hardware.rtl8192cu.enable {
+    boot.extraModulePackages = [ rtl8192cu ];
+    # Note that the module is called "8192cu" so we don't blacklist the module
+    # we actually want to use. The ones we blacklist here are the modules from
+    # the mainline kernel, which unfortunately do not seem to work very well.
+    boot.blacklistedKernelModules = [ "rtl8192cu" "rtl8192c_common" "rtlwifi" ];
+  };
+}