Compare commits

..

2 commits

Author SHA1 Message Date
84eec7a399
gitignore result/ folder
This folder is usually added by `nix build` commands and is also
always a symlink into the nix store.
There is no point in ever adding it to git so to prevent mistakes,
we ignore it.
2025-02-10 17:50:24 +01:00
fcb5b203c7
add switch_remote.sh script and update docs accordingly 2025-02-10 17:49:45 +01:00
3 changed files with 25 additions and 1 deletions

1
.gitignore vendored
View file

@ -1 +1,2 @@
.direnv .direnv
result

View file

@ -78,5 +78,14 @@ See [sops-nix](https://github.com/Mic92/sops-nix)
## VM Configuration ## VM Configuration
**TODO** Any NixOS VM can be reconfigured remotely by calling:
```bash
./switch_remote.sh <action> <machine>`
```
- `<action>` can be any of the [standard nixos-rebuild actions](https://wiki.nixos.org/wiki/Nixos-rebuild), e.g. `boot`, `switch`, etc.
- `<macine>` should be the FQDN of the machine config to apply.
The script uses this argument to know how to reach the machine in addition to choosing a nixos configuration from this flake as system source (see [systems/](./systems/)).
This also means that you should have a config entry in you SSH config resolving the system name to an IP address (during the event, we will probably have an internal DNS server which also resolves the hostname).

14
switch_remote.sh Executable file
View file

@ -0,0 +1,14 @@
#/usr/bin/env bash
# a small script for calling nixos-rebuild switch on a remote host but with less repitition
set -euo pipefail
ACTION=$1
HOST=$2
exec nixos-rebuild $ACTION \
--use-substitutes \
--no-build-nix \
--use-remote-sudo \
--build-host "$HOST" \
--target-host "$HOST" \
--flake ".#$HOST" \