2019-08-10 12:43:48 +01:00
# nix-community infrastructure
2022-12-03 12:15:01 +10:00
Welcome to the Nix Community infrastructure project. This project holds all the NixOS and Terraform configuration for this organization.
2019-08-10 12:43:48 +01:00
2022-01-16 10:14:40 +01:00
## Community builder
2023-01-02 15:35:39 +10:00
We also provide one x86 hetzner build machine as a public remote builder for the nix community, see [here ](roles/builder/README.MD ) for more information.
2022-02-11 09:51:53 +02:00
2022-05-14 22:18:06 +02:00
## Hydra
2022-12-03 12:15:01 +10:00
If you want to build your project in our hydra, add a new project in this [file ](terraform/hydra-projects.tf ).
2022-05-14 22:18:06 +02:00
2020-05-03 15:10:15 +02:00
## Support
2019-08-12 17:24:59 +00:00
2022-12-03 12:15:01 +10:00
If you hit any issues, ping us on Matrix in the [nix-community ](https://matrix.to/#/#nix-community:nixos.org ) room (see the admin list below) or create an issue here:
2020-05-03 15:10:15 +02:00
[New Issue ](https://github.com/nix-community/infra/issues/new ).
2019-08-12 17:24:59 +00:00
2022-09-27 11:15:08 +10:00
### Pull requests from forks
As PRs from forks don't have automatic CI checks, admins can test PRs by posting a comment on the PR instead.
* `bors try` - check if the PR builds.
* `bors merge` - same as `bors try` but will also merge the PR if it builds successfully.
* https://bors.tech/documentation/
2020-05-03 15:10:15 +02:00
### Administrators
2020-03-26 18:00:49 +01:00
2020-04-02 16:35:03 -07:00
* @adisbladis
2020-03-26 18:00:49 +01:00
* @flokli
* @grahamc
2021-01-18 20:32:29 +00:00
* @Mic92
2020-03-26 18:00:49 +01:00
* @nlewo
* @ryantm
* @zimbatm
2022-10-22 09:53:24 +02:00
* @zowoq
2020-03-26 18:00:49 +01:00
2019-08-12 17:24:59 +00:00
## Services
2022-10-07 12:20:15 +10:00
* https://search.nix-community.org (hound) - on build03
2022-05-14 22:18:06 +02:00
* https://hydra.nix-community.org - on build03
* matterbridge - on build03
2021-03-07 16:28:44 +00:00
* ryantm-updater bot - on build02
2020-05-03 15:10:15 +02:00
## Hosts
2022-10-07 12:20:15 +10:00
### `build01`
2020-05-03 15:10:15 +02:00
This machine is perfect for running heavy builds.
* Provider: Hetzner
* CPU: AMD Ryzen 7 1700X Eight-Core Processor
* RAM: 64GB
2021-01-20 20:23:32 -08:00
* Drives: 2 x 512 GB SATA SSD
### `build02`
This machine currently just runs r-ryantm/nixpkgs-update.
* Provider: Hetzner
* CPU: AMD Ryzen 7 3700X Eight-Core Processor
* RAM: 64GB DDR4 ECC
* Drives: 2 x 1 TB NVME in RAID 1
2020-05-03 15:10:15 +02:00
2021-03-07 16:28:44 +00:00
### `build03`
This machine is a replacement for build01.
* Provider: Hetzner
* CPU: AMD Ryzen 5 3600 6-Core Processor
* RAM: 64GB DDR4 ECC
2021-08-27 18:38:21 +01:00
* Drives: 2 x 512 GB NVME in RAID 1
2021-03-07 16:28:44 +00:00
2021-08-18 08:55:14 +02:00
### `build04`
This machine is meant as an aarch64 builder for our hydra instance running on build03.
* Provider: Oracle cloud
* Instance type: [Ampere A1 Compute ](https://www.oracle.com/cloud/compute/arm/ )
2022-09-27 11:15:08 +10:00
* CPU: 4 VCPUs on an Ampere Altra (arm64)
2021-08-18 08:55:14 +02:00
* RAM: 24GB
* Drives: 200 GB Block
2021-01-20 20:25:19 -08:00
## Cache
All the builds on these machines are pushed to https://nix-community.cachix.org/
2020-05-03 15:10:15 +02:00
Thanks to Cachix for sponsoring our binary cache!
2021-03-07 16:28:44 +00:00
## File hierarchy
2020-05-03 15:10:15 +02:00
2021-03-07 16:28:44 +00:00
* ./build\d+ - build machines
2021-10-03 14:18:57 +02:00
* ./deploy - Deploy script
2021-03-07 16:28:44 +00:00
* ./roles - shared NixOS configuration modules
* ./services - single instances of NixOS services
2020-05-03 15:10:15 +02:00
* ./terraform - Setup DNS
2021-03-07 16:28:44 +00:00
* ./users - NixOS configuration of our admins
2020-05-03 15:10:15 +02:00
2021-03-20 06:17:29 +01:00
## Deployment commands:
```console
$ ./deploy
```
2022-12-03 12:15:01 +10:00
If you want to reboot a machine, use the following command to also deploy secrets afterwards:
2021-03-20 06:17:29 +01:00
```console
2021-10-24 01:43:19 +02:00
$ inv deploy --hosts build02 reboot --hosts build02
2021-03-20 06:17:29 +01:00
```
2021-03-25 09:25:28 +01:00
## Install/Fix system from Hetzner recovery mode
2021-10-24 01:41:22 +02:00
2022-12-19 15:10:26 +01:00
1. Copy your ssh key to the recovery system so that the kexec image can re-use it.
``` console
2022-12-19 15:55:41 +00:00
yourmachine> ssh-copy-id root@build0X .nix-community.org
2022-12-19 15:10:26 +01:00
```
2. Download and boot into kexec-image:
``` console
$ curl -L https://github.com/nix-community/nixos-images/releases/download/nixos-unstable/nixos-kexec-installer-x86_64-linux.tar.gz | tar -xzf- -C /root
$ /root/kexec/run
```
3. Format and/or mount all filesystems to /mnt:
2021-10-24 01:41:22 +02:00
```console
$ inv format-disks --hosts buildXX --disks /dev/nvme0n1,/dev/nvme1n1
2021-05-11 18:46:11 +02:00
```
2021-03-25 09:25:28 +01:00
2022-12-19 15:10:26 +01:00
4. Setup secrets
2021-10-24 01:41:22 +02:00
```console
$ inv setup-secret --hosts buildXX
```
2022-12-19 15:10:26 +01:00
5. Generate configuration and download to the repo
2021-10-24 01:41:22 +02:00
```console
$ nixos-generate-config --root /tmp
2022-12-03 10:11:40 +10:00
# optional, in most cases one can import roles/hetzner/amd.nix
2021-10-24 01:41:22 +02:00
$ scp buildXX.nix-community.org:/tmp/etc/nixos/hardware-configuration.nix buildXX/hardware-configuration.nix
2021-03-25 09:25:28 +01:00
```
2022-12-19 15:10:26 +01:00
6. Build and install
2021-03-25 09:25:28 +01:00
2021-05-12 20:27:38 +02:00
```console
2021-10-24 01:41:22 +02:00
$ inv install-nixos --hosts buildXX
2021-03-25 09:25:28 +01:00
```
2021-05-12 20:27:38 +02:00
### Debug VM
You can start a vm from the rescue system in order to debug the boot:
2021-03-25 09:25:28 +01:00
```console
2021-05-12 20:27:38 +02:00
$ nix-shell -p qemu_kvm --run 'qemu-kvm -m 10G -hda /dev/sda -hdb /dev/sdb -curses -cpu host -enable-kvm'
2021-03-25 09:25:28 +01:00
```