Adding more structure.
This commit is contained in:
parent
551b401efa
commit
896c5ff939
2 changed files with 89 additions and 65 deletions
71
modules/metanix-core.nix
Normal file
71
modules/metanix-core.nix
Normal file
|
|
@ -0,0 +1,71 @@
|
|||
{ lib, meta, addressing, ... }:
|
||||
|
||||
let
|
||||
inherit (lib) mkOption types;
|
||||
in
|
||||
{
|
||||
options.metanix = {
|
||||
# Raw world spec, straight from meta.nix
|
||||
meta = mkOption {
|
||||
type = types.attrs;
|
||||
readOnly = true;
|
||||
default = { };
|
||||
description = "Raw Metanix world spec loaded from meta.nix.";
|
||||
};
|
||||
|
||||
domain = mkOption {
|
||||
type = types.str;
|
||||
readOnly = true;
|
||||
description = "Base DNS domain for this Metanix world.";
|
||||
};
|
||||
|
||||
locations = mkOption {
|
||||
type = types.attrs;
|
||||
readOnly = true;
|
||||
description = "Location tree from meta.nix.";
|
||||
};
|
||||
|
||||
systems = mkOption {
|
||||
type = types.attrs;
|
||||
readOnly = true;
|
||||
description = "System definitions from meta.nix.";
|
||||
};
|
||||
|
||||
# Computed addressing
|
||||
network = mkOption {
|
||||
type = types.attrs;
|
||||
readOnly = true;
|
||||
description = "Computed addressing (hosts, subnets, etc.) from meta.nix.";
|
||||
};
|
||||
|
||||
hosts = mkOption {
|
||||
type = types.attrs;
|
||||
readOnly = true;
|
||||
description = "Shortcut for metanix.network.hosts.";
|
||||
};
|
||||
|
||||
subnets = mkOption {
|
||||
type = types.attrs;
|
||||
readOnly = true;
|
||||
description = "Shortcut for metanix.network.subnets.";
|
||||
};
|
||||
};
|
||||
|
||||
config.metanix =
|
||||
let
|
||||
world = meta;
|
||||
network = addressing.mkNetworkFromSpec world;
|
||||
in
|
||||
{
|
||||
meta = world;
|
||||
|
||||
domain = world.domain;
|
||||
locations = world.locations or { };
|
||||
systems = world.systems or { };
|
||||
policy = world.policy or { };
|
||||
|
||||
inherit network;
|
||||
hosts = network.hosts;
|
||||
subnets = network.subnets;
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue