summaryrefslogtreecommitdiff
path: root/lib/rust-utils.nix
diff options
context:
space:
mode:
Diffstat (limited to 'lib/rust-utils.nix')
-rw-r--r--lib/rust-utils.nix37
1 files changed, 37 insertions, 0 deletions
diff --git a/lib/rust-utils.nix b/lib/rust-utils.nix
new file mode 100644
index 0000000..87c9869
--- /dev/null
+++ b/lib/rust-utils.nix
@@ -0,0 +1,37 @@
+{ lib
+, rustPlatform
+, fetchFromGitHub
+}:
+{
+ mkRustPackage =
+ { pname
+ , version
+ , githubOwner
+ , githubHash
+ , cargoHash
+ , description ? null
+ , license
+ , maintainers
+ , buildInputs ? [ ]
+ , nativeBuildInputs ? [ ]
+ }:
+ rustPlatform.buildRustPackage rec {
+ inherit pname version buildInputs nativeBuildInputs cargoHash;
+
+ src = fetchFromGitHub {
+ owner = githubOwner;
+ repo = pname;
+ rev = version;
+ hash = githubHash;
+ };
+
+ doCheck = false;
+
+ meta = with lib; {
+ inherit description license;
+ homepage = "https://github.com/${githubOwner}/${pname}";
+ inherit maintainers;
+ mainProgram = pname;
+ };
+ };
+}