project-wide: nyx removed, README update

This commit is contained in:
kat witch 2021-04-04 23:00:19 +01:00
parent 2b258b083f
commit 6fb326015e
No known key found for this signature in database
GPG key ID: 1B477797DCA5EC72
2 changed files with 2 additions and 54 deletions

View file

@ -1,10 +1,4 @@
# kat's nixfiles # kat's nixfiles
To provision a new host: * `nix run -f . deploy.target.<target name>.run.apply`
* `nix run -f . deploy.target.<target name>.run -c terraform destroy`
* create a config for that host that contains a deploy.ssh.host
* run `./nyx install <hostname>`.
To rebuild a host:
* run `./nyx deploy <hostname> <method>` where method is optional, can be... switch or boot or such.

46
nyx
View file

@ -1,46 +0,0 @@
#!/usr/bin/env bash
set -eu
usage() {
echo example: $0 build samhain boot
}
eval_setup() {
HOST=$1
if [ $# -gt 2 ]; then
METHOD=$2
else
METHOD="switch"
fi
}
cmd_deploy() {
eval_setup $@
bash <(nix eval --raw deploy.${HOST} -f .) ${METHOD}
}
cmd_debug() {
eval_setup $@
nix eval --raw deploy.$HOST -f .
}
cmd_install() {
HOST=$1
nix build -f . hosts.$HOST.config.system.build.toplevel
CLOSURE=$(readlink result)
nix-store --export $(nix-store -qR ./result) | ssh root@$HOST nix-store --import --store /mnt
ssh root@$HOST nixos-install --system $CLOSURE
}
main() {
if [ $# -lt 2 ]; then
usage
else
CMD=$1
shift
cmd_$CMD $@
fi
}
main "$@"