Author: Tom Sydney Kerckhove <NorfairKing@users.noreply.github.com>
Committer: GitHub <noreply@github.com>
Add 'bevel migrate' so bevel works on a fresh machine (#14)
* Test that gathering works on a fresh machine
The nixos module test now records a command with bevel-gather right after
home-manager activation, before any 'bevel' subcommand has been run, and
asserts that the row lands in the database.
This currently fails: nothing applies the migrations at activation time, so
the database file and its schema only appear once the user happens to run a
'bevel' subcommand.
Failed to insert command: unable to open database file
* Add 'bevel migrate' and run it at home-manager activation
The bevel database schema was only ever created as a side effect of running
some 'bevel' subcommand, so on a machine that had never had one run,
bevel-gather could not record anything and 'bevel sync' had nothing to sync.
'bevel migrate' takes the exclusive database lock and applies the migrations,
without doing anything else. The home-manager module runs it both from an
activation script and from a 'bevel-migrate' user service that 'bevel-sync' is
ordered after. The activation script is what actually closes the hole: the
user's systemd instance is not running while home-manager activates on a
machine nobody has logged into yet ('User systemd daemon not running.
Skipping reload.'), so the service alone does not run at that point.
---------
Co-authored-by: Tom Sydney Kerckhove <syd@cs-syd.eu>
| Time to Start | Worker time | Duration | Time to finish | Idle | |
| Config | 0s | 1s | 1s | 1s | 0s |
| Eval | 0s | 10s | 10s | 11s | 0s |
| Build | 10s | 0s | 0s | 10s | 0s |
| Suite | 0s | 11s | 11s | 11s | 0s |