mirror of
https://github.com/nix-community/dream2nix.git
synced 2024-10-26 23:28:55 +03:00
buildRustPackage: add example package
This commit is contained in:
parent
1caf997f69
commit
72e4fd904d
@ -0,0 +1,29 @@
|
||||
{
|
||||
lib,
|
||||
config,
|
||||
dream2nix,
|
||||
...
|
||||
}: {
|
||||
imports = [
|
||||
dream2nix.modules.dream2nix.rust-cargo-lock
|
||||
dream2nix.modules.dream2nix.buildRustPackage
|
||||
];
|
||||
|
||||
deps = {nixpkgs, ...}: {
|
||||
inherit (nixpkgs) fetchFromGitHub;
|
||||
};
|
||||
|
||||
name = lib.mkForce "ripgrep";
|
||||
version = lib.mkForce "13.0.0";
|
||||
|
||||
# options defined on top-level will be applied to the main derivation (the derivation that is exposed)
|
||||
mkDerivation = {
|
||||
# define the source root that contains the package we want to build.
|
||||
src = config.deps.fetchFromGitHub {
|
||||
owner = "BurntSushi";
|
||||
repo = "ripgrep";
|
||||
rev = config.version;
|
||||
sha256 = "sha256-udEh+Re2PeO3DnX4fQThsaT1Y3MBHFfrX5Q5EN2XrF0=";
|
||||
};
|
||||
};
|
||||
}
|
@ -146,6 +146,7 @@
|
||||
in {
|
||||
imports = [
|
||||
dream2nix.modules.dream2nix.mkDerivation
|
||||
./interface.nix
|
||||
];
|
||||
|
||||
package-func.func = config.deps.rustPlatform.buildRustPackage;
|
||||
@ -158,12 +159,14 @@ in {
|
||||
deps = {nixpkgs, ...}: {
|
||||
inherit
|
||||
(nixpkgs)
|
||||
cargo
|
||||
fetchurl
|
||||
jq
|
||||
moreutils
|
||||
python3Packages
|
||||
runCommandLocal
|
||||
rustPlatform
|
||||
writeText
|
||||
;
|
||||
inherit
|
||||
(nixpkgs.writers)
|
||||
|
12
modules/dream2nix/buildRustPackage/interface.nix
Normal file
12
modules/dream2nix/buildRustPackage/interface.nix
Normal file
@ -0,0 +1,12 @@
|
||||
{lib, ...}: {
|
||||
options.deps = {
|
||||
cargo = lib.mkOption {
|
||||
type = lib.types.package;
|
||||
description = "The cargo package to use";
|
||||
};
|
||||
writeText = lib.mkOption {
|
||||
type = lib.types.raw;
|
||||
description = "The function to use to write text to a file";
|
||||
};
|
||||
};
|
||||
}
|
Loading…
Reference in New Issue
Block a user