README: add deploy-flake.sh for non-nixos users
This commit is contained in:
parent
f2fc6a1762
commit
427e4ede0d
10
README.md
10
README.md
|
@ -46,7 +46,17 @@ for example: `nix run c3d2#glotzbert-nixos-rebuild switch`. Use `nix flake show
|
|||
to show what is available. Note that the deploy scripts only work if
|
||||
the target machines already has flakes enabled.
|
||||
|
||||
### Remote deployment from non-NixOS
|
||||
|
||||
A shell script that copies the current working tree, and runs
|
||||
`nixos-rebuild switch` on the target:
|
||||
|
||||
```shell
|
||||
./deploy-flake.sh hydra.hq.c3d2.de
|
||||
```
|
||||
|
||||
It cannot not lookup hostnames in `host-registry.nix`.
|
||||
It will not take extra care of the *secrets*.
|
||||
|
||||
## Mit NixOps
|
||||
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
|
||||
TARGET=$1
|
||||
if [ -z "$TARGET" ]; then
|
||||
echo "Usage: $0 <host.hq.c3d2.de>"
|
||||
exit 1
|
||||
fi
|
||||
HOSTNAME=$(echo $TARGET|cut -d . -f 1)
|
||||
|
||||
rsync -az $(dirname $0) root@$TARGET:nix-config
|
||||
|
||||
echo "$HOSTNAME> nixos-rebuild switch"
|
||||
exec ssh root@$TARGET "nixos-rebuild --flake ./nix-config#$HOSTNAME switch"
|
Loading…
Reference in New Issue