summary refs log tree commit diff
diff options
context:
space:
mode:
authorTimo Kaufmann <timokau@zoho.com>2018-10-23 22:55:40 +0200
committerTimo Kaufmann <timokau@zoho.com>2018-10-24 11:46:10 +0200
commitc8b5deae19a6de2febaa130651343ea4c4f1a1e0 (patch)
tree3bb6abe2724729dd543497bd9ce03b13dd49b97e
parentc4650da12819a9c30c5e6601f7920ab7e949ff39 (diff)
downloadnixpkgs-c8b5deae19a6de2febaa130651343ea4c4f1a1e0.tar
nixpkgs-c8b5deae19a6de2febaa130651343ea4c4f1a1e0.tar.gz
nixpkgs-c8b5deae19a6de2febaa130651343ea4c4f1a1e0.tar.bz2
nixpkgs-c8b5deae19a6de2febaa130651343ea4c4f1a1e0.tar.lz
nixpkgs-c8b5deae19a6de2febaa130651343ea4c4f1a1e0.tar.xz
nixpkgs-c8b5deae19a6de2febaa130651343ea4c4f1a1e0.tar.zst
nixpkgs-c8b5deae19a6de2febaa130651343ea4c4f1a1e0.zip
r8168: init at 8.046.00
-rw-r--r--pkgs/os-specific/linux/r8168/default.nix56
-rw-r--r--pkgs/top-level/all-packages.nix2
2 files changed, 58 insertions, 0 deletions
diff --git a/pkgs/os-specific/linux/r8168/default.nix b/pkgs/os-specific/linux/r8168/default.nix
new file mode 100644
index 00000000000..f2c87b97c4f
--- /dev/null
+++ b/pkgs/os-specific/linux/r8168/default.nix
@@ -0,0 +1,56 @@
+{ stdenv, lib, fetchFromGitHub, kernel }:
+
+
+let modDestDir = "$out/lib/modules/${kernel.modDirVersion}/kernel/drivers/net/wireless/realtek/r8168";
+
+in stdenv.mkDerivation rec {
+  name = "r8168-${kernel.version}-${version}";
+  # on update please verify that the source matches the realtek version
+  version = "8.046.00";
+
+  # This is a mirror. The original website[1] doesn't allow non-interactive
+  # downloads, instead emailing you a download link.
+  # [1] http://www.realtek.com.tw/downloads/downloadsView.aspx?PFid=5&Level=5&Conn=4&DownTypeID=3
+  # I've verified manually (`diff -r`) that the source code for version 8.046.00
+  # is the same as the one available on the realtek website.
+  src = fetchFromGitHub {
+    owner = "mtorromeo";
+    repo = "r8168";
+    rev = version;
+    sha256 = "0y8w3biw5mshn5bvl24b9rybfh67f1s9gfzkcv9p4m7s7nchj2dg";
+  };
+
+  hardeningDisable = [ "pic" ];
+
+  nativeBuildInputs = kernel.moduleBuildDependencies;
+
+  # avoid using the Makefile directly -- it doesn't understand
+  # any kernel but the current.
+  # based on the ArchLinux pkgbuild: https://git.archlinux.org/svntogit/community.git/tree/trunk/PKGBUILD?h=packages/r8168
+  preBuild = ''
+    makeFlagsArray+=("-C${kernel.dev}/lib/modules/${kernel.modDirVersion}/build")
+    makeFlagsArray+=("SUBDIRS=$PWD/src")
+    makeFlagsArray+=("EXTRA_CFLAGS=-DCONFIG_R8168_NAPI -DCONFIG_R8168_VLAN")
+    makeFlagsArray+=("modules")
+  '';
+
+  enableParallelBuilding = true;
+
+  installPhase = ''
+    mkdir -p ${modDestDir}
+    find . -name '*.ko' -exec cp --parents '{}' ${modDestDir} \;
+    find ${modDestDir} -name '*.ko' -exec xz -f '{}' \;
+  '';
+
+  meta = with lib; {
+    description = "Realtek r8168 driver";
+    longDescription = ''
+      A kernel module for Realtek 8168 network cards.
+      If you want to use this driver, you might need to blacklist the r8169 driver
+      by adding "r8169" to boot.blacklistedKernelModules.
+    '';
+    license = licenses.gpl2Plus;
+    platforms = platforms.linux;
+    maintainers = with maintainers; [ timokau ];
+  };
+}
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index cfbc6687f9d..960aeb36bcb 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -14329,6 +14329,8 @@ with pkgs;
 
     ply = callPackage ../os-specific/linux/ply { };
 
+    r8168 = callPackage ../os-specific/linux/r8168 { };
+
     rtl8192eu = callPackage ../os-specific/linux/rtl8192eu { };
 
     rtl8723bs = callPackage ../os-specific/linux/rtl8723bs { };