Hi, I’m currently using a script to update my various NixOS hosts from a central machine, using the nh utility (https://github.com/nix-community/nh). By default, the command nh os switch . -H "..." --target-host "..."
outputs the dependency graph of the build, as well as all the build logs. I like the dependency graph, however the build logs tend to push the diff result of the previous builds off of the terminal screen, so I have to watch the whole time in case I miss it. I’ve tried using the --no-nom
flag, however this removed the dependency graph also. Is there a way in bash of selectively suppressing the build logs but not the dependency graph? Or is this an issue to raise with the project itself? The full bash script I’m using is shown below:
#!/usr/bin/env bash
# From: https://discourse.nixos.org/t/deploy-nixos-configurations-on-other-machines/22940/8
hosts=($(echo `nix eval .#nixosConfigurations --apply 'pkgs: builtins.concatStringsSep " " (builtins.attrNames pkgs)'` | xargs ))
skip=(
"..."
)
rsa_key="$HOME/.config/sops-nix/secrets/keys/nixos-deploy-key"
export NIX_SSHOPTS="-t -i $rsa_key"
for host in "${hosts[@]}"
do
# Check if the host is in the skip list
if [[ " ${skip[*]} " =~ " ${host} " ]];then
continue
fi
fqdn="$host"
echo " ### $fqdn ### "
echo
initDir=($(ssh -i $rsa_key $host "readlink /run/current-system"))
# Build config and list changes
nh os switch . -H "$host" --target-host "deploy@$fqdn"
ssh -i $rsa_key $host "nvd diff $initDir /run/current-system"
echo
done
Any help is greatly appreciated, thanks!