#!/bin/sh -eux
cd "${0%/*}"
-chmod -R g-rwx,o-rwx "$PWD/private/root"
-trap 'git reset private/root' EXIT
-git rm -rf --cached --ignore-unmatch private/root # prevent copying to /nix/store
-time nix -L build .\#nixosConfigurations."$1".config.system.build.toplevel
+host=$1
+shift
+time nix -L build --keep-going "$@" -o hosts/"$host".root .\#nixosConfigurations."$host".config.system.build.toplevel