Docs: mention clan.nix file, which is present in the default template now

This commit is contained in:
Johannes Kirschbauer
2025-07-08 13:31:03 +02:00
parent 1a861cd889
commit a9e50154d0
7 changed files with 12 additions and 0 deletions

View File

@@ -52,6 +52,7 @@ clanModules/borgbackup
```nix title="flake.nix" ```nix title="flake.nix"
# ... # ...
# Sometimes this attribute set is defined in clan.nix
clan-core.lib.clan { clan-core.lib.clan {
# 1. Add the module to the available clanModules with inventory support # 1. Add the module to the available clanModules with inventory support
inventory.modules = { inventory.modules = {
@@ -175,6 +176,7 @@ The following shows how to add options to your module.
Configuration can be set as follows. Configuration can be set as follows.
```nix title="flake.nix" ```nix title="flake.nix"
# Sometimes this attribute set is defined in clan.nix
clan-core.lib.clan { clan-core.lib.clan {
inventory.services = { inventory.services = {
custom-module.instance_1 = { custom-module.instance_1 = {

View File

@@ -27,6 +27,7 @@ i.e. `@hsjobeki/customNetworking`
outputs = inputs: inputs.flake-parts.lib.mkFlake { inherit inputs; } ({ outputs = inputs: inputs.flake-parts.lib.mkFlake { inherit inputs; } ({
imports = [ inputs.clan-core.flakeModules.default ]; imports = [ inputs.clan-core.flakeModules.default ];
# ... # ...
# Sometimes this attribute set is defined in clan.nix
clan = { clan = {
# If needed: Exporting the module for other people # If needed: Exporting the module for other people
modules."@hsjobeki/customNetworking" = import ./service-modules/networking.nix; modules."@hsjobeki/customNetworking" = import ./service-modules/networking.nix;
@@ -218,6 +219,7 @@ To import the module use `importApply`
outputs = inputs: flake-parts.lib.mkFlake { inherit inputs; } ({self, lib, ...}: { outputs = inputs: flake-parts.lib.mkFlake { inherit inputs; } ({self, lib, ...}: {
imports = [ inputs.clan-core.flakeModules.default ]; imports = [ inputs.clan-core.flakeModules.default ];
# ... # ...
# Sometimes this attribute set is defined in clan.nix
clan = { clan = {
# Register the module # Register the module
modules."@hsjobeki/messaging" = lib.importApply ./service-modules/messaging.nix { inherit self; }; modules."@hsjobeki/messaging" = lib.importApply ./service-modules/messaging.nix { inherit self; };
@@ -244,6 +246,7 @@ Then wrap the module and forward the variable `self` from the outer context into
outputs = inputs: flake-parts.lib.mkFlake { inherit inputs; } ({self, lib, ...}: { outputs = inputs: flake-parts.lib.mkFlake { inherit inputs; } ({self, lib, ...}: {
imports = [ inputs.clan-core.flakeModules.default ]; imports = [ inputs.clan-core.flakeModules.default ];
# ... # ...
# Sometimes this attribute set is defined in clan.nix
clan = { clan = {
# Register the module # Register the module
modules."@hsjobeki/messaging" = { modules."@hsjobeki/messaging" = {

View File

@@ -90,6 +90,7 @@ See the complete [list](../../guides/more-machines.md#automatic-registration) of
The option: `machines.<name>` is used to add extra *nixosConfiguration* to a machine The option: `machines.<name>` is used to add extra *nixosConfiguration* to a machine
```{.nix .annotate title="flake.nix" hl_lines="3-13 18-22"} ```{.nix .annotate title="flake.nix" hl_lines="3-13 18-22"}
# Sometimes this attribute set is defined in clan.nix
clan = { clan = {
inventory.machines = { inventory.machines = {
jon = { jon = {

View File

@@ -28,6 +28,7 @@ To learn more: [Guide about clanService](../clanServices.md)
inputs@{ flake-parts, ... }: inputs@{ flake-parts, ... }:
flake-parts.lib.mkFlake { inherit inputs; } { flake-parts.lib.mkFlake { inherit inputs; } {
imports = [ inputs.clan-core.flakeModules.default ]; imports = [ inputs.clan-core.flakeModules.default ];
# Sometimes this attribute set is defined in clan.nix
clan = { clan = {
inventory.machines = { inventory.machines = {
jon = { jon = {
@@ -76,6 +77,7 @@ Adding the following services is recommended for most users:
inputs@{ flake-parts, ... }: inputs@{ flake-parts, ... }:
flake-parts.lib.mkFlake { inherit inputs; } { flake-parts.lib.mkFlake { inherit inputs; } {
imports = [ inputs.clan-core.flakeModules.default ]; imports = [ inputs.clan-core.flakeModules.default ];
# Sometimes this attribute set is defined in clan.nix
clan = { clan = {
inventory.machines = { inventory.machines = {
jon = { jon = {

View File

@@ -152,6 +152,7 @@ are loaded when using Clan:
outputs = outputs =
{ self, clan-core, ... }: { self, clan-core, ... }:
let let
# Sometimes this attribute set is defined in clan.nix
clan = clan-core.lib.clan { clan = clan-core.lib.clan {
inherit self; inherit self;

View File

@@ -39,6 +39,7 @@ For the purpose of this guide we have two machines:
outputs = outputs =
{ self, clan-core, ... }: { self, clan-core, ... }:
let let
# Sometimes this attribute set is defined in clan.nix
clan = clan-core.lib.clan { clan = clan-core.lib.clan {
inherit self; inherit self;

View File

@@ -14,6 +14,7 @@ If the hostname is **static**, like `server.example.com`, set it in the **invent
outputs = outputs =
{ self, clan-core, ... }: { self, clan-core, ... }:
let let
# Sometimes this attribute set is defined in clan.nix
clan = clan-core.lib.clan { clan = clan-core.lib.clan {
inventory.machines.jon = { inventory.machines.jon = {
deploy.targetHost = "root@server.example.com"; deploy.targetHost = "root@server.example.com";
@@ -41,6 +42,7 @@ If your target host depends on a **dynamic expression** (like using the machine
outputs = outputs =
{ self, clan-core, ... }: { self, clan-core, ... }:
let let
# Sometimes this attribute set is defined in clan.nix
clan = clan-core.lib.clan { clan = clan-core.lib.clan {
machines.jon = {config, ...}: { machines.jon = {config, ...}: {
clan.core.networking.targetHost = "jon@${config.networking.fqdn}"; clan.core.networking.targetHost = "jon@${config.networking.fqdn}";