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