diff --git a/pkgs/os-specific/linux/mxu11x0/default.nix b/pkgs/os-specific/linux/mxu11x0/default.nix index d5129ca7f73a..ee29180a8d9d 100644 --- a/pkgs/os-specific/linux/mxu11x0/default.nix +++ b/pkgs/os-specific/linux/mxu11x0/default.nix @@ -1,13 +1,15 @@ { lib, stdenv, fetchurl, kernel }: -stdenv.mkDerivation { +let + srcs = import (./srcs.nix) { inherit fetchurl; }; +in +stdenv.mkDerivation rec { pname = "mxu11x0"; - version = "1.4-${kernel.version}"; - src = fetchurl { - url = "https://www.moxa.com/Moxa/media/PDIM/S100000385/moxa-uport-1000-series-linux-3.x-and-4.x-for-uport-11x0-series-driver-v1.4.tgz"; - sha256 = "1hz9ygabbp8pv49k1j4qcsr0v3zw9xy0bh1akqgxp5v29gbdgxjl"; - }; + src = if lib.versionAtLeast kernel.version "5.0" then srcs.mxu11x0_5.src else srcs.mxu11x0_4.src; + mxu_version = if lib.versionAtLeast kernel.version "5.0" then srcs.mxu11x0_5.version else srcs.mxu11x0_4.version; + + version = mxu_version + "-${kernel.version}"; preBuild = '' sed -i -e "s/\$(uname -r).*/${kernel.modDirVersion}/g" driver/mxconf @@ -33,6 +35,8 @@ stdenv.mkDerivation { license = licenses.gpl2Plus; maintainers = with maintainers; [ uralbash ]; platforms = platforms.linux; - broken = kernel.kernelAtLeast "5.4"; + # broken due to API change in write_room() > v5.14-rc1 + # https://github.com/torvalds/linux/commit/94cc7aeaf6c0cff0b8aeb7cb3579cee46b923560 + broken = kernel.kernelAtLeast "5.14"; }; } diff --git a/pkgs/os-specific/linux/mxu11x0/srcs.nix b/pkgs/os-specific/linux/mxu11x0/srcs.nix new file mode 100644 index 000000000000..5c4e9137c6a6 --- /dev/null +++ b/pkgs/os-specific/linux/mxu11x0/srcs.nix @@ -0,0 +1,18 @@ +{ fetchurl }: + +{ + mxu11x0_4 = { + version = "4.1"; + src = fetchurl { + url = "https://www.moxa.com/getmedia/b152d8c2-b9d6-4bc7-b0f4-420633b4bc2d/moxa-uport-1100-series-linux-kernel-4.x-driver-v4.1.tgz"; + sha256 = "sha256-sbq5M5FQjrrORtSS07PQHf+MAZArxFcUDN5wszBwbnc="; + }; + }; + mxu11x0_5 = { + version = "5.1"; + src = fetchurl { + url = "https://www.moxa.com/getmedia/57dfa4c1-8a2a-4da6-84c1-a36944ead74d/moxa-uport-1100-series-linux-kernel-5.x-driver-v5.1.tgz"; + sha256 = "sha256-pdFIiD5naSDdYwRz8ww8Mg8z1gDOfZ/OeO6Q5n+kjDQ="; + }; + }; +}