71 lines
1.5 KiB
Nix
71 lines
1.5 KiB
Nix
{ 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;
|
|
};
|
|
}
|