Skip to content
Open
Show file tree
Hide file tree
Changes from 45 commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
54ef6a3
refactor: reorganize things to be easier to work on. wip.
ryleu Jun 6, 2026
e4acd1c
feat: use authorized_keys.nix as ssh authorized keys
ryleu Jun 6, 2026
f2fea9e
feat: disko
ryleu Jun 6, 2026
3465497
chore: remove keys of former members
ryleu Jun 6, 2026
a57f539
feat: add nix cache for iso builds
ryleu Jun 6, 2026
95bccd9
feat(ssh): add hostname.local ssh blocks. also refactor to use cool f…
ryleu Jun 6, 2026
4f0b4f0
feat: swap partition -> btrfs subvol
ryleu Jun 6, 2026
7aacf00
docs: add instructions to use the actions artifact
ryleu Jun 6, 2026
05782fc
docs: reword and flesh out README
ryleu Jun 14, 2026
9c02dbc
docs: move input documentation from README to comments in flake.nix
ryleu Jun 14, 2026
3c99458
docs: document disko setup
ryleu Jun 14, 2026
7acb17b
fix: move zed to the basestation role
ryleu Jun 14, 2026
4d3be6a
docs: document ssh.nix
ryleu Jun 14, 2026
3b1966d
feat: add more debugging tools to the installer ISO
ryleu Jun 14, 2026
143bb84
chore: rekey agenix
ryleu Jun 14, 2026
d9dc150
docs: remove information that might change from the options descriptions
ryleu Jun 14, 2026
6ac5dcd
docs(antenna): comment restream ports
ryleu Jun 14, 2026
b409a62
feat(basestation): add mpv
ryleu Jun 14, 2026
99ec051
feat: remove hostapd
ryleu Jun 14, 2026
53f036d
style: nix fmt
ryleu Jun 14, 2026
11aa6a3
feat(devshell): warn if docker is missing
ryleu Jun 16, 2026
8ed4ef9
feat(hardware): ensure graphics are available n cpu-*.nix
ryleu Jun 16, 2026
936e49a
refactor(net): migrate from networkmanager + wpa_supplicant to system…
ryleu Jun 17, 2026
9b86c0a
fix(ros): only add realsense to rovers
ryleu Jun 17, 2026
a21bb01
feat(network): map device ips to /etc/hosts
ryleu Jun 17, 2026
7b017a6
feat(sleep): all devices dont sleep now
ryleu Jun 17, 2026
ad38e9d
feat: change bag location to /tmp so it gets cleared automatically
ryleu Jun 17, 2026
1fbb8e7
feat: drop vscode and add pio cli
ryleu Jun 17, 2026
91e3ca6
feat(deck): add steam
ryleu Jun 17, 2026
a759c2a
chore: bump state versions
ryleu Jun 17, 2026
450afce
refactor(home): move to one big home-configuration.nix
ryleu Jun 17, 2026
a577de6
refactor(nixos): consolidate things into (mostly) one file
ryleu Jun 17, 2026
3741828
refactor(flake): inline mkInstaller
ryleu Jun 17, 2026
6b876ad
docs(readme): add rekey instructions back
ryleu Jun 17, 2026
e51f655
docs(configuration.nix): comments everywhere
ryleu Jun 17, 2026
ebc2183
refactor(network): clean up how the default wifi networks are set up
ryleu Jun 17, 2026
64d978f
fix(age): use tmpfiles to ensure .ssh exists because i love systemd
ryleu Jun 17, 2026
bb6abb5
refactor(home-configuration.nix): move let-in statements closer to wh…
ryleu Jun 17, 2026
b015a06
feat: switch fully to zsh for astra user
ryleu Jun 17, 2026
8370330
refactor: clean up things that are already declared elsewhere
ryleu Jun 17, 2026
d3a7785
docs(readme): update ToC
ryleu Jun 17, 2026
86c28ef
refactor: clean up cruft
ryleu Jun 17, 2026
42bdf9c
feat: add wifi config to installer
ryleu Jun 17, 2026
96649eb
fix(disko): drop invalid noctime/nomtime mount options
ryleu Jun 17, 2026
7541b71
feat(installer): clone flake into /etc/nixos on install
ryleu Jun 17, 2026
6b3b658
fix: change priority on disabling wpa_supplicant
ryleu Jun 17, 2026
481c6e0
fix: remove serial boot params as they break real installs
ryleu Jun 17, 2026
203098d
docs(configuration.nix): sorry roald
ryleu Jun 17, 2026
273f6f7
feat(nixos): rm ag
ryleu Jun 17, 2026
9a0e659
docs(nixos): change the comment on bat
ryleu Jun 17, 2026
407d302
feat(basestation): rm zeditor
ryleu Jun 17, 2026
d8c1f5c
fix(installer): set up the motd properly
ryleu Jun 17, 2026
f0f45b2
feat: add drivers for VMs
ryleu Jun 17, 2026
69672f3
refactor(nixos): pull role-specific stuff out of configuration.nix
ryleu Jun 17, 2026
b5a1550
feat(deck): reorient bootloader (thanks roald)
ryleu Jun 17, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .actrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
--artifact-server-path ./.act-artifacts
70 changes: 70 additions & 0 deletions .github/workflows/build-installer.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
name: Build installer ISO

on:
push:
branches: [main]
tags: ["v*"]
pull_request:
workflow_dispatch:

jobs:
build:
name: Build astra-installer.iso
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Free disk space
run: |
sudo rm -rf /usr/share/dotnet /usr/local/lib/android /opt/ghc \
/opt/hostedtoolcache/CodeQL /usr/local/share/boost
sudo docker image prune --all --force || true
df -h

- name: Install Nix
uses: DeterminateSystems/nix-installer-action@main
with:
extra-conf: |
accept-flake-config = true
extra-substituters = https://ros.cachix.org https://attic.iid.ciirc.cvut.cz/ros
extra-trusted-public-keys = ros.cachix.org-1:dSyZxI8geDCJrwgvCOHDoAfOm5sV1wCPjBkKL+38Rvo= ros:JR95vUYsShSqfA1VTYoFt1Nz6uXasm5QrcOsGry9f6Q=

- uses: nix-community/cache-nix-action@v7
with:
primary-key: nix-${{ runner.os }}-${{ hashFiles('**/flake.lock') }}
restore-prefixes-first-match: nix-${{ runner.os }}-
gc-max-store-size-linux: 2G
purge: true
purge-prefixes: nix-${{ runner.os }}-
purge-created: 0
purge-last-accessed: 86400
purge-primary-key: never

- name: Check flake
run: nix flake check --print-build-logs

- name: Build installer
run: nix build .#installer --print-build-logs

- name: Resolve ISO path
id: iso
run: |
iso=$(readlink -f result/iso/*.iso)
echo "path=$iso" >> "$GITHUB_OUTPUT"
echo "name=$(basename "$iso")" >> "$GITHUB_OUTPUT"
ls -lh "$iso"

- name: Upload ISO artifact
uses: actions/upload-artifact@v4
with:
name: ${{ steps.iso.outputs.name }}
path: ${{ steps.iso.outputs.path }}
if-no-files-found: error
retention-days: 30

- name: Attach ISO to release
if: ${{ !env.ACT && startsWith(github.ref, 'refs/tags/v') }}
uses: softprops/action-gh-release@v2
with:
files: ${{ steps.iso.outputs.path }}
fail_on_unmatched_files: true
9 changes: 6 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# output from building
result

# output of nixos-generate-config
/hardware-configuration.nix
/configuration.nix
# act local artifact store
.act-artifacts/

# direnv
.direnv/
.envrc
136 changes: 77 additions & 59 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,32 @@

## Contents

- [Home Manager config `./home/`](./home/)
- [Device-specific config `./hosts/`](./hosts/)
- [Tracking Antenna `./hosts/antenna/`](./hosts/antenna/)
- [Clucky `./hosts/clucky/`](./hosts/clucky/)
- [Steam Deck `./hosts/deck/`](./hosts/deck/)
- [Base Station Panda `./hosts/panda/`](./hosts/panda/)
- [Testbed `./hosts/testbed/`](./hosts/testbed/)
- [Global system config `./system/`](./system/)
- [Graphical system config `./system/graphical/`](./graphical/graphical/)
- [Encrypted secrets `./system/secrets/`](./system/secrets/)

## Software Prerequisites

You must have [NixOS](https://nixos.org) installed to use this repository.
Comment thread
ryleu marked this conversation as resolved.
- [Shared NixOS config `./modules/nixos/`](./modules/nixos/)
- [Roles `./modules/nixos/roles/`](./modules/nixos/roles/)
- [Encrypted secrets `./modules/nixos/agenix/`](./modules/nixos/agenix/)
- [Per-host hardware config `./modules/hardware/`](./modules/hardware/)
- [Tracking Antenna `./modules/hardware/antenna/`](./modules/hardware/antenna/)
- [Clucky `./modules/hardware/clucky/`](./modules/hardware/clucky/)
- [Steam Deck `./modules/hardware/deck/`](./modules/hardware/deck/)
- [Base Station Panda `./modules/hardware/panda/`](./modules/hardware/panda/)
- [Testbed `./modules/hardware/testbed/`](./modules/hardware/testbed/)
- [Home Manager config `./modules/home-manager/`](./modules/home-manager/)
- [Disk partitioning `./modules/disko/`](./modules/disko/)
- [Installer ISO `./modules/installer/`](./modules/installer/)

## Usage

> [!IMPORTANT]
> Slow down! Read through the instructions for what you're doing before you
> start doing it. You can't simply copy commands one-for-one!

### Software Prerequisites

You must have the [Nix](https://nixos.org/download/) package manager installed to work
on this repository. I recommend using the multi-user install script. If you are on a
system with SELinux, you must either disable enforcement (not recommended) or use your
system's package manager if available to install Nix.

### Updating Flake

Grab the latest changes.
Expand Down Expand Up @@ -52,54 +57,38 @@ sudo nixos-rebuild boot
### Apply Flake on New Installation

> [!CAUTION]
> These instructions will overwrite your current system configuration with
> the ASTRA one. Only use on a system where you're sure this is okay!
> The installer erases the selected disk. Only run it on a system where this
> is okay.

First, connect to wifi and prepare the system for setup.
First, either download the latest ISO from the [actions page](https://github.com/SHC-ASTRA/nixos-flake/actions?query=workflow%3A%22Build+installer+ISO%22+is%3Asuccess+branch%3Amain)
or build it with the following command:

```bash
# take ownership of the installation path
sudo chown -R $USER /etc/nixos

# remove existing system config
rm -rf /etc/nixos/*

# clone flake to correct path
# we need to use nix-shell here because new systems do not have git installed.
nix-shell -p git --run 'git clone https://github.com/SHC-ASTRA/flake.git /etc/nixos'
nix build .#installer
```

Second, modify the flake to match your installation. Depending on which system
you're installing on, you'll need to select the correct hostname. Replace
`${hostname}` with the one you select. Here's the list:
The image will end up at `./result/iso/astra-installer-*.iso` after you build it.

- Tracking Antenna: `antenna`
- Clucky: `clucky`
- Steam Deck: `deck`
- Base Station Panda: `panda`
- Testbed: `testbed`
Write the image to a USB flash drive that is >=2GB using your favorite flashing
software. I recommend [balenaEtcher](https://etcher.balena.io/) or the `dd` command.

```bash
# generate the hardware configuration and copy it to the right host
nixos-generate-config
mv /etc/nixos/hardware-configuration.nix /etc/nixos/hosts/${hostname}/hardware.nix
```

Third, actually install the flake.
Once booted, run the installer and follow the prompts:

```bash
# rebuild the system, selecting the new hostname
sudo nixos-rebuild switch --flake /etc/nixos/#${hostname}
astra-install
```

Fourth, reboot and if all went well you should have the system configuration!
You will be asked to:

1. Pick a host.[^1]
2. Pick the target disk.[^2]
3. Confirm.

> [!NOTE]
> The `astra` user will be created if it doesn't already exist, and the
> hostname will be updated to the one you specified.
The installer partitions the disk with the ASTRA layout, mounts it, and runs
`nixos-install` for the chosen host. After it finishes, reboot when prompted.

You'll also need to rekey the agenix secrets. Instructions for doing so can be
Comment thread
ryleu marked this conversation as resolved.
found in [`system/secrets/README.md`](./system/secrets/README.md).
found in [`modules/nixos/agenix/README.md`](./modules/nixos/agenix/README.md).

### Testing the Flake

Expand All @@ -110,6 +99,9 @@ can do the following:
# navigate to wherever you cloned the repo
cd path/to/flake/

# check if the flake is valid
nix flake check

# attempt to build the flake
nixos-rebuild build --flake .#${hostname}
```
Expand All @@ -123,17 +115,6 @@ sudo nixos-rebuild test
This will rebuild your current hostname's flake and activate the configuration,
but not persist it across reboots.

## Channels

The configured channels can be seen in [`flake.nix`](./flake.nix).

- `nix-ros-overlay`: ROS2
- `nixpkgs`: Main set of packages.
- `hardware`: Hardware-specific configuration, especially for NVIDIA drivers.
- `home-manager`: Manage user-level configurations.
- `basestation-cameras`: Gstreamer cameras app.
- `agenix`: Encrypted secrets management.

## Rationale

Using NixOS lets us ensure we have the same configuration between our various
Expand All @@ -142,3 +123,40 @@ differences in the field. This gives us the ability to confidently test on
Testbed and then ship to Clucky without having to worry if some package or
setting might be missing from one of them, and to ensure the experience between
the Steam Deck and the Panda in the Base Station chassis are the same.

## Footnotes

[^1]: The hosts are as follows:
- `antenna`: The Latte Panda Delta 3 installed within the Tracking Antenna.
- `clucky`: The Intel NUC installed within the main rover.
- `deck`: The Valve Steam Deck used with basestation.
- `panda`: The Latte Panda Delta 3 installed within basestation.
- `testbed`: The Intel NUC installed within the testing rover.

[^2]: Linux references disks by their block device file which lives in `/dev`. Each
block device file's name starts with a string corresponding to the type. For example:
NVME device files start with `/dev/nvme`, SATA and USB device files start with
`/dev/sd`, and eMMC device files (like on the Pandas) start with `/dev/mmcblk`.

You can list all available block device files with `sudo fdisk -l`.

After the type, you will find the device index. This index changes based on the
order the kernel finds the device. For NVME and eMMC devices, the index is a number
and for `sd-bus` devices (SATA and USB), the index is a letter. Additionally, NVME
devices have an additional number that denotes their name, but it is rare to see
anything other than `n1`. Finally, if the device file you're looking at is for a
partition, it will have `pX` at the end, where X is a number`.

Here are some example block device files names:

- `/dev/nvme0n1` - NVME device. This is what you will select for the installer on
`deck`.
- `/dev/nvme0n1p1` - NVME device partition. Do not select this as it is a partition,
not the whole device!
- `/dev/mmcblk0` - eMMC device. This is what you will select for `antenna` or
`panda`.
- `/dev/sdb` - SATA or USB device. This could either be the SATA SSD inside of one of
the NUCs, or it could be your installer USB. Double check the size with
`sudo fdisk -l`.
- `/dev/sda` - Another candidate for either of the NUCs' SSDs.
- `/dev/sdb2` - Another partition file. Do not select this!
21 changes: 21 additions & 0 deletions flake.lock
Comment thread
ryleu marked this conversation as resolved.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading