Installing EVA ICS on NixOS

NixOS is a very cool Linux distribution built on top of the Nix pkg manager. It’s very reliable and easy to deploy on multiple machines, however installing 3rd party software may be tricky.

Starting from version 3.2.1, you can run EVA ICS on NixOS. This article describes how to install it.

Install/enable mosquitto MQTT broker. Append the following lines to /etc/nixos/configuration.nix:

services.mosquitto.enable = true;
services.mosquitto.allowAnonymous = true;
services.mosquitto.users = {};

Then run

nixos-rebuild switch

Download and extract EVA ICS distribution:

cd /opt
wget https://get.eva-ics.com/3.2.1/stable/eva-3.2.1-2019041702.tgz
tar xzvf eva-3.2.1-2019041702.tgz
mv eva-3.2.1 eva

NixOS has all required libraries for EVA ICS except OWFS libow (NixOS libow package is maintained by our team, but will be included in NixOS stable distribution later), so you must use included “nix” build file to compile it and then use package overlay.

“nix” files for EVA ICS load all required libraries. “Heavy” pandas/numpy Python modules are got from NixOS package repository, others are installed with pip.

Let’s build libow package:

cd /opt/eva/include/nixos/contrib/libow
nix-build -E "(import <nixpkgs&gt; {}).callPackage ./default.nix {}"

Consider everything’s okay, then we can start EVA ICS setup (use “localhost” without username/password/SSL for MQTT):

echo "SYSTEM_SITE_PACKAGES=1" > /opt/eva/etc/venv
echo "SKIP=pandas" >> /opt/eva/etc/venv
nix-shell -I nixpkgs-overlays=/opt/eva/include/nixos/overlays /opt/eva/include/nixos/setup.nix --run /opt/eva/easy-setup

Great! Everything’s installed, now you can start EVA shell:

nix-shell /opt/eva/include/nixos --run eva-shell