1{
2 lib,
3 rustPlatform,
4 fetchCrate,
5 docutils,
6 installShellFiles,
7 udevCheckHook,
8}:
9
10rustPlatform.buildRustPackage rec {
11 pname = "mdevctl";
12 version = "1.4.0";
13
14 src = fetchCrate {
15 inherit pname version;
16 hash = "sha256-Zh+Dj3X87tTpqT/weZMpf7f3obqikjPy9pi50ifp6wQ=";
17 };
18
19 # https://github.com/mdevctl/mdevctl/issues/111
20 patches = [
21 ./script-dir.patch
22 ];
23
24 cargoHash = "sha256-LG5UaSUTF6pVx7BBLiZ/OmAZNCKswFlTqHymg3bDkuc=";
25
26 nativeBuildInputs = [
27 docutils
28 installShellFiles
29 udevCheckHook
30 ];
31
32 doInstallCheck = true;
33
34 postInstall = ''
35 ln -s mdevctl $out/bin/lsmdev
36
37 install -Dm444 60-mdevctl.rules -t $out/lib/udev/rules.d
38
39 installManPage $releaseDir/build/mdevctl-*/out/mdevctl.8
40 ln -s mdevctl.8 $out/share/man/man8/lsmdev.8
41
42 installShellCompletion $releaseDir/build/mdevctl-*/out/{lsmdev,mdevctl}.bash
43 '';
44
45 meta = with lib; {
46 homepage = "https://github.com/mdevctl/mdevctl";
47 description = "Mediated device management utility for linux";
48 license = licenses.lgpl21Only;
49 maintainers = with maintainers; [ edwtjo ];
50 platforms = platforms.linux;
51 };
52}