Merge pull request 'Migrate Importer module' (#3854) from migrate-importer into main
Reviewed-on: https://git.clan.lol/clan/clan-core/pulls/3854 Reviewed-by: Luis Hebendanz <consulting@qube.email>
This commit is contained in:
@@ -47,7 +47,7 @@ nixosLib.runTest (
|
||||
server.succeed("systemctl status mycelium")
|
||||
|
||||
# Check that mycelium is listening on its default port
|
||||
server.succeed("${pkgs.iproute2}/bin/ss -tulpn | grep -q 'mycelium'")
|
||||
server.wait_until_succeeds("${pkgs.iproute2}/bin/ss -tulpn | grep -q 'mycelium'", 10)
|
||||
'';
|
||||
}
|
||||
)
|
||||
|
||||
26
clanServices/importer/README.md
Normal file
26
clanServices/importer/README.md
Normal file
@@ -0,0 +1,26 @@
|
||||
The importer module allows users to configure importing modules in a flexible and structured way.
|
||||
It exposes the `extraModules` functionality of the inventory, without any added configuration.
|
||||
|
||||
## Usage:
|
||||
|
||||
```nix
|
||||
inventory.instances = {
|
||||
|
||||
zone1 = {
|
||||
module.name = "@clan/importer";
|
||||
roles.default.tags = [ "zone1" ];
|
||||
roles.default.extraModules = [ "modules/zone1.nix" ];
|
||||
};
|
||||
|
||||
base = {
|
||||
module.name = "@clan/importer";
|
||||
roles.default.tags = [ "all" ];
|
||||
roles.default.extraModules = [ "modules/base.nix" ];
|
||||
};
|
||||
|
||||
};
|
||||
```
|
||||
|
||||
This will import the module `modules/base.nix` to all machines that have the `all` tag,
|
||||
which by default is every machine managed by the clan.
|
||||
And also import for all machines tagged with `zone1` the module at `modules/zone1.nix`.
|
||||
10
clanServices/importer/default.nix
Normal file
10
clanServices/importer/default.nix
Normal file
@@ -0,0 +1,10 @@
|
||||
{ ... }:
|
||||
{
|
||||
_class = "clan.service";
|
||||
manifest.name = "clan-core/importer";
|
||||
manifest.description = "Convenient, structured module imports for hosts.";
|
||||
manifest.categories = [ "Utility" ];
|
||||
manifest.readme = builtins.readFile ./README.md;
|
||||
|
||||
roles.default = { };
|
||||
}
|
||||
6
clanServices/importer/flake-module.nix
Normal file
6
clanServices/importer/flake-module.nix
Normal file
@@ -0,0 +1,6 @@
|
||||
{ lib, ... }:
|
||||
{
|
||||
clan.modules = {
|
||||
importer = lib.modules.importApply ./default.nix { };
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user