Getting too many files error when installing Holochain Dev Tools

/nix/store/crrnn5lz6vxzr0w20qqq2bxj92i4mf5m-hn-rust-fmt.drv
/nix/store/czwhi2sg9kmdfz06c9hkpp5j6s809r8l-hn-release-github.drv
/nix/store/f4d9hnac0b7ka3kp4vrw2b6hrccwv2mw-hn-rust-fmt-check.drv
/nix/store/g53hw496i1im665avry6v5bxvll4iyj5-hn-release-cut.drv
/nix/store/g63b1gbbnjd20nzaa6l5g0cw1v8prcwa-hn-node-flush.drv
/nix/store/hncnld8361lqxljnhkwvqsbh9rm8b6qh-hn-release-github-notes.drv
/nix/store/iw7z38xvk2sssdi0fb2ajzbpnzfsyg90-hn-release-hook-version-readme.drv
/nix/store/j254jkvpzxq3cak4ax4qzj9cwikaar8b-hc-happ-scaffold.drv
/nix/store/j7i0zr4r23yq47z55nzpc3i6v7p5nm84-hn-rust-manifest-install.drv
/nix/store/kbbfw44b7rxjxsyyq5hrxpf03g2m5g30-hn-rust-flush.drv
/nix/store/m4alyklmw4wvlvbdxmyhr0bdqqk70yk2-hn-rust-manifest-list-unpinned.drv
/nix/store/q0964ci8s4kgq69k69kfp2ff0yhpnz93-hn-release-hook-publish-crates-io.drv
/nix/store/vp27bbsksg6281mc747nlgx6jxz7z857-hc-happ-create.drv
/nix/store/wn1mnbz2zjbb7q9ljfjal69ir8arsrfc-hn-flush.drv
/nix/store/x5w5gkngdnzcmnapl9525nz9njzsy1ca-hn-release-hook-version-rust.drv
/nix/store/xzqxr026rqhmdrmb3w67dmykgp9v99m8-hn-introspect.drv
/nix/store/yb21535nrzak71y4j5n3zzx5wnd8qrh6-hn-docs.drv
/nix/store/yb2i006xz5qi41k20hywdf32ihn7881h-github.com_holochain_holochain-6d853bed86f59fa8a0a716d81c07e089b0d42f16.drv
/nix/store/yh21cmgaf0bkzp9lbvvfp49qm1qybvl0-hn-release-hook-preflight-manual.drv
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 https://cachix.org/api/v1/install 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=https://github.com/NixOS/nixpkgs/archive/nixos-21.11.tar.gz -p cachix --run “cachix use holochain-ci”

1 Like

That worked. Thanks for the assist.

1 Like