nixpkgs/pkgs/os-specific/linux/mxu11x0/default.nix
Profpatsch 4a7f99d55d treewide: with stdenv.lib; in meta -> with lib;
Part of: https://github.com/NixOS/nixpkgs/issues/108938

meta = with stdenv.lib;

is a widely used pattern. We want to slowly remove
the `stdenv.lib` indirection and encourage people
to use `lib` directly. Thus let’s start with the meta
field.

This used a rewriting script to mostly automatically
replace all occurances of this pattern, and add the
`lib` argument to the package header if it doesn’t
exist yet.

The script in its current form is available at
https://cs.tvl.fyi/depot@2f807d7f141068d2d60676a89213eaa5353ca6e0/-/blob/users/Profpatsch/nixpkgs-rewriter/default.nix
2021-01-11 10:38:22 +01:00

37 lines
1.3 KiB
Nix

{ lib, stdenv, fetchurl, kernel }:
stdenv.mkDerivation {
name = "mxu11x0-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";
};
preBuild = ''
sed -i -e "s/\$(uname -r).*/${kernel.modDirVersion}/g" driver/mxconf
sed -i -e "s/\$(shell uname -r).*/${kernel.modDirVersion}/g" driver/Makefile
sed -i -e 's|/lib/modules|${kernel.dev}/lib/modules|' driver/mxconf
sed -i -e 's|/lib/modules|${kernel.dev}/lib/modules|' driver/Makefile
'';
installPhase = ''
install -v -D -m 644 ./driver/mxu11x0.ko "$out/lib/modules/${kernel.modDirVersion}/kernel/drivers/usb/serial/mxu11x0.ko"
install -v -D -m 644 ./driver/mxu11x0.ko "$out/lib/modules/${kernel.modDirVersion}/misc/mxu11x0.ko"
'';
dontStrip = true;
enableParallelBuilding = true;
hardeningDisable = [ "pic" ];
meta = with lib; {
description = "MOXA UPort 11x0 USB to Serial Hub driver";
homepage = "https://www.moxa.com/en/products/industrial-edge-connectivity/usb-to-serial-converters-usb-hubs/usb-to-serial-converters/uport-1000-series";
license = licenses.gpl2Plus;
maintainers = with maintainers; [ uralbash ];
platforms = platforms.linux;
};
}