forked from clan/clan-core
inventory: rename clan.services
This commit is contained in:
parent
afca7ae0cc
commit
e44b07df66
@ -1,6 +1,6 @@
|
||||
{ config, lib, ... }:
|
||||
let
|
||||
instances = config.clan.inventory.borgbackup;
|
||||
instances = config.clan.services.borgbackup;
|
||||
# roles = { ${role_name} :: { machines :: [string] } }
|
||||
allServers = lib.foldlAttrs (
|
||||
acc: _instanceName: instanceConfig:
|
||||
|
@ -3,7 +3,8 @@ let
|
||||
clanDir = config.clan.core.clanDir;
|
||||
machineDir = clanDir + "/machines/";
|
||||
inherit (config.clan.core) machineName;
|
||||
instances = config.clan.inventory.borgbackup;
|
||||
|
||||
instances = config.clan.services.borgbackup;
|
||||
|
||||
# roles = { ${role_name} :: { machines :: [string] } }
|
||||
allClients = lib.foldlAttrs (
|
||||
@ -20,7 +21,6 @@ in
|
||||
{
|
||||
config.services.borgbackup.repos =
|
||||
let
|
||||
filteredMachines = allClients;
|
||||
|
||||
borgbackupIpMachinePath = machines: machineDir + machines + "/facts/borgbackup.ssh.pub";
|
||||
machinesMaybeKey = builtins.map (
|
||||
@ -29,7 +29,7 @@ in
|
||||
fullPath = borgbackupIpMachinePath machine;
|
||||
in
|
||||
if builtins.pathExists fullPath then machine else null
|
||||
) filteredMachines;
|
||||
) allClients;
|
||||
|
||||
machinesWithKey = lib.filter (x: x != null) machinesMaybeKey;
|
||||
|
||||
|
@ -47,10 +47,12 @@ Architecture
|
||||
```
|
||||
nixosConfig < machine_module < inventory
|
||||
---------------------------------------------
|
||||
nixos < borgbackup + borgbackup-static > UI
|
||||
nixos < borgbackup <- inventory <-> UI
|
||||
|
||||
creates the config Maps from high level services to the borgbackup clan module
|
||||
for ONE machine
|
||||
for ONE machine Inventory is completely serializable.
|
||||
UI can interact with the inventory to define machines, and services
|
||||
Defining Users is out of scope for the first prototype.
|
||||
```
|
||||
|
||||
- [ ] Why do we need 2 modules?
|
||||
|
@ -92,7 +92,7 @@ let
|
||||
];
|
||||
}
|
||||
{
|
||||
config.clan.inventory.${moduleName}.${instanceName} = {
|
||||
config.clan.services.${moduleName}.${instanceName} = {
|
||||
roles = resolvedRoles;
|
||||
# inherit inverseRoles;
|
||||
};
|
||||
@ -107,7 +107,8 @@ in
|
||||
{
|
||||
inherit clan-core;
|
||||
|
||||
new_clan = clan-core.lib.buildInventory {
|
||||
# Extension of the build clan interface
|
||||
new_clan = clan-core.lib.buildClan {
|
||||
# High level services.
|
||||
# If you need multiple instances of a service configure them via:
|
||||
# inventory.services.[serviceName].[instanceName] = ...
|
||||
|
@ -30,7 +30,7 @@ let
|
||||
in
|
||||
{
|
||||
# clan.inventory.${moduleName}.${instanceName} = { ... }
|
||||
options.clan.inventory = lib.mkOption {
|
||||
options.clan.services = lib.mkOption {
|
||||
type = lib.types.attrsOf (lib.types.attrsOf instanceOptions);
|
||||
};
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user