Here is the typical directory layout for using bento for the non-flakes system router, a single flake my-laptop for the system t470, and a flake with multiples configuration in all-flakes-systems:
├── hosts
│ ├── router
│ │ ├── configuration.nix
│ │ ├── hardware-configuration.nix
│ │ └── utils -> ../../utils/
│ ├── all-flakes-systems
│ │ ├── configuration.nix
│ │ ├── flake.lock
│ │ ├── flake.nix
│ │ ├── hardware-configuration.nix
│ │ └── utils -> ../../utils/
│ └── my-laptop
│ ├── configuration.nix
│ ├── default-spec.nix
│ ├── flake.lock
│ ├── flake.nix
│ ├── hardware-configuration.nix
│ ├── home.nix
│ ├── minecraft.nix
│ ├── nfs.nix
│ ├── nvidia.nix
│ └── utils -> ../../utils/
├── README.md
└── utils
└── bento.nix
└── common-stuff.nix
└── fleet.nix
- make configuration changes per host in
hosts/or a global include file inutils(you can rename it as you wish) - run
sudo bento deployto verify, build every system, and publish the configuration files on the SFTP server - hosts will pickup changes and run a rebuild
bento init- copy the configuration file of the server in a subdirectory of
hosts, addfleet.nixto it - add keys to
fleet.nix - run
bento deployas root - follow deployment with
bento status - add new hosts keys to
fleet.nixand their configuration in yourhostsdirectory
Here are the steps to add a server named kikimora to bento:
- generate a ssh-key on
kikimorafor root user - add kikimora's public key to bento
fleet.nixfile - reconfigure the ssh host to allow kikimora's key (it should include the
fleet.nixfile) - copy kikimora's config (usually
/etc/nixos/) in bentohosts/kikimora/directory - add utils/bento.nix to its config (in
hosts/kikimorarunln -s ../../utils .and add./utils/bento.nixinimportslist) - check kikimora's config locally with
bento build dry-build, you can check onlykikimorawithenv NAME=kikimora bento build dry-build - populate the chroot with
sudo bento deployto copy the files in/home/chroot/kikimora/config/ - run bootstrap script on kikimora to switch to the new configuration from sftp and enable the timer to poll for upgrades
- you can get bento's log with
journalctl -u bento-upgrade.serviceand see next timer information withsystemctl status bento-upgrade.timer
Here are the steps to deploy a change in a host managed with bento
- edit its configuration file to make the changes in
hosts/the_host_name/something.nix - run
sudo bento deployto build and publish configuration files - wait for the timer of that system to trigger the update, or ask the user to open http://localhost:51337/ to force the update
If you don't want to wait for the timer, you can ssh into the machine to run systemctl start bento-upgrade.service
As each host is sending a log upon rebuild to tell if it failed or succeeded, the files are used to check what happened since the sftp file last_time_changed was created.
Using bento status you can track the current state of each hosts (time since last update, current NixOS version, status report).
Bento will display the current state of the fleet, and wait for a change in the chroot directory to display the status again.
With bento flake-update you can easily update your flakes recursively to the latest version.
A parameter can be added to only update a given source with, i.e to update all nixpkgs in the flakes bento flake-update nixpkgs.
With env NAME=my-laptop bento diff you can display the differences of packages between what my-laptop is running and its new version.
The output should look like this:
Changes in x1 between p50qql7f42rl0fccdwxw45k21pnqb9ii-nixos-system-x1-22.11.20220921.d6490a0 and 7zfxxddmg8l6qc6bksar5gm62ylwsdv5-nixos-system-x1-22.11.20220927.7e52b35
bind: 9.18.6 → 9.18.7
cpupower: 5.19.9, 5.19.9_fish → 5.19.11, 5.19.11_fish
gh: 2.15.0, 2.15.0_fish → 2.16.1, 2.16.1_fish
imagemagick: 7.1.0-48 → 7.1.0-49, +18.0 KiB
initrd-linux: 5.19.9 → 5.19.11
libblockdev: 2.26 → 2.28
libbytesize: 2.6 → 2.7
libdmtx: 0.7.5 → 0.7.7
linux: 5.19.9, 5.19.9-modules → 5.19.11, 5.19.11-modules, +126.6 KiB
man: -11.8 KiB
nixos: +12.5 KiB
nixos-system-x1: 22.11.20220921.d6490a0 → 22.11.20220927.7e52b35
opencv: 4.5.4 → 4.6.0, +1901.6 KiB
plasma-workspace: +62.4 KiB
root-authorized_keys: ∅ → ε
source: +701.9 KiB
systemsettings: +62.6 KiB
-------------
It's possible to use bento in a push model using TARGET_IP:
env TARGET_IP=10.43.43.1 NAME=myserver bento build switch
If the remote system is using a non-standard port, you need to define the according ssh option with NIX_SSHOPTS:
env NIX_SSHOPTS="-p2222" TARGET_IP=10.43.43.1 NAME=laptop bento build switch