First things first. Out of convenience I am using Manjaro Linux, but everything shown here should in general work for all systems with systemd-nspawn
.
1. Installing KiCAD Stable
First install KiCAD as one would normally do.
$ sudo pacman -S kicad kicad-library kicad-library-3d
When starting eeschema/pcbnew for the first time, they asks you where to load the symbol and footprint library table from. Select default in both cases.
2. Setting up a nspawnd container
on host
# install pacstrap
sudo pacman -S arch-install-scripts
# create directory for container
mkdir -p containers/kicad_upstream
# install basic system
sudo pacstrap -c containers/kicad_upstream base base-devel yay
# chroot into container
sudo systemd-nspawn -directory containers/kicad_upstream
in container
# add a user and create home directory
useradd -m user
# set password for user
passwd user
# make user sudoer
groupadd sudo
usermod user -aG sudo
echo '%sudo ALL=(ALL) ALL' | tee -a /etc/sudoers.d/sudo
logout
3. Installing kicad-git
on host
# chroot into container as user
sudo systemd-nspawn --user=user -directory containers/kicad_upstream
in container
# update system
yay -Syyu
# start downloading, building and installing kicad from upstream
# this may take a long time
yay -S kicad-git
# clone the upstream libraries
mkdir -p repos/kicad
cd repos/kicad
git clone https://gitlab.com/kicad/libraries/kicad-footprints.git
git clone https://gitlab.com/kicad/libraries/kicad-symbols.git
git clone https://gitlab.com/kicad/libraries/kicad-packages3D.git
logout
4. Starting an Configuring Upstream KiCAD
To make the X environment available to the container, we have to bind a modified xauth file.
on host
XAUTH=/tmp/container_xauth
touch $XAUTH
xauth nextract - "$DISPLAY" | sed -e 's/^..../ffff/' | xauth -f "$XAUTH" nmerge -
KiCAD can then be started with
on host
sudo systemd-nspawn --directory containers/kicad_upstream \
--bind=/tmp/.X11-unix \
--bind="$XAUTH" \
--setenv DISPLAY="$DISPLAY" \
--setenv XAUTHORITY="$XAUTH" \
--user=user \
/usr/bin/kicad
When running KiCAD for the first time, it prompts you about the configuration. Select the default.
Under Preferences > Configure Paths set the following names to the paths of the repositories we just cloned.
Name | Path |
---|---|
KICAD_SYMBOL_DIR | /home/user/repos/kicad/kicad-symbols |
KISYS3DMOD | /home/user/repos/kicad/kicad-packages3D |
KISYSMOD | /home/user/repos/kicad/kicad-footprints |
When starting eeschema/pcbnew for the first time, they asks you where to load the symbol and footprint library table from. Select “Custom global…” in both cases. Then browse to the corresponding repository and select sym-lib-table
and fp-lib-tabl
respectively.
Testing everything:
5. Keeping Up-to-Date
To update KiCAD repeate the installation from 3.
To update symbols and footprints, simply git pull
in the repository.