Merge pull request 'Docs: update 'clan.service' examples' (#3568) from hsjobeki/clan-core:docs-1 into main
Reviewed-on: https://git.clan.lol/clan/clan-core/pulls/3568
This commit is contained in:
@@ -58,7 +58,7 @@ nav:
|
|||||||
- Autoincludes: manual/adding-machines.md
|
- Autoincludes: manual/adding-machines.md
|
||||||
- Inventory:
|
- Inventory:
|
||||||
- Inventory: manual/inventory.md
|
- Inventory: manual/inventory.md
|
||||||
- Instances: manual/distributed-services.md
|
- Services: manual/distributed-services.md
|
||||||
- Secure Boot: manual/secure-boot.md
|
- Secure Boot: manual/secure-boot.md
|
||||||
- Flake-parts: manual/flake-parts.md
|
- Flake-parts: manual/flake-parts.md
|
||||||
- Authoring:
|
- Authoring:
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ We discussed the initial architecture in [01-clan-service-modules](https://git.c
|
|||||||
|
|
||||||
### A Minimal module
|
### A Minimal module
|
||||||
|
|
||||||
First of all we need to register our module into the `inventory.modules` attribute. Make sure to choose a unique name so the module doesn't have a name collision with any of the core modules.
|
First of all we need to register our module into the `clan.modules` attribute. Make sure to choose a unique name so the module doesn't have a name collision with any of the core modules.
|
||||||
|
|
||||||
While not required we recommend to prefix your module attribute name.
|
While not required we recommend to prefix your module attribute name.
|
||||||
|
|
||||||
@@ -22,20 +22,15 @@ i.e. `@hsjobeki/customNetworking`
|
|||||||
|
|
||||||
```nix title="flake.nix"
|
```nix title="flake.nix"
|
||||||
# ...
|
# ...
|
||||||
|
outputs = inputs: inputs.flake-parts.lib.mkFlake { inherit inputs; } ({
|
||||||
outputs = inputs: flake-parts.lib.mkFlake { inherit inputs; } ({
|
|
||||||
imports = [ inputs.clan-core.flakeModules.default ];
|
imports = [ inputs.clan-core.flakeModules.default ];
|
||||||
# ...
|
# ...
|
||||||
clan = {
|
clan = {
|
||||||
inventory = {
|
|
||||||
# We could also inline the complete module spec here
|
|
||||||
# For example
|
|
||||||
# {...}: { _class = "clan.service"; ... };
|
|
||||||
modules."@hsjobeki/customNetworking" = import ./service-modules/networking.nix;
|
|
||||||
};
|
|
||||||
|
|
||||||
# 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;
|
||||||
|
# We could also inline the complete module spec here
|
||||||
|
# For example
|
||||||
|
# {...}: { _class = "clan.service"; ... };
|
||||||
};
|
};
|
||||||
})
|
})
|
||||||
```
|
```
|
||||||
@@ -221,9 +216,6 @@ outputs = inputs: flake-parts.lib.mkFlake { inherit inputs; } ({self, lib, ...}:
|
|||||||
# ...
|
# ...
|
||||||
clan = {
|
clan = {
|
||||||
# Register the module
|
# Register the module
|
||||||
inventory.modules."@hsjobeki/messaging" = lib.importApply ./service-modules/messaging.nix { inherit self; };
|
|
||||||
|
|
||||||
# Expose the module for downstream users, 'self' would always point to this flake.
|
|
||||||
modules."@hsjobeki/messaging" = lib.importApply ./service-modules/messaging.nix { inherit self; };
|
modules."@hsjobeki/messaging" = lib.importApply ./service-modules/messaging.nix { inherit self; };
|
||||||
};
|
};
|
||||||
})
|
})
|
||||||
@@ -250,7 +242,7 @@ outputs = inputs: flake-parts.lib.mkFlake { inherit inputs; } ({self, lib, ...}:
|
|||||||
# ...
|
# ...
|
||||||
clan = {
|
clan = {
|
||||||
# Register the module
|
# Register the module
|
||||||
inventory.modules."@hsjobeki/messaging" = {
|
modules."@hsjobeki/messaging" = {
|
||||||
# Create an option 'myClan' and assign it to 'self'
|
# Create an option 'myClan' and assign it to 'self'
|
||||||
options.myClan = lib.mkOption {
|
options.myClan = lib.mkOption {
|
||||||
default = self;
|
default = self;
|
||||||
|
|||||||
Reference in New Issue
Block a user