Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Installing with Nix

Install Nix and enable the nix-command and flakes experimental features. The flake supports x86-64 Linux, ARM64 Linux, and Apple Silicon macOS. On Windows, use Nix inside WSL2 to run the Linux package. See Nix setup for enabling flakes and platform prerequisites. The first install needs network access and may compile dependencies. Install the standard package from any directory with:

nix profile install github:mveril/RustiQ
rustiq --version

Home Manager without a configuration flake

If your Home Manager configuration uses home.nix directly, create a rustiq.nix file beside it:

{ pkgs, ... }:
let
  rustiq = builtins.getFlake "github:mveril/RustiQ";
in
{
  home.packages = [
    (rustiq.legacyPackages.${pkgs.stdenv.hostPlatform.system}.cpuTarget "native")
  ];
}

Add the module to the imports in home.nix, keeping any existing imports:

imports = [ ./rustiq.nix ];

Apply the configuration using your usual command. For Home Manager integrated as a NixOS module, run sudo nixos-rebuild switch --impure; for standalone Home Manager, run home-manager switch --impure. The unlocked GitHub reference requires impure evaluation. Check rustiq --version afterward. The reference tracks the default branch and is not pinned by a configuration flake.lock; use a revision in the URL for a fixed version. See the CPU-specific build caveats before using native. To use the standard package, replace the entry in home.packages with rustiq.packages.${pkgs.stdenv.hostPlatform.system}.default.

Home Manager and NixOS

The following snippets extend an existing flake-based configuration. Add RustiQ as an input to your configuration’s flake.nix:

inputs.rustiq.url = "github:mveril/RustiQ";

The configuration’s flake.lock pins that input. To update it later, run nix flake update rustiq in the configuration directory, then apply the configuration again. Keep your existing inputs, modules, and state version. If the configuration is a Git flake, add any newly created module files to Git before applying it so that Nix can see them.

Home Manager

In the existing outputs function, bind the inputs as inputs@{ ... }, and pass them to your existing home-manager.lib.homeManagerConfiguration:

extraSpecialArgs = { inherit inputs; };

Merge this with any existing extraSpecialArgs. In your home.nix, add inputs to the module arguments and add RustiQ to home.packages:

{ pkgs, inputs, ... }:
{
  home.packages = [
    inputs.rustiq.packages.${pkgs.stdenv.hostPlatform.system}.default
  ];
}

Merge the list with your existing packages. From your configuration directory, apply it with home-manager switch --flake .#YOUR_USER and check rustiq --version. Replace YOUR_USER with your Home Manager configuration name. See the Home Manager flake guide. For Home Manager as a NixOS module, pass the inputs through home-manager.extraSpecialArgs instead.

NixOS configuration.nix

In the existing outputs function, bind the inputs as inputs@{ ... }, and pass them to your existing nixpkgs.lib.nixosSystem:

specialArgs = { inherit inputs; };

Merge this with any existing specialArgs. Create rustiq.nix beside your configuration.nix. This complete NixOS module installs a RustiQ build optimized for the build machine’s CPU:

# NixOS module: provide the RustiQ flake through specialArgs.inputs.
{ pkgs, inputs, ... }:
{
  environment.systemPackages = [
    (inputs.rustiq.legacyPackages.${pkgs.stdenv.hostPlatform.system}.cpuTarget "native")
  ];
}

Then import it in the existing configuration.nix, preserving any other imports:

{ ... }:
{
  imports = [ ./rustiq.nix ];
}

Alternatively, add ./rustiq.nix to the modules list in nixosSystem. See the CPU caveats below before using native. To use the standard package, replace the expression inside the list with:

inputs.rustiq.packages.${pkgs.stdenv.hostPlatform.system}.default

From the configuration directory, apply it with sudo nixos-rebuild switch --flake .#YOUR_HOST and check rustiq --version. Replace YOUR_HOST with your NixOS configuration name. See the NixOS package management guide.

Optional CPU-specific build

The NixOS module above uses this expression. For Home Manager, you can also replace the standard package entry in home.packages with it:

(inputs.rustiq.legacyPackages.${pkgs.stdenv.hostPlatform.system}.cpuTarget "native")

For a profile installation from any directory, use one command instead:

nix profile install --impure --expr '(builtins.getFlake "github:mveril/RustiQ").legacyPackages.${builtins.currentSystem}.cpuTarget "native"'

List compiler CPU names with rustc --print target-cpus (for example inside nix develop github:mveril/RustiQ#rust). native selects the build machine’s CPU, which may differ from the machine running RustiQ when using remote builders. Its detected CPU is not recorded in the Nix build identity: cached results may have been built for a different CPU. For reproducible builds or deployment across machines, replace native with a compatible explicit CPU name such as znver3. A binary may fail on machines with fewer processor features. This setting applies to Rust-compiled code and does not promise optimization of every native dependency. The --impure flag allows the command-line expression to obtain the current system and resolve the unlocked GitHub reference.

Build from a checkout

From the root of a RustiQ checkout, build the default package and run it without adding it to your profile:

nix build
./result/bin/rustiq --version

The package includes the offline manual and shell completions. Run rustiq docs after installing, or ./result/bin/rustiq docs from the checkout. See the manual instructions and the Nix package guide.

The package enables online basis downloads but does not bundle sample inputs or basis sets. Download or import a basis before running a calculation; see make basis sets available and the first calculation. For development shells, see Nix setup.