2024-05-18 21:18:02 +00:00
|
|
|
# Setup
|
2023-08-30 11:51:08 +00:00
|
|
|
|
2024-05-17 14:07:09 +00:00
|
|
|
Create your own clan with these initial steps and manage a fleet of machines with one single testable git repository!
|
2024-04-10 09:11:22 +00:00
|
|
|
|
|
|
|
### Prerequisites
|
|
|
|
|
2024-05-07 13:45:38 +00:00
|
|
|
=== "**Linux**"
|
2024-04-10 09:11:22 +00:00
|
|
|
|
2024-05-07 13:45:38 +00:00
|
|
|
Clan depends on nix installed on your system. Run the following command to install nix.
|
2024-04-10 09:11:22 +00:00
|
|
|
|
2024-05-07 13:45:38 +00:00
|
|
|
```bash
|
|
|
|
curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- install
|
|
|
|
```
|
2024-04-10 09:11:22 +00:00
|
|
|
|
2024-05-07 13:45:38 +00:00
|
|
|
=== "**NixOS**"
|
2024-04-10 09:11:22 +00:00
|
|
|
|
2024-05-07 13:45:38 +00:00
|
|
|
If you run NixOS the `nix` binary is already installed.
|
2024-04-10 09:11:22 +00:00
|
|
|
|
2024-05-07 13:45:38 +00:00
|
|
|
You will also need to enable the `flakes` and `nix-commands` experimental features.
|
2024-04-10 09:11:22 +00:00
|
|
|
|
2024-05-07 13:45:38 +00:00
|
|
|
```bash
|
|
|
|
# /etc/nix/nix.conf or ~/.config/nix/nix.conf
|
|
|
|
experimental-features = nix-command flakes
|
|
|
|
```
|
2024-04-10 09:11:22 +00:00
|
|
|
|
2024-05-07 13:45:38 +00:00
|
|
|
=== "**Other**"
|
2024-04-10 09:11:22 +00:00
|
|
|
|
2024-05-07 13:45:38 +00:00
|
|
|
Clan doesn't offer dedicated support for other operating systems yet.
|
2024-04-10 09:11:22 +00:00
|
|
|
|
|
|
|
### Step 1: Add Clan CLI to Your Shell
|
|
|
|
|
|
|
|
Add the Clan CLI into your development workflow:
|
2024-04-09 07:17:20 +00:00
|
|
|
|
2024-04-13 14:35:16 +00:00
|
|
|
```bash
|
2024-04-13 10:08:35 +00:00
|
|
|
nix shell git+https://git.clan.lol/clan/clan-core#clan-cli
|
2024-04-04 13:05:08 +00:00
|
|
|
```
|
|
|
|
|
2024-05-07 13:34:56 +00:00
|
|
|
You can find reference documentation for the `clan` cli program [here](./reference/cli/index.md).
|
|
|
|
|
2024-05-07 18:45:09 +00:00
|
|
|
Alternatively you can check out the help pages directly:
|
|
|
|
```terminalSession
|
|
|
|
clan --help
|
|
|
|
```
|
|
|
|
|
2024-04-09 07:17:20 +00:00
|
|
|
### Step 2: Initialize Your Project
|
|
|
|
|
2024-04-13 10:09:40 +00:00
|
|
|
Set the foundation of your Clan project by initializing it as follows:
|
2024-04-09 07:17:20 +00:00
|
|
|
|
2024-04-13 14:35:16 +00:00
|
|
|
```bash
|
2024-04-05 16:03:14 +00:00
|
|
|
clan flakes create my-clan
|
|
|
|
```
|
2024-04-04 13:05:08 +00:00
|
|
|
|
2024-04-09 07:17:20 +00:00
|
|
|
This command creates the `flake.nix` and `.clan-flake` files for your project.
|
2024-05-07 13:45:38 +00:00
|
|
|
It will also generate files from a default template, to help show general clan usage patterns.
|
2024-04-09 07:17:20 +00:00
|
|
|
|
|
|
|
### Step 3: Verify the Project Structure
|
|
|
|
|
2024-04-13 13:53:12 +00:00
|
|
|
Ensure that all project files exist by running:
|
2024-04-09 07:17:20 +00:00
|
|
|
|
2024-04-13 13:53:12 +00:00
|
|
|
```bash
|
2024-04-23 18:52:41 +00:00
|
|
|
cd my-clan
|
2024-04-13 13:53:12 +00:00
|
|
|
tree
|
|
|
|
```
|
|
|
|
|
2024-04-13 13:55:15 +00:00
|
|
|
This should yield the following:
|
2024-04-13 13:53:12 +00:00
|
|
|
|
2024-04-14 09:45:20 +00:00
|
|
|
``` { .console .no-copy }
|
2024-04-13 13:53:12 +00:00
|
|
|
.
|
|
|
|
├── flake.nix
|
|
|
|
├── machines
|
|
|
|
│ ├── jon
|
|
|
|
│ │ ├── configuration.nix
|
|
|
|
│ │ └── hardware-configuration.nix
|
|
|
|
│ └── sara
|
|
|
|
│ ├── configuration.nix
|
|
|
|
│ └── hardware-configuration.nix
|
|
|
|
└── modules
|
|
|
|
└── shared.nix
|
|
|
|
|
|
|
|
5 directories, 6 files
|
2024-04-04 13:05:08 +00:00
|
|
|
```
|
|
|
|
|
2024-04-13 15:46:07 +00:00
|
|
|
```bash
|
|
|
|
clan machines list
|
|
|
|
```
|
|
|
|
|
2024-04-14 09:45:20 +00:00
|
|
|
``` { .console .no-copy }
|
2024-04-13 15:46:07 +00:00
|
|
|
jon
|
|
|
|
sara
|
|
|
|
```
|
|
|
|
|
2024-04-13 13:53:12 +00:00
|
|
|
!!! success
|
|
|
|
|
|
|
|
You just successfully bootstrapped your first clan directory.
|
2024-04-09 07:17:20 +00:00
|
|
|
|
|
|
|
---
|
|
|
|
|
2024-04-13 13:53:12 +00:00
|
|
|
### What's Next?
|
|
|
|
|
2024-04-13 15:46:07 +00:00
|
|
|
- [**Installer**](getting-started/installer.md): Setting up new computers remotely is easy with an USB stick.
|
2024-04-09 07:17:20 +00:00
|
|
|
|
2024-04-05 16:03:14 +00:00
|
|
|
---
|