Another 'Hello Holo' help thread

image
Hello,
This seems super basic, but I cannot open the lib.rs file. The tutorial simply states " Let’s have a look at the generated code—–open up the lib.rs file in an editor." so if there is anything beyond trying to open it as you normally would open a file in Terminal, I’m not sure what I’m missing. I even installed Rust to ensure the .rs filetype was assigned to an editor, but that didn’t seem to help.
Is there something incredibly obvious that I’m missing?

1 Like

Hi @kalrah! What editor are you using? I’ve seen people using Visual Studio Code or Atom, or you can even look at the file with Notepad, and from there you can open the folder containing the Cargo.toml file and access the lib.rs file.

I don’t use Windows myself, so it’s a little difficult for me to help more than this, specially because the nix-shell environment may actually be messing up Window’s associations between file types and extensions.

1 Like

Hello @guillemcordoba, thanks for the quick reply - I’ve tried VSCode, Terminal and Powershell, so it may indeed be Windows messing things up. Nothing appears in my folder to open through the GUI either, asides the initial vagrant files.

Ah yes, I see. What I think is happening here is that Vagrant sets up a kind of virtual machine, that cannot be accessed in the normal file browsing way I think. I don’t know how to browse files or open an editor from that environment… Have you tried nano or vi?

Anyway, windows setup has always been clunky, if you can I’d recommend installing a linux OS or maybe using a virtual machine (for example, holoscape does not work on windows, and you may find other obstacles along the way).

Ah that makes sense thanks, I’m going to grab a linux OS - is there a recommend distro for holo-stuff?

Not so much, I’ve never heard anyone with problems on ubuntu or debian, but some on Arch for example.

Awesome, thanks for your assistance! I’m sure I’m going to have many more questions soon

1 Like

If you are using Vagrant, then you already got a NixOS installation that is running within a VM. I don’t think you need to get another Linux. With regards to editing your file, I would suggest that you use Visual Studio Code Remote extension and connect to the VM using SSH. That would allow you to view/edit the source code and also open a terminal straight from VSC.

Thanks for the reply! It must be something I’m doing wrong because I tried to do it again on a fresh linux install on a brand new SSD (and totally separate device) and I’m getting the same error when trying to open lib.rs (bash: lib.rs : command not found). Even tried your Visual Studio Code remote extension suggestion and I’m met with this error everytime image

In your case (using Vagrant) it is not the WSL but the SSH extension, because you need to connect to the Linux VM.

Assuming that I’m sticking with Linux now, can you think of any reason that lib.rs wouldn’t open there, on a fresh install?

On Ubuntu I tried using sudoedit on lib.rs and got back ‘editing files in a writable directory is not permitted’, if that’s of any use

Giving a step back and checking all the thread again, it seems that lib.rs was not generated by hc generate zomes/hello rust-proc. If so, it means that you didn’t progress in the tutorial yet. Please remove cc_tuts and start the tutorial again. Later, when you run hc init and hc generate take screenshots of their outputs, so we can see what messages are displayed and if any error occurred at that moment. Cheers.

I removed cc_tuts and did the tutorial again with the same result (I’ve attached screenshots for reference). Though, If I go to https://github.com/holochain/rust-proc-zome-template/archive/master.tar.gz and download the file directly, sure enough the lib.rs file is there and I can open it in my text editor


Ok. So lib.rs is there. It is not an executable. It is a rust source file that you will have to edit during the tutorial. Later, after doing the changes required, you will have to hc package which will, among other steps, run cargo to compile such code into a wasm module that the conductor (hc) will execute. hc package must be called from the project root directory.

With regards to editing lib.rs that is located within the NixOS VM provided by Vagrant, you can use vi from the terminal, in case you are comfortable with it; or, you can use Visual Studio Code from Windows, together with the Remote - SSH extension to connect to the NixOS VM and edit the file. Also, you can install Rust-related extensions like RLS or rust-analyzer, among others just to improve the development experience (optional).

Hi,
Do you know what is the equivalent to hc init?

[nix-shell:/mnt/c/Users/prodrigu]$ hc init cc_tuts
error: The subcommand 'init' wasn't recognized

USAGE:
        hc help <subcommands>...

For more information try --help

``