Skip to content

Commit

Permalink
manual: Add tutorial on how to use nixos-install with Colmena
Browse files Browse the repository at this point in the history
  • Loading branch information
itslychee committed May 14, 2024
1 parent cd65ef7 commit 07c3aa5
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 0 deletions.
1 change: 1 addition & 0 deletions manual/src/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
- [Tutorial](./tutorial/index.md)
- [Usage with Flakes](./tutorial/flakes.md)
- [Migrating from NixOps/morph](./tutorial/migration.md)
- [Bootstrapping a new install](./tutorial/bootstrapping-a-new-system.md)
- [Features](./features/index.md)
- [Node Tagging](./features/tags.md)
- [Local Deployment](./features/apply-local.md)
Expand Down
44 changes: 44 additions & 0 deletions manual/src/tutorial/bootstrapping-a-new-system.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Bootstrapping a new install

Colmena doesn't support a `nixos-install` like interface out-of-the-box, but you can easily pass the closure that
Colmena builds to `nixos-install` directly!

This tutorial assumes you have SSH access to your live ISO

First, create your partitions and make your filesystems as you normally would, then mount them and run

```sh
nixos-generate-config --root /mnt # replace /mnt to wherever your root filesystem is mounted at
```

Or if you already have a configuration ready, simply output your hardware configuration to the console.
```
nixos-generate-config --root /mnt --show-hardware-config
```

For those using third-party secret management tools like `agenix`, it is necessary to generate your host
keys and make your configuration aware of it before copying the closure to the ISO

```sh
$ mkdir -p /mnt/etc/ssh
$ ssh-keygen -A -f /mnt # replace /mnt with your root filesystem mount
```

After you've adjusted your configuration to fit the needs of the new node, you can go ahead
and build the closure for the new system!

```sh
colmena build --on node --no-build-on-target
```

Copy the closure over to the running live NixOS ISO!
```sh
nix copy /nix/store/myclosure --to ssh://live@iso
```

Finally, you can pass the closure to `nixos-install` to be installed on your new node!
```sh
nixos-install --system /nix/store/myclosure
````

You can proceed with installation as you would normally without using Colmena!

0 comments on commit 07c3aa5

Please sign in to comment.