Skip to content

Latest commit

 

History

History
44 lines (32 loc) · 1.53 KB

rust-library.md

File metadata and controls

44 lines (32 loc) · 1.53 KB

As a Rust library

Warning

Using Determinate Nix Installer as a Rust library is still experimental. This feature is likely to be removed in the future without an advocate. If you're using this, please let us know and we can provide a path to stabilization.

Add the nix-installer library to your dependencies:

cargo add nix-installer

If you're building a CLI, check out the cli feature flag for clap integration.

You'll also need to edit your .cargo/config.toml to use tokio_unstable as we utilize Tokio's process groups, which wrap stable std APIs, but are unstable due to it requiring an MSRV bump:

# .cargo/config.toml
[build]
rustflags=["--cfg", "tokio_unstable"]

You'll also need to set the NIX_INSTALLER_TARBALL_PATH environment variable to point to a target-appropriate Nix installation tarball, like nix-2.21.2-aarch64-darwin.tar.xz. The contents are embedded in the resulting binary instead of downloaded at installation time.

Then it's possible to review the documentation:

cargo doc --open -p nix-installer

Documentation is also available via nix build:

nix build github:DeterminateSystems/nix-installer#nix-installer.doc
firefox result-doc/nix-installer/index.html