summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/rfcat/default.nix
blob: 58acfd52f50af5aa7e442747a4e18eaed0cfb81b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
{
  lib,
  stdenv,
  buildPythonPackage,
  fetchFromGitHub,
  future,
  ipython,
  numpy,
  pyserial,
  pyusb,
  pytestCheckHook,
  udevCheckHook,
}:

buildPythonPackage rec {
  pname = "rfcat";
  version = "2.0.1";
  format = "setuptools";

  src = fetchFromGitHub {
    owner = "atlas0fd00m";
    repo = "rfcat";
    tag = "v${version}";
    hash = "sha256-hdRsVbDXRC1EOhBoFJ9T5ZE6hwOgDWSdN5sIpxJ0x3E=";
  };

  propagatedBuildInputs = [
    future
    ipython
    numpy
    pyserial
    pyusb
  ];

  nativeBuildInputs = [
    udevCheckHook
  ];

  postInstall = lib.optionalString stdenv.hostPlatform.isLinux ''
    mkdir -p $out/etc/udev/rules.d
    cp etc/udev/rules.d/20-rfcat.rules $out/etc/udev/rules.d
  '';

  nativeCheckInputs = [ pytestCheckHook ];

  pythonImportsCheck = [ "rflib" ];

  meta = {
    description = "Swiss Army knife of sub-GHz ISM band radio";
    homepage = "https://github.com/atlas0fd00m/rfcat";
    license = lib.licenses.bsd3;
    maintainers = with lib.maintainers; [ trepetti ];
    changelog = "https://github.com/atlas0fd00m/rfcat/releases/tag/v${version}";
  };
}