diff --git a/nix/README.rst b/nix/README.rst
new file mode 100644
index 000000000..7df289bd4
--- /dev/null
+++ b/nix/README.rst
@@ -0,0 +1,28 @@
+Install ARTIQ via the Nix Package Manager
+=========================================
+
+These instructions provide an alternative route to install ARTIQ for people who do not wish to use conda.
+
+This sets up an environment suitable for using ARTIQ, including the ARTIQ-Python compiler, device drivers, and the graphical user interfaces. This works correctly on Linux, and partially works (but not to a level that we would consider usable) with WSL introduced in Windows 10.
+
+ARTIQ firmware and gateware development tools (e.g. rustc, Migen) and ARTIQ core device flashing tools (OpenOCD, proxy bitstreams) are currently not available on Nix. Pull requests welcome!
+
+* Install the Nix package manager
+
+ * many Linux distros already have a package for the `Nix package manager `_
+
+ * for example: ``$ apt-get install nix``
+
+ * if you would like to install via sh
+
+ * $ ``wget https://nixos.org/nix/install``
+
+ * $ ``sh install``
+
+ * $ ``source ~/.nix-profile/etc/profile.d/nix.sh``
+
+* $ ``git clone github.com/m-labs/artiq``
+* $ ``cd artiq/nix``
+* $ ``nix-env -i -f default.nix``
+
+The above command will setup your entire environment. Note that it will compile LLVM and Clang, which uses a lot of CPU time and disk space.
diff --git a/nix/artiq.nix b/nix/artiq.nix
new file mode 100644
index 000000000..c959c8a17
--- /dev/null
+++ b/nix/artiq.nix
@@ -0,0 +1,79 @@
+{ stdenv, fetchFromGitHub, fetchsvn, python3Packages, qt5Full, binutils-or1k, llvm-or1k, llvmlite, python3 }:
+
+let
+
+levenshtein = python3Packages.buildPythonPackage rec {
+ name = "levenshtein";
+ src = fetchFromGitHub {
+ owner = "ztane";
+ repo = "python-Levenshtein";
+ rev = "854e61a05bb8b750e990add96df412cd5448b75e";
+ sha256 = "1yf21kg1g2ivm5a4dx1jra9k0c33np54d0hk5ymnfyc4f6pg386q";
+ };
+ doCheck = false;
+};
+
+pythonparser = python3Packages.buildPythonPackage rec {
+ name = "pythonparser";
+ src = fetchFromGitHub {
+ owner = "m-labs";
+ repo = "pythonparser";
+ rev = "5b391fe86f43bb9f4f96c5bc0532e2a112db2936";
+ sha256 = "1gw1fk4y2l6bwq0fg2a9dfc1rvq8cv492dyil96amjdhsxvnx35b";
+ };
+ propagatedBuildInputs = with python3Packages; [ regex ];
+ doCheck = false;
+};
+
+asyncserial = python3Packages.buildPythonPackage rec {
+ name = "asyncserial";
+ src = fetchFromGitHub {
+ owner = "m-labs";
+ repo = "asyncserial";
+ rev = "d95bc1d6c791b0e9785935d2f62f628eb5cdf98d";
+ sha256 = "0yzkka9jk3612v8gx748x6ziwykq5lr7zmr9wzkcls0v2yilqx9k";
+ };
+ propagatedBuildInputs = with python3Packages; [ pyserial ];
+ doCheck = false;
+};
+
+quamash = python3Packages.buildPythonPackage rec {
+ name = "quamash";
+ src = fetchFromGitHub {
+ owner = "harvimt";
+ repo = "quamash";
+ rev = "bbab9e30e10b71a95687b03a93524173fb7b43f0";
+ sha256 = "08hp2q4ifj6z2ww05c7zsy0cd732k9rnaims1j43vr4hhxx950mk";
+ };
+ propagatedBuildInputs = with python3Packages; [ pyqt5 ];
+ doCheck = false;
+};
+
+pyqtgraph-qt5 = python3Packages.buildPythonPackage rec {
+ name = "pyqtgraph_qt5-${version}";
+ version = "0.10.0";
+ doCheck = false;
+ src = fetchFromGitHub {
+ owner = "pyqtgraph";
+ repo = "pyqtgraph";
+ rev = "1426e334e1d20542400d77c72c132b04c6d17ddb";
+ sha256 = "1079haxyr316jf0wpirxdj0ry6j8mr16cqr0dyyrd5cnxwl7zssh";
+ };
+ propagatedBuildInputs = with python3Packages; [ scipy numpy pyqt5 pyopengl ];
+};
+
+in
+
+python3Packages.buildPythonPackage rec {
+ name = "artiq";
+ src = ./..;
+ propagatedBuildInputs = with python3Packages; [ binutils-or1k llvm-or1k llvmlite levenshtein pyqtgraph-qt5 aiohttp pygit2 pythonparser numpy dateutil quamash scipy prettytable pyserial asyncserial h5py cython regex qt5Full pyqt5 ];
+ doCheck = false;
+ meta = with stdenv.lib; {
+ description = "";
+ homepage = https://m-labs/artiq;
+ license = licenses.lgpl3;
+ maintainers = [ maintainers.sjmackenzie ];
+ platforms = [ "x86_64-linux" ];
+ };
+}
diff --git a/nix/binutils-or1k.nix b/nix/binutils-or1k.nix
new file mode 100644
index 000000000..f9fa99ad0
--- /dev/null
+++ b/nix/binutils-or1k.nix
@@ -0,0 +1,34 @@
+{ stdenv, buildPackages
+, fetchurl, zlib
+}:
+
+stdenv.mkDerivation rec {
+ basename = "binutils";
+ platform = "or1k";
+ version = "2.30";
+ name = "${basename}_${platform}-${version}";
+ src = fetchurl {
+ url = "https://ftp.gnu.org/gnu/binutils/binutils-${version}.tar.bz2";
+ sha256 = "028cklfqaab24glva1ks2aqa1zxa6w6xmc8q34zs1sb7h22dxspg";
+ };
+ configureFlags =
+ [ "--enable-shared" "--enable-deterministic-archives" "--target=or1k-linux"];
+ outputs = [ "out" "info" "man" ];
+ depsBuildBuild = [ buildPackages.stdenv.cc ];
+ buildInputs = [ zlib ];
+ enableParallelBuilding = true;
+ meta = {
+ description = "Tools for manipulating binaries (linker, assembler, etc.)";
+ longDescription = ''
+ The GNU Binutils are a collection of binary tools. The main
+ ones are `ld' (the GNU linker) and `as' (the GNU assembler).
+ They also include the BFD (Binary File Descriptor) library,
+ `gprof', `nm', `strip', etc.
+ '';
+ homepage = http://www.gnu.org/software/binutils/;
+ license = stdenv.lib.licenses.gpl3Plus;
+ /* Give binutils a lower priority than gcc-wrapper to prevent a
+ collision due to the ld/as wrappers/symlinks in the latter. */
+ priority = "10";
+ };
+}
diff --git a/nix/default.nix b/nix/default.nix
new file mode 100644
index 000000000..b536227ba
--- /dev/null
+++ b/nix/default.nix
@@ -0,0 +1,15 @@
+{system ? builtins.currentSystem}:
+let
+ pkgs = import {inherit system;};
+ callPackage = pkgs.lib.callPackageWith (pkgs // self );
+
+self = {
+ binutils-or1k = callPackage ./binutils-or1k.nix {};
+ llvm-src = callPackage ./fetch-llvm-clang.nix {};
+ llvm-or1k = callPackage ./llvm-or1k.nix {};
+ llvmlite = callPackage ./llvmlite.nix {};
+ artiq = callPackage ./artiq.nix { };
+};
+artiq = self.artiq;
+in
+artiq
diff --git a/nix/fetch-llvm-clang.nix b/nix/fetch-llvm-clang.nix
new file mode 100644
index 000000000..686aef9a6
--- /dev/null
+++ b/nix/fetch-llvm-clang.nix
@@ -0,0 +1,22 @@
+{ runCommand, fetchFromGitHub, git }:
+
+let
+llvm-src = fetchFromGitHub {
+ rev = "527aa86b578da5dfb9cf4510b71f0f46a11249f7";
+ owner = "m-labs";
+ repo = "llvm-or1k";
+ sha256 = "0lmcg9xj66pf4mb6racipw67vm8kwm84dl861hyqnywd61kvhrwa";
+};
+clang-src = fetchFromGitHub {
+ rev = "9e996136d52ed506ed8f57ef8b13b0f0f735e6a3";
+ owner = "m-labs";
+ repo = "clang-or1k";
+ sha256 = "0w5f450i76y162aswi2c7jip8x3arzljaxhbqp8qfdffm0rdbjp4";
+};
+in
+runCommand "llvm_or1k_src" {}''
+mkdir -p $out
+mkdir -p $out/tools/clang
+cp -r ${llvm-src}/* $out/
+cp -r ${clang-src}/* $out/tools/clang
+''
diff --git a/nix/llvm-or1k.nix b/nix/llvm-or1k.nix
new file mode 100644
index 000000000..403e95fd3
--- /dev/null
+++ b/nix/llvm-or1k.nix
@@ -0,0 +1,46 @@
+{ stdenv
+, git
+, llvm-src
+, perl, groff, cmake, libxml2, python, libffi, valgrind
+, ...
+}:
+
+stdenv.mkDerivation rec {
+ name = "llvm_or1k";
+ src = llvm-src;
+
+ buildInputs = [ perl groff cmake libxml2 python libffi ] ++ stdenv.lib.optional stdenv.isLinux valgrind;
+
+ preBuild = ''
+ NIX_BUILD_CORES=4
+ makeFlagsArray=(-j''$NIX_BUILD_CORES)
+ mkdir -p $out/
+ '';
+
+ cmakeFlags = with stdenv; [
+ "-DCMAKE_BUILD_TYPE=Release"
+ "-DLLVM_BUILD_LLVM_DYLIB=ON"
+ "-DLLVM_LINK_LLVM_DYLIB=ON"
+ "-DLLVM_TARGETS_TO_BUILD=X86"
+ "-DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD=OR1K"
+ "-DLLVM_ENABLE_ASSERTIONS=OFF"
+ "-DLLVM_INSTALL_UTILS=ON"
+ "-DLLVM_INCLUDE_TESTS=OFF"
+ "-DLLVM_INCLUDE_DOCS=OFF"
+ "-DLLVM_INCLUDE_EXAMPLES=OFF"
+ "-DCLANG_ENABLE_ARCMT=OFF"
+ "-DCLANG_ENABLE_STATIC_ANALYZER=OFF"
+ "-DCLANG_INCLUDE_TESTS=OFF"
+ "-DCLANG_INCLUDE_DOCS=OFF"
+ ];
+
+ enableParallelBuilding = true;
+ meta = {
+ description = "Collection of modular and reusable compiler and toolchain technologies";
+ homepage = http://llvm.org/;
+ license = stdenv.lib.licenses.bsd3;
+ maintainers = with stdenv.lib.maintainers; [ sj_mackenzie ];
+ platforms = stdenv.lib.platforms.all;
+ };
+}
+
diff --git a/nix/llvmlite.nix b/nix/llvmlite.nix
new file mode 100644
index 000000000..e03f408e8
--- /dev/null
+++ b/nix/llvmlite.nix
@@ -0,0 +1,20 @@
+{ stdenv, fetchgit, llvm-or1k, makeWrapper, python3, ncurses, zlib, python3Packages }:
+let
+version = "0f4ebae";
+in
+stdenv.mkDerivation rec {
+ name = "llvmlite-${version}";
+ src = fetchgit {
+ url = "https://github.com/m-labs/llvmlite";
+ rev = "401dfb713166bdd2bc0d3ab2b7ebf12e7a434130";
+ sha256 = "1ci1pnpspv1pqz712yix1nmplq7568vpsr6gzzl3a33w9s0sw2nq";
+ leaveDotGit = true;
+ };
+
+ buildInputs = [ makeWrapper python3 ncurses zlib llvm-or1k python3Packages.setuptools ];
+
+ installPhase = ''
+ LLVM_CONFIG=${llvm-or1k}/bin/llvm-config
+ python3 setup.py install --prefix=$out
+ '';
+}
diff --git a/nix/shell.nix b/nix/shell.nix
new file mode 100644
index 000000000..8fbdadb65
--- /dev/null
+++ b/nix/shell.nix
@@ -0,0 +1,8 @@
+{system ? builtins.currentSystem}:
+let
+ pkgs = import {inherit system;};
+ artiq = pkgs.callPackage ./default.nix {};
+in
+pkgs.mkShell {
+ buildInputs = [ artiq ];
+}