bento: use nvd when available

This commit is contained in:
Solene Rapenne 2022-12-08 00:07:27 +01:00
parent dbfd792609
commit 018880d464
2 changed files with 10 additions and 1 deletions

View File

@ -37,6 +37,8 @@ This setup need a machine to be online most of the time. NixOS systems (clients
**Bento** doesn't necesserarily require a public IP, don't worry, you can use tor hidden service, i2p tunnels, a VPN or whatever floats your boat given it permit to connect to ssh.
**Bento** will use `nvd` instead of `nix store diff-closures` if it's available in the `$PATH`.
# How it works
The ssh server is containing all the configuration files for the machines. When you make a change, run `bento` to rebuild systems and copy all the configuration files to a new directory used by each client as a sftp chroot, each client regularly poll for changes in their dedicated sftp directory and if it changed, they download all the configuration files and run nixos-rebuild. It automatically detects if the configuration is using flakes or not.

9
bento
View File

@ -66,7 +66,14 @@ version_diff() {
if [ ! "${LASTLOGVERSION}" = "${EXPECTED_CONFIG}" ]
then
echo "Changes in $i between ${LASTLOGVERSION} and ${EXPECTED_CONFIG}"
nix store diff-closures "/nix/store/${LASTLOGVERSION}" "/nix/store/${EXPECTED_CONFIG}"
# better output if nvd is available
if type nvd 2>/dev/null >/dev/null
then
nvd diff "/nix/store/${LASTLOGVERSION}" "/nix/store/${EXPECTED_CONFIG}"
else
nix store diff-closures "/nix/store/${LASTLOGVERSION}" "/nix/store/${EXPECTED_CONFIG}"
fi
else
echo "$i is running the latest version"
fi