1{ stdenv, fetchurl, libgcrypt, libnl, pkgconfig, python2Packages, wireless-regdb }:
2
3stdenv.mkDerivation rec {
4 name = "crda-${version}";
5 version = "3.18";
6
7 src = fetchurl {
8 sha256 = "1gydiqgb08d9gbx4l6gv98zg3pljc984m50hmn3ysxcbkxkvkz23";
9 url = "http://kernel.org/pub/software/network/crda/crda-${version}.tar.xz";
10 };
11
12 buildInputs = [ libgcrypt libnl ];
13 nativeBuildInputs = [
14 pkgconfig python2Packages.m2crypto python2Packages.python
15 ];
16
17 postPatch = ''
18 patchShebangs utils/
19 substituteInPlace Makefile --replace ldconfig true
20 sed -i crda.c \
21 -e "/\/usr\/.*\/regulatory.bin/d" \
22 -e "s|/lib/crda|${wireless-regdb}/lib/crda|g"
23 '';
24
25 makeFlags = [
26 "PREFIX=$(out)"
27 "SBINDIR=$(out)/bin/"
28 "UDEV_RULE_DIR=$(out)/lib/udev/rules.d/"
29 "REG_BIN=${wireless-regdb}/lib/crda/regulatory.bin"
30 ];
31
32 NIX_CFLAGS_COMPILE = "-Wno-error=unused-const-variable";
33
34 buildFlags = [ "all_noverify" ];
35 enableParallelBuilding = true;
36
37 doCheck = true;
38 checkTarget = "verify";
39
40 meta = with stdenv.lib; {
41 description = "Linux wireless Central Regulatory Domain Agent";
42 longDescription = ''
43 CRDA acts as the udev helper for communication between the kernel and
44 userspace for regulatory compliance. It relies on nl80211 for communication.
45
46 CRDA is intended to be run only through udev communication from the kernel.
47 To use it under NixOS, add
48
49 services.udev.packages = [ pkgs.crda ];
50
51 to the system configuration.
52 '';
53 homepage = http://drvbp1.linux-foundation.org/~mcgrof/rel-html/crda/;
54 license = licenses.free; # "copyleft-next 0.3.0", as yet without a web site
55 platforms = platforms.linux;
56 };
57}