nixpkgs/pkgs/os-specific/linux/crda/default.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

79 lines
2.4 KiB
Nix
Raw Normal View History

{ lib, stdenv, fetchurl, fetchpatch, libgcrypt, libnl, pkg-config, python3Packages, wireless-regdb }:
2015-12-27 17:53:01 +00:00
stdenv.mkDerivation rec {
pname = "crda";
2021-11-18 01:20:56 +00:00
version = "4.14";
2015-12-27 17:53:01 +00:00
src = fetchurl {
2021-11-18 01:20:56 +00:00
url = "https://git.kernel.org/pub/scm/linux/kernel/git/mcgrof/crda.git/snapshot/crda-${version}.tar.gz";
sha256 = "sha256-Wo81u4snR09Gaw511FG6kXQz2KqxiJZ4pk2cTnKouMI=";
2015-12-27 17:53:01 +00:00
};
2019-12-25 15:08:06 +00:00
patches = [
2021-11-18 01:20:56 +00:00
# Fix python 3 build: except ImportError, e: SyntaxError: invalid syntax
2019-12-25 15:08:06 +00:00
(fetchpatch {
2021-11-18 01:20:56 +00:00
url = "https://raw.githubusercontent.com/archlinux/svntogit-packages/d234fddf451fab0f4fc412e2769f54e11f10d7d8/trunk/crda-4.14-python-3.patch";
sha256 = "sha256-KEezEKrfizq9k4ZiE2mf3Nl4JiBayhXeVnFl7wYh28Y=";
2019-12-25 15:08:06 +00:00
})
2021-11-18 01:20:56 +00:00
2019-12-25 15:08:06 +00:00
(fetchpatch {
2021-11-18 01:20:56 +00:00
url = "https://raw.githubusercontent.com/archlinux/svntogit-packages/d48ec843222b0d74c85bce86fa6f087c7dfdf952/trunk/0001-Makefile-Link-libreg.so-against-the-crypto-library.patch";
sha256 = "sha256-j93oydi209f22OF8aXZ/NczuUOnlhkdSeYvy2WRRvm0=";
2019-12-25 15:08:06 +00:00
})
];
2021-11-18 01:20:56 +00:00
strictDeps = true;
2015-12-27 17:53:01 +00:00
nativeBuildInputs = [
pkg-config
2021-11-18 01:20:56 +00:00
python3Packages.m2crypto # only used for a build time script
];
buildInputs = [
libgcrypt
libnl
2015-12-27 17:53:01 +00:00
];
postPatch = ''
patchShebangs utils/
2020-06-25 00:36:24 +00:00
substituteInPlace Makefile \
2021-11-18 01:20:56 +00:00
--replace 'gzip' 'gzip -n' \
2020-06-25 00:36:24 +00:00
--replace ldconfig true \
--replace pkg-config $PKG_CONFIG
2015-12-27 17:53:01 +00:00
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/"
2015-12-27 17:53:01 +00:00
"REG_BIN=${wireless-regdb}/lib/crda/regulatory.bin"
];
buildFlags = [ "all_noverify" ];
enableParallelBuilding = true;
doCheck = true;
checkTarget = "verify";
meta = with lib; {
2015-12-27 17:53:01 +00:00
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.
2015-12-27 17:53:01 +00:00
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.
2015-12-27 17:53:01 +00:00
'';
2022-01-07 07:17:03 +00:00
homepage = "https://wireless.wiki.kernel.org/en/developers/regulatory/crda";
2015-12-27 17:53:01 +00:00
license = licenses.free; # "copyleft-next 0.3.0", as yet without a web site
platforms = platforms.linux;
};
}