summaryrefslogtreecommitdiff
path: root/lib/rust-utils.nix
diff options
context:
space:
mode:
authorFuwn <[email protected]>2024-08-31 14:40:38 -0700
committerFuwn <[email protected]>2024-08-31 14:40:38 -0700
commit81b1033e9717fbc7aed411c023a2c9364ca1d249 (patch)
tree387308cd1fc40e9b95789db7c3fbfde260a08179 /lib/rust-utils.nix
parenttings (diff)
downloadnixos-config-81b1033e9717fbc7aed411c023a2c9364ca1d249.tar.xz
nixos-config-81b1033e9717fbc7aed411c023a2c9364ca1d249.zip
t
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;
+ };
+ };
+}