Skip to content

Latest commit

 

History

History
52 lines (37 loc) · 2.25 KB

nix.md

File metadata and controls

52 lines (37 loc) · 2.25 KB
layout title subtitle slug
default
Nix
Running KLEE with Nix
nix

Quick Start

KLEE has a package on nixpkgs that is usable on x86_64 Linux systems. Getting started with it is as fast as or faster than using the Docker version, and carries all the reproducible build guarantees of the Nix build system.

To make the package available in an ephemeral shell, ensure you have Nix or are running NixOS, and run:

$ nix-shell -p klee

If the package was built on Hydra and is available on the NixOS binary cache, it will simply download and be instantly available to run. Otherwise, the package will build.

What is Nix?

  • Nix is a build system focused on reproducibility. Build scripts are written in a functional language, also called Nix.
  • nixpkgs contains knowledge on how to build many packages for Linux and MacOS systems.
  • NixOS is an entire Linux-based operating system built with nixpkgs. NixOS is just Nix to its logical conclusion - the entire system configuration is immutable and built functionally from several packages.

The instructions for building KLEE in nixpkgs are located here. The Nix package runs the KLEE unit and system test suite as a sanity check before the build completes.

Installing KLEE systemwide in NixOS

If you are running NixOS and wish to install KLEE systemwide, simply include it in environment.systemPackages in your NixOS configuration.

environment.systemPackages = with pkgs; [
  klee
];

Advanced package use

Currently, the Nix package for KLEE takes a "debug" argument that defaults to false. If you want a debug build of KLEE, you would use the nixpkgs override pattern to force it to true.

NOTE: If any of the build inputs change from the defaults, Nix will no longer be able to fetch it from the NixOS binary cache, and a local build will occur.

$ nix-shell -p 'klee.override { debug = true; }'