docs: improve template

This commit is contained in:
Johannes Kirschbauer
2024-04-13 15:53:12 +02:00
parent 8011874233
commit ee974d268a
5 changed files with 224 additions and 51 deletions

View File

@@ -60,17 +60,42 @@ This command creates the `flake.nix` and `.clan-flake` files for your project.
### Step 3: Verify the Project Structure ### Step 3: Verify the Project Structure
Ensure the creation of your project files with a quick directory listing Ensure that all project files exist by running:
```shell ```bash
cd my-clan && ls -la tree
``` ```
You should see `.clan-flake`, `flake.lock`, and `flake.nix` among the files listed, which means you're set up! This should yield this:
```bash
.
├── flake.nix
├── machines
│   ├── jon
│   │   ├── configuration.nix
│   │   └── hardware-configuration.nix
│   └── sara
│   ├── configuration.nix
│   └── hardware-configuration.nix
└── modules
└── shared.nix
5 directories, 6 files
```
!!! success
You just successfully bootstrapped your first clan directory.
--- ---
### Next Steps ### What's Next?
- [**Deploy Machines**](./getting-started/machines.md): Learn how to deploy to any remote machine.
- **Machine Configuration**: Declare behavior and configuration of machines.
---
### Edit Flake.nix ### Edit Flake.nix

174
templates/new-clan/flake.lock generated Normal file
View File

@@ -0,0 +1,174 @@
{
"nodes": {
"clan-core": {
"inputs": {
"disko": "disko",
"flake-parts": "flake-parts",
"nixos-generators": "nixos-generators",
"nixpkgs": "nixpkgs",
"sops-nix": "sops-nix",
"treefmt-nix": "treefmt-nix"
},
"locked": {
"lastModified": 1713013053,
"narHash": "sha256-ka9INCWd1jTPlK47gcuf1hrdPL7WcZ4UrN/bFHBCldU=",
"ref": "refs/heads/main",
"rev": "579994aea61b92d359d532a9cdc22fe4c4581c39",
"revCount": 2536,
"type": "git",
"url": "https://git.clan.lol/clan/clan-core"
},
"original": {
"type": "git",
"url": "https://git.clan.lol/clan/clan-core"
}
},
"disko": {
"inputs": {
"nixpkgs": [
"clan-core",
"nixpkgs"
]
},
"locked": {
"lastModified": 1712356478,
"narHash": "sha256-kTcEtrQIRnexu5lAbLsmUcfR2CrmsACF1s3ZFw1NEVA=",
"owner": "nix-community",
"repo": "disko",
"rev": "0a17298c0d96190ef3be729d594ba202b9c53beb",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "disko",
"type": "github"
}
},
"flake-parts": {
"inputs": {
"nixpkgs-lib": [
"clan-core",
"nixpkgs"
]
},
"locked": {
"lastModified": 1712014858,
"narHash": "sha256-sB4SWl2lX95bExY2gMFG5HIzvva5AVMJd4Igm+GpZNw=",
"owner": "hercules-ci",
"repo": "flake-parts",
"rev": "9126214d0a59633752a136528f5f3b9aa8565b7d",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"repo": "flake-parts",
"type": "github"
}
},
"nixlib": {
"locked": {
"lastModified": 1711846064,
"narHash": "sha256-cqfX0QJNEnge3a77VnytM0Q6QZZ0DziFXt6tSCV8ZSc=",
"owner": "nix-community",
"repo": "nixpkgs.lib",
"rev": "90b1a963ff84dc532db92f678296ff2499a60a87",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "nixpkgs.lib",
"type": "github"
}
},
"nixos-generators": {
"inputs": {
"nixlib": "nixlib",
"nixpkgs": [
"clan-core",
"nixpkgs"
]
},
"locked": {
"lastModified": 1712191720,
"narHash": "sha256-xXtSSnVHURHsxLQO30dzCKW5NJVGV/umdQPmFjPFMVA=",
"owner": "nix-community",
"repo": "nixos-generators",
"rev": "0c15e76bed5432d7775a22e8d22059511f59d23a",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "nixos-generators",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1712468661,
"narHash": "sha256-n2gVVBs+rV+HzPv/N3QQv5cdAXqSkjmaObvfeMqnw2c=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "298edc8f1e0dfffce67f50375c9f5952e04a6d02",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-unstable-small",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"clan-core": "clan-core"
}
},
"sops-nix": {
"inputs": {
"nixpkgs": [
"clan-core",
"nixpkgs"
],
"nixpkgs-stable": [
"clan-core"
]
},
"locked": {
"lastModified": 1712458908,
"narHash": "sha256-DMgBS+jNHDg8z3g9GkwqL8xTKXCRQ/0FGsAyrniVonc=",
"owner": "Mic92",
"repo": "sops-nix",
"rev": "39191e8e6265b106c9a2ba0cfd3a4dafe98a31c6",
"type": "github"
},
"original": {
"owner": "Mic92",
"repo": "sops-nix",
"type": "github"
}
},
"treefmt-nix": {
"inputs": {
"nixpkgs": [
"clan-core",
"nixpkgs"
]
},
"locked": {
"lastModified": 1711963903,
"narHash": "sha256-N3QDhoaX+paWXHbEXZapqd1r95mdshxToGowtjtYkGI=",
"owner": "numtide",
"repo": "treefmt-nix",
"rev": "49dc4a92b02b8e68798abd99184f228243b6e3ac",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "treefmt-nix",
"type": "github"
}
}
},
"root": "root",
"version": 7
}

View File

@@ -19,14 +19,11 @@
machines = { machines = {
jon = { jon = {
imports = [ imports = [
./modules/shared.nix
./machines/jon/configuration.nix ./machines/jon/configuration.nix
./machines/jon/hardware-configuration.nix ./machines/jon/hardware-configuration.nix
clan-core.clanModules.sshd
clan-core.clanModules.diskLayouts
clan-core.clanModules.root-password
]; ];
nixpkgs.hostPlatform = system;
clanCore.machineIcon = null; # Optional, a path to an image file clanCore.machineIcon = null; # Optional, a path to an image file
# Set this for clan commands use ssh i.e. `clan machines update` # Set this for clan commands use ssh i.e. `clan machines update`
@@ -44,13 +41,11 @@
}; };
sara = { sara = {
imports = [ imports = [
./modules/shared.nix
./machines/sara/configuration.nix ./machines/sara/configuration.nix
./machines/jon/hardware-configuration.nix ./machines/jon/hardware-configuration.nix
clan-core.clanModules.sshd
clan-core.clanModules.diskLayouts
clan-core.clanModules.root-password
]; ];
nixpkgs.hostPlatform = system;
clanCore.machineIcon = null; # Optional, a path to an image file clanCore.machineIcon = null; # Optional, a path to an image file
# Set this for clan commands use ssh i.e. `clan machines update` # Set this for clan commands use ssh i.e. `clan machines update`
@@ -64,11 +59,17 @@
}; };
clan.networking.zerotier.networking.enable = true; clan.networking.zerotier.networking.enable = true;
# After jon is deployed, uncomment the following line /*
# This will allow sara to share the VPN overlay network with jon After jon is deployed, uncomment the following line
This will allow sara to share the VPN overlay network with jon
*/
# clan.networking.zerotier.networkId = builtins.readFile ../jon/facts/zerotier-network-id; # clan.networking.zerotier.networkId = builtins.readFile ../jon/facts/zerotier-network-id;
}; };
}; };
specialArgs = {
inherit system;
};
}; };
in in
{ {

View File

@@ -1,36 +0,0 @@
{
disko.devices = {
disk = {
main = {
type = "disk";
device = throw "Change this to your disk device";
content = {
type = "gpt";
partitions = {
boot = {
size = "1M";
type = "EF02"; # for grub MBR
};
ESP = {
size = "512M";
type = "EF00";
content = {
type = "filesystem";
format = "vfat";
mountpoint = "/boot";
};
};
root = {
size = "100%";
content = {
type = "filesystem";
format = "ext4";
mountpoint = "/";
};
};
};
};
};
};
};
}

View File

@@ -0,0 +1,9 @@
{clan-core, system, ...}:
{
imports = [
clan-core.clanModules.sshd
clan-core.clanModules.diskLayouts
clan-core.clanModules.root-password
];
nixpkgs.hostPlatform = system;
}