Getting too many files error when installing Holochain Dev Tools

building ‘/nix/store/851zd9c9h6xc2n5jl7lfv9dncylphhw2-hc-happ-add-zome.drv’…
error: opening directory ‘/nix/store/q46wma6hwg6dz6r35dksrqzin0b6f4ba-crate-indexmap-1.7.0.tar.gz’: Too many open files

hey @jaclynchorton64

i’ve got a few questions on the context for this error message.

which command did you use that lead to this error?
what architecture does your system have?

also, did you set up cachix before running the nix-shell? if not, this command should do the trick: nix run -f cachix -c cachix use holochain-ci

If you got a Mac Book with a M1 Chipset this may be helpful → Setup on macbook with m1 chip - #5 by lucksus

i’d like to take the relevant parts of @lucksus’ messages to this thread as well.

This is what @kaichao suggested and made it work for me:

sudo launchctl limit maxfiles 1024 unlimited
sudo launchctl stop org.nixos.nix-daemon

if i understand this correctly the first command sets the maxfiles hardlimit systemwide to unlimited, which i found to mean 10240. IMO this poses a security risk.
the second command stops the nix-daemon. i assume this causes the nix-daemon to be started again on demand on the next invocation of any nix program. i assume the nix-daemon now adopts the new system’s limits.

IMO the first command isn’t ideal and would ideally replaced by a command that removes this limitation for the nix-daemon service only, as opposed to the whole system. i don’t know how to do this and maybe someone more familiar with macOS does. until then, i will try to find out and will inform this thread if i find something :slight_smile:

this has been resolved upstream just a few days ago:

the commit hasn’t made it into any release as of now. it should be possible to make these changes to the service file directly. i don’t have nix-daemon running on my macOS VM, but it should be possible to identify the file in question with this command

sudo find / -name org.nixos.nix-daemon.plist

and then add the changes given in the commit and restart the service with the command @lucksus gave above.

that’s all i have for now :bowing_man:

It ceratainly appears as though Nix has removed “-c” from “nix run” and thus I’m blocked while trying to install the dev tools. Do you happen to know the purpose of the “-c” flag before it was removed? I cannot find a reference to it in the Nix docs.

@saiChi1A yes i realize there are compatibility issues around nix run. a more compatible version of the command is this:

nix-shell -I nixpkgs= -p cachix --run “cachix use holochain-ci”

1 Like

That worked. Thanks for the assist.

1 Like