nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 fetchFromGitHub,
4 python3Packages,
5 bcc,
6}:
7
8python3Packages.buildPythonApplication {
9 pname = "ebpf-usb";
10 version = "0-unstable-2022-04-03";
11 pyproject = false;
12
13 src = fetchFromGitHub {
14 owner = "francisrstokes";
15 repo = "ebpf-usb";
16 rev = "3ab6f0d8c6ece51bbb5cc5e05daa4008eccd70e8";
17 hash = "sha256-n3ttFej9sroTqAOgyAejwKT+aMt/z7HlVPV6CVGPNUQ=";
18 };
19
20 makeWrapperArgs = [
21 "--set PYTHONUNBUFFERED 1"
22 ];
23
24 pythonPath = [
25 bcc
26 ]
27 ++ (with python3Packages; [
28 hexdump
29 ]);
30
31 postPatch = ''
32 substituteInPlace ebpf-usb.py \
33 --replace '#!/usr/bin/env -S python3 -u' '#!/usr/bin/env python3'
34 '';
35
36 installPhase = ''
37 runHook preInstall
38 install -Dm755 ebpf-usb.py $out/bin/ebpf-usb
39 runHook postInstall
40 '';
41
42 # no tests
43 doCheck = false;
44
45 meta = {
46 description = "Python script for USB monitoring using eBPF";
47 homepage = "https://github.com/francisrstokes/ebpf-usb";
48 license = lib.licenses.unfree;
49 maintainers = with lib.maintainers; [ mevatron ];
50 mainProgram = "ebpf-usb";
51 };
52}