Cannot find alsa when compiling the Amethyst game engine in a rust overlay

476 views
Skip to first unread message

il...@nym.hush.com

unread,
Jul 12, 2018, 9:53:20 AM7/12/18
to nix-...@googlegroups.com
Hi,

I'm trying out a Rust game engine called Amethyst and I've set up a rust overlay with this guide: https://github.com/NixOS/nixpkgs/blob/master/doc/languages-frameworks/rust.section.md#using-the-rust-nightlies-overlay

My default.nix is as follows:

```nix
with import <nixpkgs> {};

stdenv.mkDerivation rec {
  name = "env";
  env = buildEnv { name = name; paths = buildInputs; };

  buildInputs = [ latest.rustChannels.stable.rust
                  alsaLib
                  alsa-firmware
                  alsaOss
                  alsaPlugins
                  alsaTools
                  alsaUtils
                  ams-lv2
                  alsaPluginWrapper
                  apulse
                  python3
                ];
}
```

So far I'm only trying to get the project compiled. When I run `cargo build` inside a nix-shell I get this error: 
```
   Compiling alsa-sys v0.1.2
   Compiling wayland-client v0.12.5
   Compiling wayland-protocols v0.12.5
   Compiling syn v0.14.4
error: failed to run custom build command for `alsa-sys v0.1.2`
process didn't exit successfully: `/home/lassi/Documents/amethyst_test/target/debug/build/alsa-sys-c596e20bf4672788/build-script-build` (exit code: 101)
--- stderr
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: "Failed to run `\"pkg-config\" \"--libs\" \"--cflags\" \"alsa\"`: No such file or directory (os error 2)"', libcore/result.rs:945:5
note: Run with `RUST_BACKTRACE=1` for a backtrace.

warning: build failed, waiting for other jobs to finish...
error: build failed
```

I've tried to put all nix packages containing the word 'alsa' as build inputs but to no avail. Any ideas? My Cargo.toml (for the relevant parts) looks like this:
```
[dependencies]
amethyst = "0.7.0"
```

Linus

unread,
Jul 12, 2018, 12:30:19 PM7/12/18
to nix-...@googlegroups.com, il...@nym.hush.com
Hey,

Try adding nativeBuildInputs = [ pkgconfig ];. The only alsa one you should need is alsaLib AFAIK.

Hope this helps!
Linus
Reply all
Reply to author
Forward
0 new messages