This reverts commit afbd4a984d.
The old configuration cannot be updated like this:
eve] error:
[eve] … while calling the 'head' builtin
[eve] at /nix/store/5b0hl2dnvr1sawqlkwmsnaiyqz00d34h-source/lib/attrsets.nix:1575:11:
[eve] 1574| || pred here (elemAt values 1) (head values) then
[eve] 1575| head values
[eve] | ^
[eve] 1576| else
[eve]
[eve] … while evaluating the attribute 'value'
[eve] at /nix/store/5b0hl2dnvr1sawqlkwmsnaiyqz00d34h-source/lib/modules.nix:809:9:
[eve] 808| in warnDeprecation opt //
[eve] 809| { value = builtins.addErrorContext "while evaluating the option `${showOption loc}':" value;
[eve] | ^
[eve] 810| inherit (res.defsFinal') highestPrio;
[eve]
[eve] … while evaluating the option `system.build.toplevel':
[eve]
[eve] … while evaluating definitions from `/nix/store/5b0hl2dnvr1sawqlkwmsnaiyqz00d34h-source/nixos/modules/system/activation/top-level.nix':
[eve]
[eve] … while evaluating the option `assertions':
[eve]
[eve] … while evaluating definitions from `/nix/store/5b0hl2dnvr1sawqlkwmsnaiyqz00d34h-source/nixos/modules/system/boot/systemd.nix':
[eve]
[eve] … while evaluating the option `systemd.services':
[eve]
[eve] … while evaluating definitions from `/nix/store/kpzcdgndym0qm1w490mjvk9c2qmz03h5-source/nixosModules/clanCore/zerotier':
[eve]
[eve] … while evaluating the option `clan.core.networking.zerotier.networkId':
[eve]
[eve] (stack trace truncated; use '--show-trace' to show the full, detailed trace)
[eve]
[eve] error: A definition for option `clan.core.networking.zerotier.networkId' is not of type `null or string'. Definition values:
[eve] - In `/nix/store/kpzcdgndym0qm1w490mjvk9c2qmz03h5-source/nixosModules/clanCore/networking.nix':
[eve] {
[eve] _type = "override";
[eve] content = "267efd4a15b69623";
[eve] priorit
98 lines
3.1 KiB
Markdown
98 lines
3.1 KiB
Markdown
# Clan with `flake-parts`
|
|
|
|
Clan supports integration with [flake.parts](https://flake.parts/) a tool which allows composing nixos modules in a modular way.
|
|
|
|
Here's how to set up Clan using `nix flakes` and `flake-parts`.
|
|
|
|
## 1. Update Your Flake Inputs
|
|
|
|
To begin, you'll need to add `flake-parts` as a new dependency in your flake's inputs. This is alongside the already existing dependencies, such as `clan-core` and `nixpkgs`. Here's how you can update your `flake.nix` file:
|
|
|
|
```nix
|
|
# flake.nix
|
|
inputs = {
|
|
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
|
|
|
|
# New flake-parts input
|
|
flake-parts.url = "github:hercules-ci/flake-parts";
|
|
flake-parts.inputs.nixpkgs-lib.follows = "nixpkgs";
|
|
|
|
clan-core = {
|
|
url = "git+https://git.clan.lol/clan/clan-core";
|
|
inputs.nixpkgs.follows = "nixpkgs"; # Needed if your configuration uses nixpkgs unstable.
|
|
# New
|
|
inputs.flake-parts.follows = "flake-parts";
|
|
};
|
|
}
|
|
```
|
|
|
|
## 2. Import Clan-Core Flake Module
|
|
|
|
After updating your flake inputs, the next step is to import the `clan-core` flake module. This will make the [clan options](https://git.clan.lol/clan/clan-core/src/branch/main/flakeModules/clan.nix) available within `mkFlake`.
|
|
|
|
```nix
|
|
outputs =
|
|
inputs@{ flake-parts, ... }:
|
|
flake-parts.lib.mkFlake { inherit inputs; } (
|
|
{
|
|
#
|
|
imports = [
|
|
inputs.clan-core.flakeModules.default
|
|
];
|
|
}
|
|
);
|
|
```
|
|
|
|
### 3. Configure Clan Settings and Define Machines
|
|
|
|
Configure your clan settings and define machine configurations.
|
|
|
|
Below is a guide on how to structure this in your flake.nix:
|
|
|
|
```nix
|
|
outputs = inputs@{ flake-parts, clan-core, ... }:
|
|
flake-parts.lib.mkFlake { inherit inputs; } ({self, pkgs, ...}: {
|
|
# We define our own systems below. you can still use this to add system specific outputs to your flake.
|
|
# See: https://flake.parts/getting-started
|
|
systems = [];
|
|
|
|
# import clan-core modules
|
|
imports = [
|
|
clan-core.flakeModules.default
|
|
];
|
|
# Define your clan
|
|
clan = {
|
|
# Clan wide settings. (Required)
|
|
meta.name = ""; # Ensure to choose a unique name.
|
|
|
|
machines = {
|
|
jon = {
|
|
imports = [
|
|
./machines/jon/configuration.nix
|
|
./modules/disko.nix
|
|
# ... more modules
|
|
];
|
|
nixpkgs.hostPlatform = "x86_64-linux";
|
|
|
|
# Set this for clan commands use ssh i.e. `clan machines update`
|
|
clan.networking.targetHost = pkgs.lib.mkDefault "root@jon";
|
|
|
|
# remote> lsblk --output NAME,ID-LINK,FSTYPE,SIZE,MOUNTPOINT
|
|
disko.devices.disk.main = {
|
|
device = "/dev/disk/by-id/nvme-eui.e8238fa6bf530001001b448b4aec2929";
|
|
};
|
|
|
|
# There needs to be exactly one controller per clan
|
|
clan.networking.zerotier.controller.enable = true;
|
|
|
|
};
|
|
};
|
|
};
|
|
});
|
|
```
|
|
|
|
For detailed information about configuring `flake-parts` and the available options within Clan,
|
|
refer to the Clan module documentation located [here](https://git.clan.lol/clan/clan-core/src/branch/main/flakeModules/clan.nix).
|
|
|
|
---
|