My_first_app: hc generate zomes/my_zome - Rust not installed

Hi. When trying to generate a zome, I get a message saying I should install Rust. I copied the Linux command from https://rustup.rs/ and got an error message. See below. (The instructions with “nix-env…” were saying that that would install Rust…)

[vagrant@nixos:/vagrant/my_first_app]$ hc generate zomes/my_zome
This command requires the cargo command, which is part of the Rust toolchain.
Generating a Rust based Zome depends on having Rust installed.
As a first step, get Rust installed by using rustup https://rustup.rs/.
Holochain requires you use the nightly-2019-07-14 toolchain.
With Rust already installed switch to it by running the following commands:
$ rustup toolchain install nightly-2019-07-14
$ rustup default nightly-2019-07-14
Having taken those steps, retry this command.

[vagrant@nixos:/vagrant/my_first_app]$ curl --proto ‘=https’ --tlsv1.2 -sSf https://sh.rustup.rs | sh
info: downloading installer
main: line 356: /tmp/tmp.IeYyA2X6kE/rustup-init: No such file or directory

(This is from Windows Powershell.)

Just in case this would help to answer my question, I found this online for a similar error message (from Jan 2017):

NixOS has libraries in non-standard places; rustup-init executable has to be patched or recompiled on this system… Other solution I see is to precompile it with every release. How to patch: http://unix.stackexchange.com/a/252232

(It looks like my previous message was marked as being the solution but it’s not. I unmarked it.)

Under “Build your first DNA”, there is this:
If you are using nix-shell, enter it before continuing.

What does it mean to enter nix-shell? If I type “nix-shell”, that results in an error (“no such file…”). Or am I in nix-shell no matter what, after I SSH into the VM?

Hey @sachaweb you will need to enter the shell like this:

nix-shell https://holochain.love

That will give you access to all the required rust and other dependencies. You should not need to use rustup.

@sachaweb those instructions from inside hc are wrong :frowning:

they are just very old

when you are inside a nix shell the right version of rust will be there, but of course this is what the nix env approach is trying to avoid

yegor was saying there’s a way to wrap hc in a mini shell of its own provided by nix env that would magically fix this, i’m putting an issue in holonix to chase that up :slight_smile:

issue in holonix here https://github.com/holochain/holonix/issues/55

@Yana ^^

Hi @freesig. When entering “nix-shell https://holochain.love” I get the same disk space error I mentioned in the other thread (“nix-shell holochain.love”).

There, you recommended I change the Vagrant file, with a link to some instructions. So now I added this bit to the end of my Vagrantfile:

Vagrant.configure(“2”) do |config|
config.vm.box = “debian/stretch64”
config.disksize.size = “20GB”
end

Then I exited SSH and Vagrant, not being sure how to make sure the new Vagrantfile is executed. However, I still got the same disk space error (my HD has plenty of space of course).

Last lines of the output:

tar: Exiting with failure status due to previous errors
do not know how to unpack source archive /nix/store/qf8ks81hjncyrycsqjj3vqlhjb8pp19z-rust-nightly-x86_64-unknown-linux-gnu.tar.xz
builder for ‘/nix/store/j8j2vnskqhd8x8sc46qnl8x1bqdk7nwd-rust.drv’ failed with exit code 1
note: build failure may have been caused by lack of free disk space
cannot build derivation ‘/nix/store/sqll2fajnq18cjxcjnxf1bgyrjlspn4i-rust-1.38.0-nightly-2019-07-13-69656fa4c.drv’: 1 dependencies couldn’t be built
error: build of ‘/nix/store/sqll2fajnq18cjxcjnxf1bgyrjlspn4i-rust-1.38.0-nightly-2019-07-13-69656fa4c.drv’ failed

[vagrant@nixos:/vagrant]$

Okay thanks for making that clear @thedavidmeister. Meanwhile I also posted another message in this thread, with more perplexities…

@sachaweb this issue is related to Holonix. For better visibility, you okay if I move this thread over to the Holonix area?

Hi David (or anyone), could you please elaborate how to do the “black magic” trick with the micro-shell (or any other workaround)?

I’ll be preparing some people for the Prague hackathon tomorrow so it’s critical for me to make the environment work.
(I’m using the Vagrant/NixOS on Windows10.)

Thanks!

@Qubeo the workaround right now is to just be in the nix shell so cargo is available, no magic needed

the issue i linked has more details for making cargo available to hc outside the nix shell

Yeh I recommend just using nix-shell and avoiding nix-env. I think we are going to remove nix-env from the quick start as it’s causing some confusion.

Also @sachaweb In that Vagrant file there is a 16gig swap so I think you might actually need more then 20gig or lower the swap size.
So either try lowering this line:

swapDevices: [ { device: "/swapfile", size: 16384 } ],

or in this section change it from:

config.vm.provider "virtualbox" do |vb|
  #   # Display the VirtualBox GUI when booting the machine
    vb.gui = false
    # Customize the amount of memory on the VM:
    vb.memory = "4096"
    vb.cpus = "4"
    vb.customize ["modifyvm", :id, "--hwvirtex", "off"]
  end

to

config.vm.provider "virtualbox" do |vb|
  #   # Display the VirtualBox GUI when booting the machine
    vb.gui = false
    # Customize the amount of memory on the VM:
    vb.memory = "4096"
    vb.cpus = "4"
    vb.customize ["modifyvm", :id, "--hwvirtex", "off"]
    vb.disksize.size = '40GB'
  end

That should hopefully allow you to gain enough space to use nix-shell.

1 Like

@freesig @sachaweb from memory, messing with the disk size and/or swap may need a full vagrant rebuild

vagrant destroy
vagrant up

smaller config changes only need a reprovision

vagrant provision

both are much faster than the initial box download as it can use the box cached locally as a starting point

the only reason for the large swap was that several months ago we had a test runner that would not kill already-run tests, so we bumped the memory right up as a workaround - if the runner is cleaning up now we can bring it down quite a lot, or if you’re not planning to do the “everything in one” test suite you’re also fine - @maackle and @lucksus know more about the current state of this i’d say

1 Like

Sure @dhtnetwork, it can be moved to Holonix but then perhaps there should be some mention of that here because people installing Holochain might be looking mainly at the threads under ‘getting started’.

I might just keep it here. Perhaps we can simply have a reference to it from the Holonix area. Thank you.

1 Like

Thank you @dhtnetwork and @thedavidmeister for your swift replies.

I first tried adding the diskspace line in the vagrantfile, as shown by @dhtnetwork above. That resulted in an error already when doing vagrant destroy (@thedavidmeister). Error message:

VirtualBox Provider:

  • The following settings shouldn’t exist: disksize

So I removed the diskspace line and just changed the swap file size from 16384 to 8192 (@dhtnetwork) .

Then vagrant destroy, and building everything from the ground up. (That took some time! Is it not enough to do vagrant provision or halt in order to apply the changes in the vagrantfile?)

Unfortunately, when nix-shell https://holochain.love completed, it still had the same disk space error.

I could reduce the swap file’s size even more (to how much?) but I am not sure if that would cut it…

By the way I still used nix-env even though @dhtnetwork recommended it be removed from the quick start.

Hey @sachaweb could you share any system spec? Screenshot would be helpful.

At the root, I believe there are way too many files. I believe there are 1.5 M files? @thedavidmeister is it possible to pair down the file size?

I understand this challenge as I have a Mac and a Windows. At times, it could be long/drawn out process on a Windows platform. But we have to provide a better solution for Windows users.