When I try to compile Bevy apps, like the breakout
example, no matter what setup I use, cargo emits errors like this:
error: proc-macro derive panicked
--> crates/bevy_scene/src/bundle.rs:19:10
|
19 | #[derive(Component, Deref, DerefMut)]
| ^^^^^^^^^
|
= help: message: Unable to read cargo manifest: /home/nilirad/devel/bevy/crates/bevy_scene/Cargo.toml
and this:
error: could not write output to /home/nilirad/devel/bevy/target/debug/deps/bevy_text-e06677f4f5a63e80.0rypmf54r8tq7fws97r2dg99x.rcgu.o: Too many open files
After running cargo run --example breakout
at least three times, the app finally gets compiled.
Given the nature of the error messages, I increased the maximum number of open files by putting the following to my configuration:
security.pam.loginLimits = [
{
domain = "*";
type = "soft";
item = "nofile";
value = "268435456";
}
{
domain = "*";
type = "hard";
item = "nofile";
value = "536870912";
}
];
However, this barely made a difference (I only had the feeling that I have to run cargo run
less times).
As mentioned in the beginning I’ve tried multiple methods, all with the same result.
The first method consisted in a devenv
shell with the following configuration:
# devenv.nix
{ pkgs, lib, config, inputs, ... }:
rec {
packages = with pkgs; [
pkg-config
udev
alsa-lib
vulkan-loader
xorg.libX11
xorg.libXcursor
xorg.libXi
xorg.libXrandr
libxkbcommon
wayland
];
env.LD_LIBRARY_PATH = lib.makeLibraryPath packages;
cachix.enable = false;
languages.rust = {
enable = true;
channel = "stable";
mold.enable = true;
};
}
The other method consisted in the shell.nix
setup example in the Bevy repository, with cargo
and rustc
packages included in the nativeBuildInputs
.
I’m using NixOS unstable, however the issue has always been present since I’ve installed NixOS many months ago.
At this point I don’t know how to solve this issue. So far, it only presents with Bevy and Bevy-based projects, not with other Rust projects. Given the fact that nobody else seems to have the same issue is probably due to my configuration, but I don’t know what precisely.