summaryrefslogtreecommitdiff
path: root/lib/build-rust-package.nix
diff options
context:
space:
mode:
authorFuwn <[email protected]>2024-09-14 03:53:59 -0700
committerFuwn <[email protected]>2024-09-14 03:53:59 -0700
commite46742c57278d2633ab4c237b778d62ab7be9567 (patch)
tree214303c8d08fc8ee7c0c6c9e09ea8458bb8cdb57 /lib/build-rust-package.nix
parentcpu: remove duplicate microcode key (diff)
downloadnixos-config-e46742c57278d2633ab4c237b778d62ab7be9567.tar.xz
nixos-config-e46742c57278d2633ab4c237b778d62ab7be9567.zip
lib: refactor build-rust-package
Diffstat (limited to 'lib/build-rust-package.nix')
-rw-r--r--lib/build-rust-package.nix42
1 files changed, 42 insertions, 0 deletions
diff --git a/lib/build-rust-package.nix b/lib/build-rust-package.nix
new file mode 100644
index 0000000..f1a6624
--- /dev/null
+++ b/lib/build-rust-package.nix
@@ -0,0 +1,42 @@
+{
+ lib,
+ rustPlatform,
+ fetchFromGitHub,
+}:
+{
+ 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;
+ };
+}