Skip to content

How to upgrade the Holochain version of a project with Nix

Guillem Córdoba edited this page Feb 22, 2022 · 8 revisions

Cachix

If you haven't yet, enable cachix with:

nix-env -iA cachix -f https://cachix.org/api/v1/install
cachix use holochain-ci

Read more about holochain and cachix here.

Upgrading to the latest holochain release

This guide will show you how to upgrade the holochain version to the latest released one.

  1. Starting from this default.nix file in the the root folder of your project:
let
  holonixRev = "f3ecb117bdd876b8dcb33ad04984c5da5b2d358c";

  holonixPath = builtins.fetchTarball "https://github.com/holochain/holonix/archive/${holonixRev}.tar.gz";
  holonix = import (holonixPath) {};
  nixpkgs = holonix.pkgs;
in nixpkgs.mkShell {
  inputsFrom = [ holonix.main ];
  packages = [
    # Additional packages go here
  ];
}

If you would like to use a specific pre-build holochain version, you can set a holochainVersionId here

# change this line to
  holonix = import (holonixPath) {} 
# this
  holonix = import (holonixPath) {
    holochainVersionId = "v0_0_115";
  } 

All available pre-built holochain version can be found here

  1. Get the newest holonix revision:
git ls-remote https://github.com/holochain/holonix main | grep -oE '[0-9a-z]{40}'

This will give some output like this:

401b69bdb120c5a4680b03eaa3f95b011e0c5cf1
  1. Replace the contents of the holonixRev variable with the output of the previous command.

  2. Re-run nix-shell again.

  3. Go into the Cargo.toml of your zomes and:

  • Upgrade the hdk version: see available versions here.

That's it! Try to compile your hApp and fix any breaking changes from the HDK in your code.