refactor: reorganise flake, tests and repo tasks

This commit is contained in:
Willem Vanhulle committed 2026-10-21 12:12:49 +02:00
1 parent b93147c7a6
commit 794ca5a086
34 files changed
+670 -220

No files matched your search

+48 -30
View File
@@ -5,7 +5,7 @@ nix-output-monitor. It replaces the scrolling kernel and systemd lines with the
units still pending and, in the room the tree leaves, a timeline of the slowest
ones that ran.
<img src="https://codeberg.org/wvhulle/bootvine/raw/branch/main/docs/boot.gif" width="691" alt="A boot through the initrd into stage 2, with one failed unit">
<img src="https://codeberg.org/wvhulle/bootvine/raw/branch/main/recordings/boot.gif" width="691" alt="A boot through the initrd into stage 2, with one failed unit">
It needs systemd ≥ 246 as PID 1, libdbus and a virtual terminal (it draws on
tty12). With a systemd initrd it starts about a second after the kernel and
@@ -19,25 +19,45 @@ It also follows shutdowns and reboots: the units being stopped, nested under
the units that have to stop first, until systemd hands over to
`systemd-shutdown`.
<img src="https://codeberg.org/wvhulle/bootvine/raw/branch/main/docs/shutdown.gif" width="691" alt="A poweroff: units stopping under the targets waiting on them">
<img src="https://codeberg.org/wvhulle/bootvine/raw/branch/main/recordings/shutdown.gif" width="691" alt="A poweroff: units stopping under the targets waiting on them">
Passphrase prompts, such as a LUKS unlock in the initrd, are answered in place
over the tree.
<img src="https://codeberg.org/wvhulle/bootvine/raw/branch/main/docs/passphrase.png" width="640" alt="A LUKS passphrase prompt floating over the initrd tree">
<img src="https://codeberg.org/wvhulle/bootvine/raw/branch/main/recordings/passphrase.png" width="640" alt="A LUKS passphrase prompt floating over the initrd tree">
## Try
## Try it without installing
Neither of these touches your system's boot.
### Scripted boots in your terminal
From a clone, with Rust installed (see step 1 of the Ubuntu install below):
```sh
git clone https://codeberg.org/wvhulle/bootvine.git
cd bootvine
cargo run --example boot
cargo run --example shutdown
cargo run --example luks
```
play a scripted boot, poweroff or boot from an encrypted root without systemd;
`q` quits. The encrypted root unlocks with the passphrase `demo`; `Esc` quits
while it asks. `nix run .#vm` boots a demo
VM in a window.
These play a scripted boot, a poweroff and a boot from an encrypted root, with
no systemd involved. `q` quits. The encrypted root unlocks with the passphrase
`demo`; `Esc` quits while it asks.
### A sample machine in a VM
With Nix, and no clone needed:
```sh
nix run git+https://codeberg.org/wvhulle/bootvine#sample-machine-vm
```
This boots a NixOS machine with bootvine and a set of slow and failing sample
units in a QEMU window, from the initrd through stage 2. It logs in as root;
`poweroff` shows the shutdown. Its disk image is kept in
`~/.cache/bootvine-sample-machine.qcow2`.
## Install
@@ -98,45 +118,43 @@ VM in a window.
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
```
2. Build:
2. Clone, build and install the binary and the systemd units, and enable
them. `cargo xtask install` builds as you and asks `sudo` only for the
copying and `systemctl enable`:
```sh
git clone https://codeberg.org/wvhulle/bootvine.git
cd bootvine
cargo build --release
cargo xtask install
```
3. Install the binary and the systemd units, and enable them:
This is enough for bootvine to show stage 2 and shutdown. It installs
`/usr/bin/bootvine` and `bootvine.service` and `bootvine-shutdown.service`
in `/usr/lib/systemd/system`.
```sh
sudo install -Dm755 target/release/bootvine /usr/bin/bootvine
sudo install -Dm644 -t /usr/lib/systemd/system \
packaging/systemd/bootvine.service packaging/systemd/bootvine-shutdown.service
sudo systemctl enable bootvine.service bootvine-shutdown.service
```
This is enough for bootvine to show stage 2 and shutdown.
4. Optionally, follow the boot from the initrd. This needs a dracut initramfs
3. Optionally, follow the boot from the initrd. This needs a dracut initramfs
with systemd in it; initramfs-tools has no systemd, so on releases that use
it bootvine starts in stage 2 only.
```sh
sudo install -Dm755 packaging/dracut/90bootvine/module-setup.sh \
/usr/lib/dracut/modules.d/90bootvine/module-setup.sh
echo 'add_dracutmodules+=" bootvine "' | sudo tee /etc/dracut.conf.d/bootvine.conf
cargo xtask install --initrd dracut
sudo dracut --force
```
5. Reboot.
This adds the dracut module in `/usr/lib/dracut/modules.d/90bootvine` and
enables it in `/etc/dracut.conf.d/bootvine.conf`.
4. Reboot.
`cargo xtask uninstall` removes all of it again.
### Other distributions
Install the binary and units as in the Ubuntu steps. For the initrd, use the
dracut module as above, or on mkinitcpio install
`packaging/mkinitcpio/install/sd-bootvine` to `/usr/lib/initcpio/install/`, add
`sd-bootvine` after `systemd` in `HOOKS` in `/etc/mkinitcpio.conf`, and run
`sudo mkinitcpio -P`.
Install as in the Ubuntu steps. For the initrd, use the dracut module as above,
or on mkinitcpio run `cargo xtask install --initrd mkinitcpio`, which installs
`/usr/lib/initcpio/install/sd-bootvine`, then add `sd-bootvine` after `systemd`
in `HOOKS` in `/etc/mkinitcpio.conf` and run `sudo mkinitcpio -P`.
`--destdir <dir>` stages the files under `<dir>` instead, for packaging.
## Configure