Holochain
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Owners
        • Signed-in users
        • Everyone
        Owners Signed-in users Everyone
      • Write
        • Owners
        • Signed-in users
        • Everyone
        Owners Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights
    • Engagement control
    • Transfer ownership
    • Delete this note
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Versions and GitHub Sync Note Insights Sharing URL Help
Menu
Options
Engagement control Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Owners
  • Owners
  • Signed-in users
  • Everyone
Owners Signed-in users Everyone
Write
Owners
  • Owners
  • Signed-in users
  • Everyone
Owners Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       owned this note    owned this note      
    Published Linked with GitHub
    Subscribed
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    Subscribe
    # Updating your Holochain dev environment for the new Holonix ###### tags: `Holonix` ## Context For the Beta 0.1 release we targeted adding full support for MacOS (x86_64 and aarch64) and Windows (WSL2) to our development environment, such that our CI setup could automatically build binaries of the development environment components (like `holochain`, `lair-keystore`, `hc`, etc) on all platforms. Additionally we wanted to improve the mechanism by which developers can specify exactly which versions of which components they want to be automatically loaded into their nix shell. We determined that achieving these goals would be greatly eased by switching to [Nix Flakes](https://nixos.wiki/wiki/Flakes). So, `holonix` has been re-written and we're happy to say that we've been able to reach these goals. ## What this means Assuming you have been using holonix (and a `default.nix`) file along with `nix-shell` to load all your development dependencies, this means that: 1. to gain access to any future updates, you will have to start using a `flake.nix` file instead of `default.nix`. 2. to update holonix you will run `nix flake update` instead of `nix-shell --run "niv update"` 3. to open the holonix shell you will run `nix develop` instead of `nix-shell` 4. (in case you want to run an ad-hoc dev shell, type `nix develop github:holochain/holochain#holonix` instead of `nix-shell https://holochain.love`) ## How to switch If you're running a single-user install of Nix, you will have to reinstall. Refer to these resources on how to uninstall - https://nixos.org/manual/nix/stable/installation/installing-binary.html?highlight=uninstal#uninstalling. - https://gist.github.com/chriselsner/3ebe962a4c4bd1f14d39897fc5619732#uninstalling-nix Please follow the instructions here: https://developer.holochain.org/quick-start/ in the section marked: *Install the Nix Package Manager*. > NOTE: those instructions now install nix in the multi-user context. As you have probably previously installed nix in the single user context, you may have to manually remove nix file. When you re-run the Nix installer, it will give you instructions on how to do this. However, you may have to manually remove any `substituters` that were added to your `~/.config/nix/nix.conf` file from previous installs. In your hApp directory remove the old nix files with: ```bash $ git rm -r nix $ git rm default.nix ``` Enable Nix commands and Nix flakes for your use: ```bash mkdir -p ~/.config/nix echo "experimental-features = nix-command flakes" >> ~/.config/nix/nix.conf ``` Create a new `flake.nix` file at the root level of your hApp directory containing: ```nix= { description = "Flake for Holochain app development"; inputs = { nixpkgs.follows = "holochain-dev/nixpkgs"; holochain-dev = { url = "github:holochain/holochain"; inputs.versions.url = "github:holochain/holochain/?dir=versions/0_1"; }; }; outputs = inputs @ { ... }: inputs.holochain-dev.inputs.flake-parts.lib.mkFlake { inherit inputs; } { systems = builtins.attrNames inputs.holochain-dev.devShells; perSystem = { config , pkgs , system , ... }: { devShells.default = pkgs.mkShell { inputsFrom = [ inputs.holochain-dev.devShells.${system}.holonix ]; packages = [ pkgs.nodejs-18_x ]; }; }; }; } ``` Now add the flake file to git with: ```bash $ git add flake.nix ``` Then you can initialize the `flake.lock` file for the first time with: ``` $ nix flake update ``` This command looks up the revisions of the components and locks them in the `flake.lock` file. Note: When you run `nix flake update` again, the latest available revisions of all inputs will be looked up again and the lock-file will be updated. The `flake.nix` above is set up so that this kind of update will only update to the latest components that are compatible with Holochain 0.1. Now add the `flake.lock` file to git with: ```bash $ git add flake.lock ``` Now you can enter the nix shell with: ```bash $ nix develop ``` You should then see something like this: ```shell Holochain development shell spawned. Type exit to leave. [holonix:~/path/to/my/happ]$ ``` ## How to pick specific component versions Edit your flake file to override the inputs like this for example, which picks a different version of the `holochain` component, which includes the conductor and the `hc` CLI tool: ```nix inputs = { ... holochain-dev = { url = "github:holochain/holochain"; inputs.versions.url = "github:holochain/holochain?dir=versions/0_1"; inputs.versions.inputs.holochain.url = "github:holochain/holochain/<whichever-git-branch-tag-or-commit>"; }; ... ``` You can override the versions of four different Holochain components: `holochain`, `lair`, `launcher`, and `scaffolding`. The `inputs.versions.url` field points to a file in the `holochain/holochain` GitHub repo containing versions of each of these which are known to be mutually compatible. As you can see in the snippet above, the URLs of any of those components can be overridden. Take a look at the [versions flake](https://github.com/holochain/holochain/blob/develop/versions/0_1/flake.nix) for an example of how we specify their URLs using Git tags. <!-- The input names of all the currently included components can be found with this command: $ nix flake metadata github:holochain/holochain --json | jq --raw-output '.locks.nodes.versions.inputs | .[]' holochain lair launcher scaffolding --> Note that by specifying custom component URLs, you will probably get a binary cache miss when entering the shell, and it will have to compile the custom component versions ad-hoc. ## What's different in the new shell The new holonix has removed all the old `hn-X` commands, specifically the one most folks used is the `hn-versions` command. Instead that has been replaced with `hn-introspect`: ```text [holonix:~/myapp]$ hn-introspect holochain (holochain 0.1.3): ed5b7bb461c2a8bfd4d2633bad604a20b8f2da03 lair-keystore (lair_keystore 0.2.3): cbfbefefe43073904a914c8181a450209a74167b hc-launch (holochain_cli_launch 0.0.10): b3a14c79198ef0b52f55a0e646a371fcb49f53e4 hc-scaffold (holochain_scaffolding_cli 0.1.6): 519e23c31f094fb49d12d24094a6a5b688a8ff86 ```

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully