nixpkgs/pkgs/os-specific/linux/crda/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

79 lines
2.4 KiB
Nix

{ lib, stdenv, fetchurl, fetchpatch, libgcrypt, libnl, pkgconfig, python3Packages, wireless-regdb }:
stdenv.mkDerivation rec {
pname = "crda";
version = "3.18";
src = fetchurl {
sha256 = "1gydiqgb08d9gbx4l6gv98zg3pljc984m50hmn3ysxcbkxkvkz23";
url = "http://kernel.org/pub/software/network/crda/crda-${version}.tar.xz";
};
patches = [
# Switch to Python 3
# https://lore.kernel.org/linux-wireless/1437542484-23409-1-git-send-email-ahmed.taahir@gmail.com/
(fetchpatch {
url = "https://lore.kernel.org/linux-wireless/1437542484-23409-2-git-send-email-ahmed.taahir@gmail.com/raw";
sha256 = "0s2n340cgaasvg1k8g9v8xjrbh4y2mcgrhdmv97ja2fs8xjcjbf1";
})
(fetchpatch {
url = "https://lore.kernel.org/linux-wireless/1437542484-23409-3-git-send-email-ahmed.taahir@gmail.com/raw";
sha256 = "01dlfw7kqhyx025jxq2l75950b181p9r7i9zkflcwvbzzdmx59md";
})
];
buildInputs = [ libgcrypt libnl ];
nativeBuildInputs = [
pkgconfig
python3Packages.pycrypto
];
postPatch = ''
patchShebangs utils/
substituteInPlace Makefile \
--replace ldconfig true \
--replace pkg-config $PKG_CONFIG
sed -i crda.c \
-e "/\/usr\/.*\/regulatory.bin/d" \
-e "s|/lib/crda|${wireless-regdb}/lib/crda|g"
'';
makeFlags = [
"PREFIX=$(out)"
"SBINDIR=$(out)/bin/"
"UDEV_RULE_DIR=$(out)/lib/udev/rules.d/"
"REG_BIN=${wireless-regdb}/lib/crda/regulatory.bin"
];
NIX_CFLAGS_COMPILE = "-Wno-error=unused-const-variable";
buildFlags = [ "all_noverify" ];
enableParallelBuilding = true;
doCheck = true;
checkTarget = "verify";
postInstall = ''
# The patch installs build header
rm $out/include/reglib/keys-gcrypt.h
'';
meta = with lib; {
description = "Linux wireless Central Regulatory Domain Agent";
longDescription = ''
CRDA acts as the udev helper for communication between the kernel and
userspace for regulatory compliance. It relies on nl80211 for communication.
CRDA is intended to be run only through udev communication from the kernel.
To use it under NixOS, add
services.udev.packages = [ pkgs.crda ];
to the system configuration.
'';
homepage = "http://drvbp1.linux-foundation.org/~mcgrof/rel-html/crda/";
license = licenses.free; # "copyleft-next 0.3.0", as yet without a web site
platforms = platforms.linux;
};
}