clan-core/docs/admins/quickstart.md

77 lines
3.0 KiB
Markdown
Raw Normal View History

2024-04-05 16:03:14 +00:00
# **Quick Start Guide to Initializing a New Clan Project**
2023-08-30 11:51:08 +00:00
2024-04-05 16:03:14 +00:00
This guide will lead you through initiating a new Clan project
2023-08-30 11:51:08 +00:00
2024-04-05 16:03:14 +00:00
## **Overview**
2023-08-30 11:51:08 +00:00
2024-04-05 16:03:14 +00:00
Dive into our structured guide tailored to meet your needs:
2023-08-30 11:51:08 +00:00
2024-04-05 16:03:14 +00:00
- [**Starting with a New Clan Project**](#starting-with-a-new-clan-project): Kickstart your journey with Clan by setting up a new project from the ground up.
- [**Migrating Existing Flake Configuration**](migrate.md#migrating-existing-nixos-configuration-flake): Transition your existing flake-based Nix configuration to harness the power of Clan Core.
- [**Integrating Clan using Flake-Parts**](./migrate.md#integrating-clan-with-flakes-using-flake-parts): Enhance your Clan experience by integrating it with Flake-Parts.
2023-08-30 11:51:08 +00:00
---
2024-04-05 16:03:14 +00:00
## **Starting with a New Clan Project**
2023-08-30 13:25:20 +00:00
2024-04-05 16:03:14 +00:00
Embark on your Clan adventure with these initial steps:
2023-08-30 13:25:20 +00:00
2024-04-05 16:03:14 +00:00
### **Step 1: Add Clan CLI to Your Shell**
Incorporate the Clan CLI into your development workflow with this simple command:
```shell
nix shell git+https://git.clan.lol/clan/clan-core
2024-04-04 13:05:08 +00:00
```
2024-04-05 16:03:14 +00:00
### **Step 2: Initialize Your Project**
Set the foundation of your Clan project by initializing it as follows:
```shell
clan flakes create my-clan
```
This command crafts the essential `flake.nix` and `.clan-flake` files for your project.
2024-04-04 13:05:08 +00:00
2024-04-05 16:03:14 +00:00
### **Step 3: Verify the Project Structure**
Ensure the creation of your project files with a quick directory listing:
```shell
cd my-clan && ls -la
2024-04-04 13:05:08 +00:00
```
2024-04-05 16:03:14 +00:00
Look for `.clan-flake`, `flake.lock`, and `flake.nix` among your files to confirm successful setup.
2024-04-04 13:05:08 +00:00
2024-04-05 16:03:14 +00:00
### **Understanding `.clan-flake`**
The `.clan-flake` file, while optional, is instrumental in helping the Clan CLI identify your project's root directory, easing project management.
2024-04-04 13:05:08 +00:00
2024-04-07 19:07:02 +00:00
### Edit Flake.nix
Open the `flake.nix` file and set a unique `clanName` if you want you can also set an optional `clanIcon` or even a per `machineIcon`. These will be used by our future clan GUI.
### Remote into the target machine
**Right now clan assumes that you already have NixOS running on the target machine.**
If that is not the case you can use our [installer image](./install-iso.md) that automatically generates an endpoint reachable over TOR with a random ssh password.
On the remote execute:
1. Generate a hardware-config.nix
```bash
nixos-generate-config --root /etc/nixos --no-filesystems
```
2. Copy it over and put it into you `machines/jon/hardware-config.nix` folder
```bash
scp -r root@<jon-ip>:/etc/nixos/hardware-config.nix ./machines/jon
```
3. Find the remote disk id by executing on the remote:
```bash
lsblk --output NAME,ID-LINK,FSTYPE,SIZE,MOUNTPOINT
2024-04-07 19:07:02 +00:00
```
4. Edit the following fields inside the `flake.nix`
- `clan.networking.targetHost = pkgs.lib.mkDefault "root@<IP_ADDRESS>";`
- `clan.diskLayouts.singleDiskExt4 = {
device = "/dev/disk/by-id/__CHANGE_ME__";
};`
5. Generate secrets used by clan modules by executing
```bash
clan facts generate
```
2024-04-05 16:03:14 +00:00
### **Next Steps**
2024-04-07 19:07:02 +00:00
Ready to expand? Explore how to install a new machine with the helpful documentation [here](./machines.md).
2024-04-04 13:05:08 +00:00
2024-04-05 16:03:14 +00:00
---