Skip to content

openXC7/toolchain-nix

Repository files navigation

openXC7 toolchain

The openXC7 FPGA toolchain's integration with the Nix package manager offers precise control over software builds and dependencies, emphasizing reproducibility and configuration transparency. Conversely, the adaptation to a containerized environment using Podman or Docker facilitates cross-platform operation, notably on Windows WSL and MacOS x86, and encapsulates the toolchain for consistent execution across varied systems. While Nix provides a robust, integrated environment, the container approach introduces portability and simplifies the toolchain's utilization for users less versed in Nix's specifics.

How to use with Nix package manager

  1. Install the Nix package manager on your Linux distribution of choice (or use NixOS):
$ sh <(curl -L https://nixos.org/nix/install) --daemon
  1. Enable flakes: Add the following to ~/.config/nix/nix.conf or /etc/nix/nix.conf:
experimental-features = nix-command flakes
  1. Then you will get a development shell with the complete toolchain with:
$ nix develop github:openxc7/toolchain-nix
  1. Compile and load a demo project onto an FPGA:
$ git clone https://github.com/openXC7/demo-projects
$ cd demo-projects/blinky-qmtech
$ make
$ make program

How to use as a container

docker

To build a docker container for x86_64-linux, use:

$ nix build -L ".#dockerImage.x86_64-linux"

The resulting container is then the file ./result, which you can install with:

$ docker image load --input result
a7cd1bb3e14c: Loading layer [==================================================>]   2.34GB/2.34GB
Loaded image: openxc7-docker:ifnarr8fs6vln2sbxwswrxlmwvxjmri0

You can then run this image with:

docker run -v ./demo-projects/:/work -it openxc7-docker:ifnarr8fs6vln2sbxwswrxlmwvxjmri0

podman

To utilize the openXC7 FPGA toolchain in a Podman container, users must first ensure Podman is installed on their system. The process involves building the container image with the toolchain using a specific build command. Once the image is built, the toolchain is executed within the container through a run command. This containerized approach ensures a consistent development environment across various operating systems like Windows, MacOS (x86 only), and Linux, streamlining the deployment and usage of the toolchain.

For installation and contaienr usage, please refer to the detailed instructions.