Skip to content
Fritz Mahnke edited this page Jun 30, 2024 · 10 revisions

Summary

Initial setup

nix package manager

Install nix package manager

Download and run the nix install script:

curl -L https://raw.githubusercontent.com/steppercontrol/planer_build/master/sh/nix_install_2.18.2 | sh

The expected output ends with:

Installation finished!  To ensure that the necessary environment
variables are set, either log in again, or type

  . /home/boss/.nix-profile/etc/profile.d/nix.sh

in your shell.

Source the environment as instructed above, or:

. $HOME/.nix-profile/etc/profile.d/nix.sh

Create nix user configuration

mkdir -p ~/.config/nix
echo "max-jobs = 4" >> ~/.config/nix/nix.conf
echo "experimental-features = nix-command flakes" >> ~/.config/nix/nix.conf

Enter a nix development shell

cd $planer_repository_path
git fetch
git checkout build
nix develop

Initialize the development environment

planer init --shell --arduino-ide --arduino-core

Configure a planer build directory

Configure the build directory

planer configure

Build and run

Enter a nix development shell

cd $planer_repository_path
git fetch
git checkout build
nix develop

Build

planer build

Upload

planer upload

Monitor

planer monitor

Explanation

nix package manager

nix serves to provide reproducible development shells with the software prerequisites for building the planer system. The flake.nix file in the planer repository describes the system's dependencies and build environment. With nix installed, the command nix develop enters a development shell with these dependencies available.

planer_build

The planer_build system provides a planer command with subcommands used to take planer-related actions. For example:

  • planer init is used to initialize the development environment, including installing the Arduino CLI and configuring the Arduino IDE.
  • planer configure is used to initialize a build directory.
  • planer build is used to build the system into a configured directory.

Build directory

Before building the system, a build directory must be initialized. The build directory is where all artifacts are placed, including Arduino programs, test programs, and debug information. After initialization, a build directory need not be reinitialized until a breaking change in the planer system or hardware or software reconfiguration.

  • The command planer configure initializes the build directory _build inside
  • the current shell directory.
  • On initialization, the file config.toml.default is used as the configuration template. It is copied to _build/config.toml with more specific information added.
  • Subsequent invocations of planer build use _build/config.toml. Any changes to this file are propagated the next time planer build is run.

Clone this wiki locally