Skip to content
/ ic-nix Public

Build Internet Computer projects with Nix

License

Notifications You must be signed in to change notification settings

ninegua/ic-nix

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

159 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Internet Computer Projects with Nix

ci release

Unofficial build of common toolkits used by developers of the Internet Computer (IC) blockchain.

  • Directly built from source.
  • Cross-platform (Linux and Mac OS X, x86_64 and aarch64).
  • Mostly statically linked with no extra runtime dependency other than libc.
  • Regular build of latest versions of everything.
  • Battery-loaded SDK environment for IC via nix-shell.

Usage

If you just need the latest binary pre-built for your platforms, go to release page.

If you are a Nix user, you can start a canister development environment with a single nix-shell command. This will give you immediate access to commands like dfx, moc, didc, ic-repl, and many many others.

nix-shell https://github.com/ninegua/ic-nix/releases/latest/download/dfx-env.tar.gz

Additionally if you are interested in developing individual projects included here, you can

  • build a project by nix-build -A <project>, or
  • enter a project's development environment by nix-shell -A <project>.shell.

If you are not a Nix user, all you need is a working nix installation on your computer to get started.

Compile from source

For those who prefer to compile from source:

nix-shell --arg force true https://github.com/ninegua/ic-nix/releases/latest/download/dfx-env.tar.gz

Pre-compiled Nix derivations are also available if you use Nix binary cache (courtesy of cachix) nix-shell -p cachix --run 'cachix use ninegua'.

VSCode/direnv

Assuming you're developing on ic.

  1. Make sure you have direnv installed.
  2. Clone this repo next to ic.
  3. Under ic/rs: run echo "use nix ../../ic-nix/default.nix -A ic.shell" > .envrc.
  4. In the same directory, run direnv allow .

If using VSCode, you should also install the direnv vscode extension, to make sure that rust-analyzer will be using the same versions of Rust as your shell.

WARNING

Releases are built against the latest main branches of each project at the time. They may not always work. Please understand the risks before proceed.

Supported projects

Supported platforms and nixpkgs:

24.11 25.05
darwin x86_64
linux x86_64 ✅︎ ✅︎
darwin aarch64 ✅︎ ✅︎

Only the outdated nixpkgs 23.05 supports darwin x86_64, and it does not provide the required empscripten version to compile motoko.

Feature:

  • Build native binaries with nix-build with glibc.
  • Dynamic binaries with minimal dependencies: glibc on Linux, system libs on OS X.
  • Build Wasm binaries with nix-build.
  • Develop with nix-shell.
  • Build release binaries on Github.
  • Build and run all tests.

Note that this effort requires no nix support of a project unless it already has.

About

Build Internet Computer projects with Nix

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •