summaryrefslogtreecommitdiff
path: root/lib
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
parentcpu: remove duplicate microcode key (diff)
downloadnixos-config-e46742c57278d2633ab4c237b778d62ab7be9567.tar.xz
nixos-config-e46742c57278d2633ab4c237b778d62ab7be9567.zip
lib: refactor build-rust-package
Diffstat (limited to 'lib')
-rw-r--r--lib/build-rust-package.nix42
-rw-r--r--lib/rust-utils.nix45
2 files changed, 42 insertions, 45 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;
+ };
+}
diff --git a/lib/rust-utils.nix b/lib/rust-utils.nix
deleted file mode 100644
index 8b0efb6..0000000
--- a/lib/rust-utils.nix
+++ /dev/null
@@ -1,45 +0,0 @@
-{
- 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;
- };
- };
-}