diff --git a/docs/site/getting-started/configure.md b/docs/site/getting-started/configure.md index caca81cc..8c3f0ab2 100644 --- a/docs/site/getting-started/configure.md +++ b/docs/site/getting-started/configure.md @@ -10,7 +10,7 @@ In the `flake.nix` file: ```nix title="clan-core.lib.buildClan" buildClan { - # Set a unique name + # Set a unique name clanName = "Lobsters"; # Should usually point to the directory of flake.nix directory = ./.; @@ -30,7 +30,7 @@ In the `flake.nix` file: ```nix title="clan-core.flakeModules.default" clan = { - # Set a unique name + # Set a unique name clanName = "Lobsters"; machines = { @@ -61,13 +61,13 @@ Adding or configuring a new machine requires two simple steps: ```{.shellSession hl_lines="6" .no-copy} NAME ID-LINK FSTYPE SIZE MOUNTPOINT - sda usb-ST_16GB_AA6271026J1000000509-0:0 14.9G - ├─sda1 usb-ST_16GB_AA6271026J1000000509-0:0-part1 1M + sda usb-ST_16GB_AA6271026J1000000509-0:0 14.9G + ├─sda1 usb-ST_16GB_AA6271026J1000000509-0:0-part1 1M ├─sda2 usb-ST_16GB_AA6271026J1000000509-0:0-part2 vfat 100M /boot └─sda3 usb-ST_16GB_AA6271026J1000000509-0:0-part3 ext4 2.9G / - nvme0n1 nvme-eui.e8238fa6bf530001001b448b4aec2929 476.9G - ├─nvme0n1p1 nvme-eui.e8238fa6bf530001001b448b4aec2929-part1 vfat 512M - ├─nvme0n1p2 nvme-eui.e8238fa6bf530001001b448b4aec2929-part2 ext4 459.6G + nvme0n1 nvme-eui.e8238fa6bf530001001b448b4aec2929 476.9G + ├─nvme0n1p1 nvme-eui.e8238fa6bf530001001b448b4aec2929-part1 vfat 512M + ├─nvme0n1p2 nvme-eui.e8238fa6bf530001001b448b4aec2929-part2 ext4 459.6G └─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: ```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 diff --git a/pkgs/clan-cli/clan_cli/machines/__init__.py b/pkgs/clan-cli/clan_cli/machines/__init__.py index 5851d37a..bad8706f 100644 --- a/pkgs/clan-cli/clan_cli/machines/__init__.py +++ b/pkgs/clan-cli/clan_cli/machines/__init__.py @@ -67,10 +67,13 @@ Examples: generate_hw_parser = subparser.add_parser( "hw-generate", 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=( """ -This subcommand generates hardware specifics for a machine. Such as the host platform, available kernel modules, etc. - Examples: $ 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", help="Install a machine", description=""" - Install a configured machine over the network. - The target must be a Linux based system reachable via SSH. - Installing a machine means overwriting the target's disk. +Install a configured machine over the network. +The target must be a Linux based system reachable via SSH. +Installing a machine means overwriting the target's disk. """, epilog=( """ diff --git a/templates/new-clan/machines/jon/hardware-configuration.nix b/templates/new-clan/machines/jon/hardware-configuration.nix index e4db1a9f..bade5e92 100644 --- a/templates/new-clan/machines/jon/hardware-configuration.nix +++ b/templates/new-clan/machines/jon/hardware-configuration.nix @@ -4,7 +4,11 @@ throw '' Run the following command: + 'clan machines hw-generate ' + + OR: + 'ssh root@ 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". ''