at 23.11-beta 78 lines 2.4 kB view raw
1{ lib, stdenv, fetchurl, fetchpatch, libgcrypt, libnl, pkg-config, python3Packages, wireless-regdb }: 2 3stdenv.mkDerivation rec { 4 pname = "crda"; 5 version = "4.14"; 6 7 src = fetchurl { 8 url = "https://git.kernel.org/pub/scm/linux/kernel/git/mcgrof/crda.git/snapshot/crda-${version}.tar.gz"; 9 sha256 = "sha256-Wo81u4snR09Gaw511FG6kXQz2KqxiJZ4pk2cTnKouMI="; 10 }; 11 12 patches = [ 13 # Fix python 3 build: except ImportError, e: SyntaxError: invalid syntax 14 (fetchpatch { 15 url = "https://raw.githubusercontent.com/archlinux/svntogit-packages/d234fddf451fab0f4fc412e2769f54e11f10d7d8/trunk/crda-4.14-python-3.patch"; 16 sha256 = "sha256-KEezEKrfizq9k4ZiE2mf3Nl4JiBayhXeVnFl7wYh28Y="; 17 }) 18 19 (fetchpatch { 20 url = "https://raw.githubusercontent.com/archlinux/svntogit-packages/d48ec843222b0d74c85bce86fa6f087c7dfdf952/trunk/0001-Makefile-Link-libreg.so-against-the-crypto-library.patch"; 21 sha256 = "sha256-j93oydi209f22OF8aXZ/NczuUOnlhkdSeYvy2WRRvm0="; 22 }) 23 ]; 24 25 strictDeps = true; 26 27 nativeBuildInputs = [ 28 pkg-config 29 python3Packages.m2crypto # only used for a build time script 30 ]; 31 32 buildInputs = [ 33 libgcrypt 34 libnl 35 ]; 36 37 postPatch = '' 38 patchShebangs utils/ 39 substituteInPlace Makefile \ 40 --replace 'gzip' 'gzip -n' \ 41 --replace ldconfig true \ 42 --replace pkg-config $PKG_CONFIG 43 sed -i crda.c \ 44 -e "/\/usr\/.*\/regulatory.bin/d" \ 45 -e "s|/lib/crda|${wireless-regdb}/lib/crda|g" 46 ''; 47 48 makeFlags = [ 49 "PREFIX=$(out)" 50 "SBINDIR=$(out)/bin/" 51 "UDEV_RULE_DIR=$(out)/lib/udev/rules.d/" 52 "REG_BIN=${wireless-regdb}/lib/crda/regulatory.bin" 53 ]; 54 55 buildFlags = [ "all_noverify" ]; 56 enableParallelBuilding = true; 57 58 doCheck = true; 59 checkTarget = "verify"; 60 61 meta = with lib; { 62 description = "Linux wireless Central Regulatory Domain Agent"; 63 longDescription = '' 64 CRDA acts as the udev helper for communication between the kernel and 65 userspace for regulatory compliance. It relies on nl80211 for communication. 66 67 CRDA is intended to be run only through udev communication from the kernel. 68 To use it under NixOS, add 69 70 services.udev.packages = [ pkgs.crda ]; 71 72 to the system configuration. 73 ''; 74 homepage = "https://wireless.wiki.kernel.org/en/developers/regulatory/crda"; 75 license = licenses.free; # "copyleft-next 0.3.0", as yet without a web site 76 platforms = platforms.linux; 77 }; 78}