diff --git a/aux-etc-nixos/configuration.nix b/aux-etc-nixos/configuration.nix index 14df73c9..323efb3e 100644 --- a/aux-etc-nixos/configuration.nix +++ b/aux-etc-nixos/configuration.nix @@ -15,6 +15,9 @@ in boot.loader.grub.version = 2; boot.loader.grub.device = "/dev/sda"; + boot.blacklistedKernelModules = [ "r8169" ]; + boot.extraModulePackages = [ (pkgs.callPackage ./r8169 { kernel = config.boot.kernelPackages.kernel; }) ]; + networking.hostName = "aux"; networking.interfaces."${netifWan}".useDHCP = true; diff --git a/aux-etc-nixos/r8169/default.nix b/aux-etc-nixos/r8169/default.nix new file mode 100644 index 00000000..d96f2f55 --- /dev/null +++ b/aux-etc-nixos/r8169/default.nix @@ -0,0 +1,42 @@ +{ stdenv, lib, kernel }: + + +let modDestDir = "$out/lib/modules/${kernel.modDirVersion}/kernel/drivers/net/wireless/realtek/r8169"; + +in stdenv.mkDerivation rec { + name = "r8169-${kernel.version}-${version}"; + version = "6.030.01"; + + src = ./r8169-${version}.tar.bz2; + + hardeningDisable = [ "pic" ]; + + nativeBuildInputs = kernel.moduleBuildDependencies; + + # rename to avoid conflict with totally broken piece of crap from mainline kernel + patchPhase = + '' + substituteInPlace src/Makefile --replace r8169.o r8169-vendor.o + substituteInPlace src/Makefile --replace r8169-objs r8169-vendor-objs + ''; + + # 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 + makeFlags = kernel.makeFlags ++ [ + "-C ${kernel.dev}/lib/modules/${kernel.modDirVersion}/build" + "M=$(PWD)/src" + "modules" + ]; + preBuild = '' + makeFlagsArray+=("EXTRA_CFLAGS=-DCONFIG_R8169_NAPI -DCONFIG_R8169_VLAN -DCONFIG_ASPM -DENABLE_S5WOL -DENABLE_EEE") + ''; + + enableParallelBuilding = true; + + installPhase = '' + mkdir -p ${modDestDir} + find . -name '*.ko' -exec cp --parents '{}' ${modDestDir} \; + find ${modDestDir} -name '*.ko' -exec xz -f '{}' \; + ''; +} diff --git a/aux-etc-nixos/r8169/r8169-6.030.01.tar.bz2 b/aux-etc-nixos/r8169/r8169-6.030.01.tar.bz2 new file mode 100644 index 00000000..1b3700e2 Binary files /dev/null and b/aux-etc-nixos/r8169/r8169-6.030.01.tar.bz2 differ