Skip to content

Nix-based, immutable deployment target for Basalt primarily targetting the Raspberry Pi platform

Notifications You must be signed in to change notification settings

basalt-rs/basalt-nix

Repository files navigation

Basalt Nix

This project is built on top of our minimal Raspberry Pi Nix repo.

This repository gets you up and running with a flake that can build a Nix OS Basalt image for the Raspberry Pi.

This really basic example just comes with networking, docker, and SSH preconfigured.

Setup

  1. Clone the repo
git clone https://github.com/basalt-rs/nix-pi-base.git && cd nix-pi-base
  1. Setup
make setup-pathing # update paths in `flake.nix`
make setup-config # create configuration files

Make your configurations by modifying the following files:

  • config/networking.toml
  • config/users.toml
  • security.nix
  1. Build

Build according to your architecture, but different operating systems might have additional requirements. You'll likely want to use QEMU to cross-compile if necessary.

Building on x86 Machines

To build on x86 machines, you will need to set up QEMU with binfmt. I've included the Archlinux instructions for this.

  1. Build
make build
  1. Flash
# replace /dev/sda with your intended device target
make flash DEVICE=/dev/sda
  1. Eject
# You can do this manually to if you'd like or need.
make safe-eject
  1. Plug and Play

Booting up your Pi with your SD card inserted should cause your Pi to boot into your NixOS image. If you're fully headless, use nmap or arp-scan to find it on your network. Then you're good to SSH.

Note

If you end up rebuilding and reflashing, you may need to remove the device from your known SSH hosts (~/.ssh/known_hosts) or SSH may yell at you.

Archlinux

  1. Add extra-platforms to /etc/nix/nix.conf
extra-platforms = aarch64-linux
  1. Install Deps
sudo pacman -S qemu-user-static qemu-user-static-binfmt
  1. Build

You're good to build and flash as usual!

Updating Configs After Builds

When you make changes to config files, you will need to update the nix lock:

make update-config

About

Nix-based, immutable deployment target for Basalt primarily targetting the Raspberry Pi platform

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published