this is working, but won’t update the metadata information until the next timer kick in to send a log after building nothing (except if you just use nixos-rebuild build which will just activate it as normal).
I have three hosts with very tight memory and CPU requirements, it currently works but the one in the local network could be handled this way fine
I think bento will need a rewrite in a proper language when I’m done writing it, this would allow more strictness and better user interface. But it’s cool to experiment
Meanwhile, I got a funnier workflow nix-copy-closure but async + pull based
Remote systems can depose the list of their nix store entries on the SFTP server, when generating a new configuration on the central / sftp server, a closure of the config can be generated, using comm and the nix store entries we can calculate missing store entries on the remote computer compared to the closure components. Then, using nix-store --export we can generate the closure diff and make it available on the SFTP, so when the remote computer will pick up the configuration files changes, it can also pick everything prepared for it to update
Basically
on a remote system, run find /nix/store/ -maxdepth 1 | sort | gzip > current-closure.gz and copy the file to the central server (bento already offer SFTP)
on the central server, run nixos-rebuild build to generate the machine config, then nix-store --query -R $(readlink -f result) | sort > new-closure
copy the current-closure.gz from the sftp directory, uncompress and store it somewhere temporary
As we know the remote configuration of the system, and the local (new) one, it’s possible to locally create a closure diff and make it available on the SFTP server.
The client would just fetch the result and import it into the store, the last line of nix-store --import is the NixOS system, in which there is the required scripts to switch to that configuration.
The diff will not take care of any store entry that would already be there though, but I think the tradeoff is fair.
It could be implemented by users, but would it make sense to have some kind of integration so that a Hydra instance can build systems and then systems would only update once Hydra has finished building them?
It seems like after a couple of updates you will end up with all packages present on your SFTP server in different .gz files. Wouldn’t it be easier to use it as a substituter at this point? Publish new config there with nix copy and let servers fetch it from there with nix copy (or nix-copy-closure, of course).
I never used hydra, but if you start building the systemd and only publish the configuration files after it’s done, that will work.
That’s how Bento is currently working, when deploying new files, they are built locally first one by one, and you can use that machine as a substituter.
So, bento received a new feature again, it can push configurations to a remote server
It’s practical for setting up new services and have changes instantaneous, and it doesn’t break the pull model. When you push a config, the same config is available in the SFTP server, so when it’s picked up, bento will do nothing except reporting the current version to the server.
New feature, the status display was done once or upon a timer, that was exceptionnaly boring to see it displayed infinitely without knowing if something changed.
Theses times are now over! bento status will display the current status and wait for a change (new version published, or an host running an update) to display the status again.
if the terminal isn’t interactive, the status is only displayed once. Like in bento status | cat or bento status > status.txt
1.5.0 is out! It’s now using nvd when available to look at the diff of new published versions, otherwise it’s just more efficient.
I’m very happy of Bento, it’s working really well for me, I don’t have to care about updating my machines manually, and on the main server I always exactly know which NixOS version is running on each computer
I’m using NixOS. Right now I use deploy-rs which offers a way to deploy system profiles and home-manager profiles (e.g. homeConfigurations.jdoe = home-manager.lib.homeManagerConfiguration)
New 1.5.1 version, this includes a ready-to-use reboot timer in case the kernel got updated. This is in addition of the REBOOT file used to trigger immediate reboot after a change (it’s exclusive obviously).
edit: new 1.5.2 which uses flake-utils to support all other architectures and not only x86_64-linux
I am wondering if bento is suitable to run on a low powered arm server (like rpi4) to deploy to x86 laptops. You say that it is possible to use the server to built all configurations. But to me it is not clear if the opposite is practical.
You could use bento to publish the configuration and track the remote systems state, without having to build. This was allowed in the last commits IIRC.