I’m trying to package a Rust application as such:
{rustPlatform, fetchFromGitHub, pkg-config, lib, udev}:
rustPlatform.buildRustPackage rec {
pname = "rust-streamdeck";
version = "0.9.0";
src = fetchFromGitHub {
owner = "ryankurte";
repo = "rust-streamdeck";
rev = "v${version}";
hash = "sha256-9FuTnRQHKYJzMqhhgyTVq2R+drn4HAr3GDNjQgc3r+w=";
};
postPatch = ''
ln -s ${./Cargo.lock} Cargo.lock
'';
cargoLock = {
lockFile = ./Cargo.lock;
};
nativeBuildinputs = [ pkg-config ];
buildinputs = [ udev.dev ];
doInstallCheck = false;
installPhase = ''
mkdir -p $out/lib/udev/rules.d
cp $src/40-streamdeck.rules $out/lib/udev/rules.d/
'';
meta = {
description = "ibusb based driver for Elgato StreamDeck devices";
homepage = "https://github.com/ryankurte/rust-streamdeck";
license = lib.licenses.mpl20;
maintainers = [ lib.maintainers.blackheaven ];
mainProgram = "streamdeck-cli";
};
}
See the full code here.
However, when I build it, it does not find pkg-config
:
rust-streamdeck> thread 'main' panicked at /build/cargo-vendor-dir/hidapi-2.6.3/build.rs:61:54:
rust-streamdeck> Unable to find libudev: Could not run `PKG_CONFIG_ALLOW_SYSTEM_LIBS=1 PKG_CONFIG_ALLOW_SYSTEM_CFLAGS=1 pkg-config --libs --cflags libudev`
rust-streamdeck> The pkg-config command could not be found.
rust-streamdeck> Most likely, you need to install a pkg-config package for your OS.
rust-streamdeck> Try `apt install pkg-config`, or `yum install pkg-config`,
rust-streamdeck> or `pkg install pkg-config`, or `apk add pkgconfig` depending on your distribution.
rust-streamdeck> If you've already installed it, ensure the pkg-config command is one of the
rust-streamdeck> directories in the PATH environment variable.
rust-streamdeck> If you did not expect this build to link to a pre-installed system library,
rust-streamdeck> then check documentation of the hidapi crate for an option to
rust-streamdeck> build the library from source, or disable features or dependencies
rust-streamdeck> that require pkg-config.
rust-streamdeck> note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
I works in another package
rustPlatform.buildRustPackage rec {
nativeBuildInputs = [
pkg-config
glib # for glib-compile-resources
wrapGAppsHook3
];
buildInputs = [
gtk3
hidapi
libusb1
udev
];
# ...
}
Is there something I should change to make it work?
Thanks in advance for your help.