about summary refs log tree commit diff
path: root/nixpkgs/pkgs/os-specific/linux/mdevctl/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/os-specific/linux/mdevctl/default.nix')
-rw-r--r--nixpkgs/pkgs/os-specific/linux/mdevctl/default.nix42
1 files changed, 42 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/os-specific/linux/mdevctl/default.nix b/nixpkgs/pkgs/os-specific/linux/mdevctl/default.nix
new file mode 100644
index 000000000000..ce4ea250827b
--- /dev/null
+++ b/nixpkgs/pkgs/os-specific/linux/mdevctl/default.nix
@@ -0,0 +1,42 @@
+{ lib
+, rustPlatform
+, fetchCrate
+, docutils
+, installShellFiles
+}:
+
+rustPlatform.buildRustPackage rec {
+  pname = "mdevctl";
+  version = "1.3.0";
+
+  src = fetchCrate {
+    inherit pname version;
+    hash = "sha256-4K4NW3DOTtzZJ7Gg0mnRPr88YeqEjTtKX+C4P8i923E=";
+  };
+
+  cargoHash = "sha256-hCqNy32uPLsKfUJqiG2DRcXfqdvlp4bCutQmt+FieXc=";
+
+  nativeBuildInputs = [
+    docutils
+    installShellFiles
+  ];
+
+  postInstall = ''
+    ln -s mdevctl $out/bin/lsmdev
+
+    install -Dm444 60-mdevctl.rules -t $out/lib/udev/rules.d
+
+    installManPage $releaseDir/build/mdevctl-*/out/mdevctl.8
+    ln -s mdevctl.8 $out/share/man/man8/lsmdev.8
+
+    installShellCompletion $releaseDir/build/mdevctl-*/out/{lsmdev,mdevctl}.bash
+  '';
+
+  meta = with lib; {
+    homepage = "https://github.com/mdevctl/mdevctl";
+    description = "A mediated device management utility for linux";
+    license = licenses.lgpl21Only;
+    maintainers = with maintainers; [ edwtjo ];
+    platforms = platforms.linux;
+  };
+}