Hello guys!
So I’ve got an understanding question.
There are multiple ways in buildRustPackage
to declare the buildInputs
and nativeBuildInputs
dependencies but what is the right way?
Version 1
Here I’m declaring the dependencies through the function arguments.
# here I'm listing the dependencies here
{ lib, fetchFromGitHub, rustPlatform, dep1, dep2, ... }:
rustPlatform.buildRustPackage rec {
pname = "ripgrep";
version = "12.1.1";
buildInputs = [
dep1
];
nativeBuildInputs = [
dep2
];
src = fetchFromGitHub {
owner = "BurntSushi";
repo = pname;
rev = version;
hash = "sha256-+s5RBC3XSgb8omTbUNLywZnP6jSxZBKSS1BmXOjRF8M=";
};
cargoHash = "sha256-jtBw4ahSl88L0iuCXxQgZVm1EcboWRJMNtjxLVTtzts=";
meta = with lib; {
description = "A fast line-oriented regex search tool, similar to ag and ack";
homepage = "https://github.com/BurntSushi/ripgrep";
license = licenses.unlicense;
maintainers = [];
};
}
Version 2
In this version, I’m using pkgs
to declare the dependencies.
{ lib, fetchFromGitHub, rustPlatform }:
rustPlatform.buildRustPackage rec {
pname = "ripgrep";
version = "12.1.1";
buildInputs = with pkgs; [
dep1
];
nativeBuildInputs = with pkgs; [
dep2
];
src = fetchFromGitHub {
owner = "BurntSushi";
repo = pname;
rev = version;
hash = "sha256-+s5RBC3XSgb8omTbUNLywZnP6jSxZBKSS1BmXOjRF8M=";
};
cargoHash = "sha256-jtBw4ahSl88L0iuCXxQgZVm1EcboWRJMNtjxLVTtzts=";
meta = with lib; {
description = "A fast line-oriented regex search tool, similar to ag and ack";
homepage = "https://github.com/BurntSushi/ripgrep";
license = licenses.unlicense;
maintainers = [];
};
}
Is there a big difference between those two versions? Which should I prefer?
I was told on the unofficial nixos-discord server, that I shouldn’t mention pkgs
here due to black magic of pkgs.callPackage
and nativeBuildInputs
and buildInputs
so I’d like to know more about it.