about summary refs log tree commit diff
path: root/pkgs/os-specific/linux/mdevctl/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/os-specific/linux/mdevctl/default.nix')
-rw-r--r--pkgs/os-specific/linux/mdevctl/default.nix36
1 files changed, 24 insertions, 12 deletions
diff --git a/pkgs/os-specific/linux/mdevctl/default.nix b/pkgs/os-specific/linux/mdevctl/default.nix
index 9762011b7a304..80c3c1316d85d 100644
--- a/pkgs/os-specific/linux/mdevctl/default.nix
+++ b/pkgs/os-specific/linux/mdevctl/default.nix
@@ -1,24 +1,36 @@
-{ lib, fetchFromGitHub
-, rustPackages, pkg-config, docutils
+{ lib
+, rustPlatform
+, fetchCrate
+, docutils
+, installShellFiles
 }:
 
-rustPackages.rustPlatform.buildRustPackage rec {
-
+rustPlatform.buildRustPackage rec {
   pname = "mdevctl";
   version = "1.2.0";
 
-  src = fetchFromGitHub {
-    owner = pname;
-    repo = pname;
-    rev = "v" + version;
-    hash = "sha256-Hgl+HsWAYIdabHJdPbCaBNnhY49vpuIjR3l6z2CAmx0=";
+  src = fetchCrate {
+    inherit pname version;
+    hash = "sha256-0X/3DWNDPOgSNNTqcj44sd7DNGFt+uGBjkc876dSgU8=";
   };
 
-  cargoPatches = [ ./lock.patch ];
+  cargoHash = "sha256-TmumQBWuH5fJOe2qzcDtEGbmCs2G9Gfl8mH7xifzRGc=";
+
+  nativeBuildInputs = [
+    docutils
+    installShellFiles
+  ];
+
+  postInstall = ''
+    ln -s mdevctl $out/bin/lsmdev
+
+    install -Dm444 60-mdevctl.rules -t $out/lib/udev/rules.d
 
-  cargoHash = "sha256-PXVc7KUMPze06gCnD2gqzlySwPumOw/z31CTd0UHp9w=";
+    installManPage $releaseDir/build/mdevctl-*/out/mdevctl.8
+    ln -s mdevctl.8 $out/share/man/man8/lsmdev.8
 
-  nativeBuildInputs = [ pkg-config docutils ];
+    installShellCompletion $releaseDir/build/mdevctl-*/out/{lsmdev,mdevctl}.bash
+  '';
 
   meta = with lib; {
     homepage = "https://github.com/mdevctl/mdevctl";