My_first_app: hc generate zomes/my_zome - Rust not installed

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.

Okay @dhtnetwork, you mean the specs of my Windows machine on which I am running Virtualbox, right?

Here you are:


Hope this helps…

1 Like

@sachaweb disk resizing in the config is provided by a vagrant plugin

e.g.

vagrant plugin install vagrant-disksize

some things in vagrant require a full destroy/rebuild, some only require a reprovision

typically config for the box itself (e.g. swap) would require a rebuild while running things on the OS can be a reprovision - for our box we use nix to handle provisioning, but this general rule is the same if we were using e.g. chef, ansible, puppet, etc.

vagrant is slow relative to e.g. docker but it is free virtualisation that is supported everywhere VirtualBox is supported, if you can use something like WSL2 or docker you might get better performance

windows file system performance is a known issue in general, for example it takes 10+ minutes to install the rust documentation, ignoring all virtualisation considerations - https://github.com/rust-lang/rustup.rs/issues/998

WSL2 vs WSL1 is apparently a 2-20x speedup for file system performance - https://devblogs.microsoft.com/commandline/announcing-wsl-2/

one thing that we can try to do upstream would be to rebuild the vagrant box so that it comes with more things provisioned - this is a quality of life thing that should be done from time to time as things drift relative to the last time we built a box. this would only help if you’re seeing a lot of nix/rust things happening to cause the slowness

you’re welcome to use nix-env, the reasons we aren’t recommending it moving forward:

  • nix-env is a “once off” tool, as in, you need to keep re-upping it as we upgrade holonix, whereas nix-shell automatically scans your system and keeps you up to date as a moving target
  • nix-env installs holochain and hc just fine, but then some of the hc commands need a working cargo install, which means that to use those specific commands you need to be in nix-shell anyway
  • nix-env might be getting removed from future versions of nix, i have no info or eta on this deprecation, i’m going off something @Yana said here

@sachaweb when you see “disk space full” from inside the box, can you run df -h and send the output?

i’d like to see what exactly is full and how big the full thing is :slight_smile:

1 Like

Sorry for being slow to respond, other matters required my attention, I will most likely try out your suggestions tomorrow and send output to you here.