Nix is a package manager and build tool. It is used in cardano-wallet for:

Nix is not required for cardano-wallet development, but it can help you a lot if you try it.

Installing/Upgrading Nix

The minimum required version of Nix is 2.5.

Binary cache

To improve build speed, it is highly recommended (but not mandatory) to configure the binary cache maintained by IOG.

See iohk-nix/docs/ or cardano-node/doc/getting-started/ for instructions on how to configure the IOG binary cache on your system.

Building with Nix

See the Building page.

Reproducible Development Environment

Run nix develop to get a build environment which includes all necessary compilers, libraries, and development tools.

This uses the devShell attribute of flake.nix.

Full instructions are on the Building page.

Development tips

Code generation

The Nix build depends on code which is generated from the Cabal files. If you change these files, then you will probably need to update the generated files.

To do this, run:


Then add and commit the files that it creates.

Alternatively, wait for Buildkite to run this same command. It will produce a patch, and also push a commit with updates back to your branch.

Haskell.nix pin

The Nix build also depends on the Haskell.nix build infrastructure. It may be necessary to update haskell.nix when moving to a new Haskell LTS version or adding Hackage dependencies.

To update to the latest version, run the following command:

$ nix flake lock --update-input haskellNix
warning: updating lock file '/home/rodney/iohk/cw/flake/flake.lock':
• Updated input 'haskellNix':
    'github:input-output-hk/haskell.nix/f05b4ce7337cfa833a377a4f7a889cdbc6581103' (2022-01-11)
  → 'github:input-output-hk/haskell.nix/a3c9d33f301715b162b12afe926b4968f2fe573d' (2022-01-17)
• Updated input 'haskellNix/hackage':
    'github:input-output-hk/hackage.nix/d3e03042af2d0c71773965051d29b1e50fbb128e' (2022-01-11)
  → 'github:input-output-hk/hackage.nix/3e64c7f692490cb403a258209e90fd589f2434a0' (2022-01-17)
• Updated input 'haskellNix/stackage':
    'github:input-output-hk/stackage.nix/308844000fafade0754e8c6641d0277768050413' (2022-01-11)
  → 'github:input-output-hk/stackage.nix/3c20ae33c6e59db9ba49b918d69caefb0187a2c5' (2022-01-15)
warning: Git tree '/home/rodney/iohk/cw/flake' is dirty

Then commit the updated flake.lock file.

When updating Haskell.nix, consult the ChangeLog file. There may have been API changes which need corresponding updates in cardano-wallet.

iohk-nix pin

The procedure for updating the iohk-nix library of common code is much the same as for Haskell.nix. Run this command and commit the updated flake.lock file:

$ nix flake lock --update-input iohkNix

It is not often necessary to update iohk-nix. Before updating, ask devops whether there may be changes which affect our build.

Common problems

Warning: dumping very large path

warning: dumping very large path (> 256 MiB); this may run out of memory

Make sure you don’t have large files or directories in your git worktree.

When building, Nix will copy the project sources into /nix/store. Generated folders such as dist-newstyle will be filtered out, but everything else will be copied.

Links to this page
  • Updating Dependencies

    If you use Nix to manage build and runtime dependencies you can be confident that you will always have the correct versions for the branch you are on, and that these will be exactly the same as those versions used in CI.

  • Developer Information
  • Building

    Follow the instructions on the Nix page to install and configure Nix.

    Use the Nix build if: