KLEE

master branch

The 4th International KLEE Workshop on Symbolic Execution is coming!
Join us from 15–16 April 2024 in Lisbon!

Nix

Running KLEE with 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?

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; }'