From 4277aa0db68c2288bb4beba2c2fa0dfcfa23c36c Mon Sep 17 00:00:00 2001 From: Florian Klink Date: Tue, 30 Jul 2024 16:16:59 +0300 Subject: [PATCH] docs(tvix/boot): update README more The environment variables caused both nar-bridge and tvix-store daemon to try to connect to the same store, which fails due to locking issues. Pass the config to `tvix-store daemon` directly. Also, add the `--otlp=false` to the instructions to remove spam, most users don't have a OTLP collector running. Explain when to use gRPC in `tvix-store virtiofs` and when not. Also, point out to be able to boot a NixOS closure, it needs to be copied into the store first. Change-Id: If4eda07bba28ad0bbe70e468cb727441a21b0588 Reviewed-on: https://cl.tvl.fyi/c/depot/+/12067 Autosubmit: flokli Tested-by: BuildkiteCI Reviewed-by: Ilan Joselevich --- tvix/boot/README.md | 43 ++++++++++++++++++++++++++++++------------- 1 file changed, 30 insertions(+), 13 deletions(-) diff --git a/tvix/boot/README.md b/tvix/boot/README.md index 5d5ab41e7..b183285b2 100644 --- a/tvix/boot/README.md +++ b/tvix/boot/README.md @@ -31,23 +31,37 @@ the `tvix` directory: export PATH=$PATH:$PWD/target/release-with-debug ``` -Secondly, configure tvix to use the local backend: +Now, spin up tvix-daemon, connecting to some (local) backends: ``` +tvix-store --otlp=false daemon \ + --blob-service-addr=objectstore+file://$PWD/blobs \ + --directory-service-addr=sled://$PWD/directories.sled \ + --path-info-service-addr=sled://$PWD/pathinfo.sled & +``` + +Copy some data into tvix-store (we use `nar-bridge` for this for now): + +``` +mg run //tvix:nar-bridge -- --otlp=false & +rm -Rf ~/.cache/nix; nix copy --to http://localhost:9000\?compression\=none $(mg build //third_party/nixpkgs:hello) +pkill nar-bridge +``` + +By default, the `tvix-store virtiofs` command used in the `runVM` script +connects to a running `tvix-store daemon` via gRPC - in which case you want to +keep `tvix-store daemon` running. + +In case you want to have `tvix-store virtiofs` open the stores directly, kill +`tvix-store daemon` too, and export the addresses from above: + +``` +pkill tvix-store export BLOB_SERVICE_ADDR=objectstore+file://$PWD/blobs export DIRECTORY_SERVICE_ADDR=sled://$PWD/directories.sled export PATH_INFO_SERVICE_ADDR=sled://$PWD/pathinfo.sled ``` -Potentially copy some data into tvix-store (via nar-bridge): - -``` -mg run //tvix:store -- daemon & -mg run //tvix:nar-bridge -- & -rm -Rf ~/.cache/nix; nix copy --to http://localhost:9000\?compression\=none $(mg build //third_party/nixpkgs:hello) -pkill nar-bridge; pkill tvix-store -``` - #### Interactive shell Run the VM like this: @@ -100,9 +114,12 @@ Hello, world! [ 0.299422] reboot: Power down ``` -#### Execute a NixOS system closure -It's also possible to invoke a system closure. To do this, tvix-init honors the -init= cmdline option, and will switch_root to it. +#### Boot a NixOS system closure +It's also possible to boot a system closure. To do this, tvix-init honors the +init= cmdline option, and will `switch_root` to it. + +Make sure to first copy that system closure into tvix-store, +using a similar `nix copy` comamnd as above. ```