From 8dbab2753bebaedad1dc3411b5b2eec006f08b63 Mon Sep 17 00:00:00 2001
From: Rafael Varago <varago.rafael@gmail.com>
Date: Mon, 21 Jun 2021 18:09:19 +0200
Subject: [PATCH] cargo-modules: init at 0.5.0

This patch includes a cargo plugin to generate
tree-like overviews of a crate's modules.

Co-authored-by: legendofmiracles <30902201+legendofmiracles@users.noreply.github.com>
---
 .../tools/rust/cargo-modules/default.nix      | 22 +++++++++++++++++++
 pkgs/top-level/all-packages.nix               |  1 +
 2 files changed, 23 insertions(+)
 create mode 100644 pkgs/development/tools/rust/cargo-modules/default.nix

diff --git a/pkgs/development/tools/rust/cargo-modules/default.nix b/pkgs/development/tools/rust/cargo-modules/default.nix
new file mode 100644
index 000000000000..f894915c24ec
--- /dev/null
+++ b/pkgs/development/tools/rust/cargo-modules/default.nix
@@ -0,0 +1,22 @@
+{ lib, rustPlatform, fetchFromGitHub }:
+
+rustPlatform.buildRustPackage rec {
+  pname = "cargo-modules";
+  version = "0.5.0";
+
+  src = fetchFromGitHub {
+    owner = "regexident";
+    repo = pname;
+    rev = version;
+    sha256 = "0y6ag8nar85l2fh2ca41fglkzc74cv1p5szxrhk1jdqnd2qzhvjp";
+  };
+
+  cargoSha256 = "0m5r36p57w4vw2g3hg12s38ay328swjb0qfl381xwb2xqx10g8kx";
+
+  meta = with lib; {
+    description = "A cargo plugin for showing a tree-like overview of a crate's modules";
+    homepage = "https://github.com/regexident/cargo-modules";
+    license = with licenses; [ mpl20 ];
+    maintainers = with maintainers; [ rvarago ];
+  };
+}
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index 45baaaa3099f..22f0f3fd2909 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -11916,6 +11916,7 @@ in
   cargo-make = callPackage ../development/tools/rust/cargo-make {
     inherit (darwin.apple_sdk.frameworks) Security SystemConfiguration;
   };
+  cargo-modules = callPackage ../development/tools/rust/cargo-modules { };
   cargo-msrv = callPackage ../development/tools/rust/cargo-msrv {
     inherit (darwin.apple_sdk.frameworks) Security;
   };