summaryrefslogtreecommitdiffstats
path: root/pkgs/by-name/pe/persistent-evdev/package.nix
blob: 309a2f74998031f5227540d8dd0f36006fcf1708 (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
56
57
{
  lib,
  python3Packages,
  fetchFromGitHub,
  udevCheckHook,
}:

python3Packages.buildPythonPackage {
  pname = "persistent-evdev";
  version = "unstable-2022-05-07";
  pyproject = false;

  src = fetchFromGitHub {
    owner = "aiberia";
    repo = "persistent-evdev";
    rev = "52bf246464e09ef4e6f2e1877feccc7b9feba164";
    hash = "sha256-d0i6DL/qgDELet4ew2lyVqzd9TApivRxL3zA3dcsQXY=";
  };

  propagatedBuildInputs = with python3Packages; [
    evdev
    pyudev
  ];

  nativeBuildInputs = [
    udevCheckHook
  ];

  doInstallCheck = true;

  postPatch = ''
    patchShebangs bin/persistent-evdev.py
  '';

  dontBuild = true;

  installPhase = ''
    runHook preInstall

    mkdir -p $out/bin
    cp bin/persistent-evdev.py $out/bin

    mkdir -p $out/etc/udev/rules.d
    cp udev/60-persistent-input-uinput.rules $out/etc/udev/rules.d

    runHook postInstall
  '';

  meta = {
    homepage = "https://github.com/aiberia/persistent-evdev";
    description = "Persistent virtual input devices for qemu/libvirt/evdev hotplug support";
    license = lib.licenses.mit;
    maintainers = [ lib.maintainers.lodi ];
    platforms = lib.platforms.linux;
    mainProgram = "persistent-evdev.py";
  };
}