Docs: update machine hardware config instructions #1625

Merged
clan-bot merged 1 commits from hsjobeki/clan-core:hsjobeki-main into main 2024-06-15 20:30:51 +00:00
3 changed files with 29 additions and 15 deletions

View File

@ -10,7 +10,7 @@ In the `flake.nix` file:
```nix title="clan-core.lib.buildClan" ```nix title="clan-core.lib.buildClan"
buildClan { buildClan {
# Set a unique name # Set a unique name
clanName = "Lobsters"; clanName = "Lobsters";
# Should usually point to the directory of flake.nix # Should usually point to the directory of flake.nix
directory = ./.; directory = ./.;
@ -30,7 +30,7 @@ In the `flake.nix` file:
```nix title="clan-core.flakeModules.default" ```nix title="clan-core.flakeModules.default"
clan = { clan = {
# Set a unique name # Set a unique name
clanName = "Lobsters"; clanName = "Lobsters";
machines = { machines = {
@ -61,13 +61,13 @@ Adding or configuring a new machine requires two simple steps:
```{.shellSession hl_lines="6" .no-copy} ```{.shellSession hl_lines="6" .no-copy}
NAME ID-LINK FSTYPE SIZE MOUNTPOINT NAME ID-LINK FSTYPE SIZE MOUNTPOINT
sda usb-ST_16GB_AA6271026J1000000509-0:0 14.9G sda usb-ST_16GB_AA6271026J1000000509-0:0 14.9G
├─sda1 usb-ST_16GB_AA6271026J1000000509-0:0-part1 1M ├─sda1 usb-ST_16GB_AA6271026J1000000509-0:0-part1 1M
├─sda2 usb-ST_16GB_AA6271026J1000000509-0:0-part2 vfat 100M /boot ├─sda2 usb-ST_16GB_AA6271026J1000000509-0:0-part2 vfat 100M /boot
└─sda3 usb-ST_16GB_AA6271026J1000000509-0:0-part3 ext4 2.9G / └─sda3 usb-ST_16GB_AA6271026J1000000509-0:0-part3 ext4 2.9G /
nvme0n1 nvme-eui.e8238fa6bf530001001b448b4aec2929 476.9G nvme0n1 nvme-eui.e8238fa6bf530001001b448b4aec2929 476.9G
├─nvme0n1p1 nvme-eui.e8238fa6bf530001001b448b4aec2929-part1 vfat 512M ├─nvme0n1p1 nvme-eui.e8238fa6bf530001001b448b4aec2929-part1 vfat 512M
├─nvme0n1p2 nvme-eui.e8238fa6bf530001001b448b4aec2929-part2 ext4 459.6G ├─nvme0n1p2 nvme-eui.e8238fa6bf530001001b448b4aec2929-part2 ext4 459.6G
└─nvme0n1p3 nvme-eui.e8238fa6bf530001001b448b4aec2929-part3 swap 16.8G └─nvme0n1p3 nvme-eui.e8238fa6bf530001001b448b4aec2929-part3 swap 16.8G
``` ```
@ -150,10 +150,17 @@ These steps will allow you to update your machine later.
Generate the `hardware-configuration.nix` file for your machine by executing the following command: Generate the `hardware-configuration.nix` file for your machine by executing the following command:
```bash ```bash
ssh root@flash-installer.local nixos-generate-config --no-filesystems --show-hardware-config > machines/jon/hardware-configuration.nix clan machines hw-generate [MACHINE_NAME] [HOSTNAME]
``` ```
This command connects to `flash-installer.local` as `root`, runs `nixos-generate-config` to detect hardware configurations (excluding filesystems), and writes them to `machines/jon/hardware-configuration.nix`. replace `[MACHINE_NAME]` with the name of the machine i.e. `jon` and `[HOSTNAME]` with the `ip_adress` or `hostname` of the machine within the network. i.e. `flash-installer.local`
!!! Example
```bash
clan machines hw-generate jon flash-installer.local
```
This command connects to `flash-installer.local` as `root`, runs `nixos-generate-config` to detect hardware configurations (excluding filesystems), and writes them to `machines/jon/hardware-configuration.nix`.
### Step 3: Custom Disk Formatting ### Step 3: Custom Disk Formatting

View File

@ -67,10 +67,13 @@ Examples:
generate_hw_parser = subparser.add_parser( generate_hw_parser = subparser.add_parser(
"hw-generate", "hw-generate",
help="Generate hardware specifics for a machine", help="Generate hardware specifics for a machine",
description="""
Generates hardware specifics for a machine. Such as the host platform, available kernel modules, etc.
The target must be a Linux based system reachable via SSH.
""",
epilog=( epilog=(
""" """
This subcommand generates hardware specifics for a machine. Such as the host platform, available kernel modules, etc.
Examples: Examples:
$ clan machines hw-generate [MACHINE] [TARGET_HOST] $ clan machines hw-generate [MACHINE] [TARGET_HOST]
@ -98,9 +101,9 @@ This subcommand shows the details of a machine managed by this clan like icon, d
"install", "install",
help="Install a machine", help="Install a machine",
description=""" description="""
Install a configured machine over the network. Install a configured machine over the network.
The target must be a Linux based system reachable via SSH. The target must be a Linux based system reachable via SSH.
Installing a machine means overwriting the target's disk. Installing a machine means overwriting the target's disk.
""", """,
epilog=( epilog=(
""" """

View File

@ -4,7 +4,11 @@ throw ''
Run the following command: Run the following command:
'clan machines hw-generate <maschine_name> <hostname>'
OR:
'ssh root@<hostname> nixos-generate-config --no-filesystems --show-hardware-config > hardware-configuration.nix' 'ssh root@<hostname> nixos-generate-config --no-filesystems --show-hardware-config > hardware-configuration.nix'
Then replace this file with the generated "hardware-configuration.nix". And manually eplace this file with the generated "hardware-configuration.nix".
'' ''