chore(doc): get rid of stupid blurb, add deployment script to docs
All checks were successful
/ build-host (map[host:beefcake]) (push) Successful in 35s
/ build-host (map[host:dragon]) (push) Successful in 43s
/ build-host (map[host:flipflop]) (push) Successful in 38s
/ build-host (map[host:foxtrot]) (push) Successful in 44s
/ build-host (map[host:rascal]) (push) Successful in 7s
/ build-host (map[host:router]) (push) Successful in 29s
/ build-devshell (push) Successful in 18s
/ flake-check (push) Successful in 4m44s

This commit is contained in:
Daniel Flanagan 2025-03-25 21:47:08 -05:00
parent 7b1518042c
commit c3d33a2d39
2 changed files with 3 additions and 67 deletions

View file

@ -9,57 +9,10 @@ $ mkdir -p ${XDG_CONFIG_HOME:-~/.config}/sops/age
$ pass age-key >> ${XDG_CONFIG_HOME:-~/.config}/sops/age/keys.txt $ pass age-key >> ${XDG_CONFIG_HOME:-~/.config}/sops/age/keys.txt
``` ```
# Updates # Update Remote Hosts
**NOTE**: I want to establish a solid way to do this without `root@`. ```shell
$ , deploy .
**TODO**: This could easily be wrapped up in a `nix run github:lytedev/nix#install` or something with fuzzy-finders for the variable options.
**TODO**: could also probably get some helpers baked into an ISO?
```fish
g a; set host beefcake; nix run nixpkgs#nixos-rebuild -- --flake ".#$host" \
--target-host "root@$host" --build-host "root@$host" \
switch --show-trace
```
## Safer Method
```bash
# make sure all files are at least staged so nix flakes will see them
git add -A
# initialize a delayed reboot by a process you can kill later if things look good
# note that the amount of time you give it probably needs to be enough time to both complete the upgrade
# _and_ perform whatever testing you need
host=your_host
ssh -t "root@$host" "bash -c '
set -m
# sleep 30 mins
(sleep 1800; reboot;) &
jobs -p
bg
disown
'"
# build the system and start running it, but do NOT set the machine up to boot to that system yet
# we will test things and make sure it works first
# if it fails, the reboot we started previously will automatically kick in once the timeout is reached
# and the machine will boot to the now-previous iteration
nix run nixpkgs#nixos-rebuild -- --flake ".#$host" \
--target-host "root@$host" --build-host "root@$host" \
test --show-trace
# however you like, verify the system is running as expected
# if it is, run the same command with "switch" instead of "test"
# otherwise, we will wait until the machine reboots back into the
# this is crude, but should be pretty foolproof
# the main gotcha is that the system is already unbootable or non-workable, but
# if you always use this method, that should be an impossible state to get into
# if we still have ssh access and the machine fails testing, just rollback
# instead of waiting for the reboot
ssh "root@$host" nixos-rebuild --rollback switch
``` ```
# Provisioning New NixOS Hosts # Provisioning New NixOS Hosts

View file

@ -10,20 +10,3 @@ Nix for <code>lytedev</code>
[NixOS Modules](./lib/modules/nixos/default.nix) - [Home Manager Modules](./lib/modules/home/default.nix) - [Desktop](./packages/hosts/dragon.nix) - [Laptop](./packages/hosts/foxtrot.nix) - [Server](./packages/hosts/beefcake.nix) - [Router](./packages/hosts/router.nix) - [Packages](./packages/default.nix) - [Templates](./lib/templates/default.nix) - [Docs](./lib/doc) [NixOS Modules](./lib/modules/nixos/default.nix) - [Home Manager Modules](./lib/modules/home/default.nix) - [Desktop](./packages/hosts/dragon.nix) - [Laptop](./packages/hosts/foxtrot.nix) - [Server](./packages/hosts/beefcake.nix) - [Router](./packages/hosts/router.nix) - [Packages](./packages/default.nix) - [Templates](./lib/templates/default.nix) - [Docs](./lib/doc)
</div> </div>
# Details
I aim for declaring everything where possible, but I definitely break the rules
if it's convenient enough and try to write it down when I do so. I also don't
like repeating myself in configuration. I am mostly focused on being pragmatic
and getting things done and doing so in a way that makes it easy to keep doing
so (maintainability), but I also occasionally fall into experimenting with big
refactors of the code for no real gain.
## Layers
- Common defaults (machines that I might not interact with at all or only
rarely, such as backup targets)
- Machines that I interact with only remotely (`shell` class)
- Machines that I interact with directly, such as a laptop or my desktop
workstation (`desktop` class)