Title: NixOS Bento: now able to compare local and remote NixOS version | |
Author: Solène | |
Date: 06 September 2022 | |
Tags: bento nixos nix | |
Description: | |
# Bento | |
Project update: the report is now able to compare if the remote server | |
is using the NixOS version we built locally. This is possible as NixOS | |
builds are reproducible, I get the same result on the server and the | |
remote system. | |
The tool is getting in a better shape, the code received extra checks | |
in a lot of place. | |
A bit later (blog post update), I added the possibility to trigger the | |
update from the user. | |
Bento git project repository | |
# Listening to socket | |
With systemd it's possible to trigger a command upon connecting on a | |
socket, I made bento systemd service to listen on port TCP/51337, a | |
connection would start the service "bento-update.service", and display | |
the output to the TCP client. | |
This totally works in the web browser, it's now possible to create a | |
bookmark that just starts the update and give instant feedback about | |
the update process. This will be particularly useful in case of a | |
debug phone session to ask the remote person to trigger an update on | |
their side instead of waiting for a timer. | |
# Status display demo | |
It is now possible to differenciate the "not up to date" state into two | |
categories: | |
* the bento scripts were updated but not NixOS version change, this is | |
called "sync pending". Changes could be distributing the updating file | |
to give a new address for the remote server, so we can ensure they all | |
received it. | |
* the local NixOS version differs from the remote version, a rebuild is | |
required, thus it's called "rebuild pending" | |
The "sync pending" is very fast, it only need to copy the files, but | |
won't rebuild anything. | |
```text | |
machine local version remote version state … | |
------- --------- ----------- ------------- … | |
kikimora 996vw3r6 996vw3r6 π sync pending π© (build… | |
nas r7ips2c6 lvbajpc5 π rebuild pending π© (build… | |
t470 ih7vxijm ih7vxijm π up to date π … | |
x1 fcz1s2yp fcz1s2yp π up to date π … | |
``` |