Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 22 additions & 22 deletions src/autodiff/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,30 +18,30 @@ Please run:
rustup +nightly component add enzyme
```

## Installation guide for Nix user.
## Installation guide for Nix

On [Nix](https://nixos.org/), you can declare a nightly Rust toolchain with the Enzyme component using the [oxalica rust-overlay](https://github.com/oxalica/rust-overlay).

For example:

```nix
rust-bin.selectLatestNightlyWith (toolchain: toolchain.default.override {
extensions = [ "enzyme" ];
})
```

Alternativley, you can create a [toolchain file](https://rust-lang.github.io/rustup/overrides.html#the-toolchain-file) that declares the Enzyme component such as

```toml
[toolchain]
channel = "nightly-2026-06-23"
components = [ "enzyme" ]
```

and consume it in the overlay

This setup was recommended by a nix and autodiff user.
It uses [`Overlay`].
Please verify for yourself if you are comfortable using that repository.
In that case you might use the following nix configuration to get a rustc that supports `std::autodiff`.
```nix
{
enzymeLib = pkgs.fetchzip {
url = "https://ci-artifacts.rust-lang.org/rustc-builds/ec818fda361ca216eb186f5cf45131bd9c776bb4/enzyme-nightly-x86_64-unknown-linux-gnu.tar.xz";
sha256 = "sha256-Rnrop44vzS+qmYNaRoMNNMFyAc3YsMnwdNGYMXpZ5VY=";
};

rustToolchain = pkgs.symlinkJoin {
name = "rust-with-enzyme";
paths = [pkgs.rust-bin.nightly.latest.default];
nativeBuildInputs = [pkgs.makeWrapper];
postBuild = ''
libdir=$out/lib/rustlib/x86_64-unknown-linux-gnu/lib
cp ${enzymeLib}/enzyme-preview/lib/rustlib/x86_64-unknown-linux-gnu/lib/libEnzyme-22.so $libdir/
wrapProgram $out/bin/rustc --add-flags "--sysroot $out"
'';
};
}
rust-bin.fromRustupToolchainFile ./rust-toolchain.toml
```

## Build instructions
Expand Down
Loading