nixos: Add actual IP / CIDR calculation
This commit is contained in:
@@ -1,5 +1,8 @@
|
||||
{ lib, ... }:
|
||||
let
|
||||
inherit (lib.my) net;
|
||||
inherit (lib.my.colony) domain prefixes;
|
||||
|
||||
pubV4 = "94.142.240.44";
|
||||
in
|
||||
{
|
||||
@@ -25,7 +28,7 @@ in
|
||||
internal = {
|
||||
name = "estuary-vm";
|
||||
altNames = [ "fw" ];
|
||||
domain = lib.my.colony.domain;
|
||||
inherit domain;
|
||||
ipv4 = {
|
||||
address = pubV4;
|
||||
mask = 24;
|
||||
@@ -41,12 +44,12 @@ in
|
||||
};
|
||||
base = {
|
||||
name = "estuary-vm-base";
|
||||
domain = lib.my.colony.domain;
|
||||
inherit domain;
|
||||
ipv4 = {
|
||||
address = "${lib.my.colony.start.base.v4}1";
|
||||
address = net.cidr.host 1 prefixes.base.v4;
|
||||
gateway = null;
|
||||
};
|
||||
ipv6.address = "${lib.my.colony.start.base.v6}1";
|
||||
ipv6.address = net.cidr.host 1 prefixes.base.v6;
|
||||
};
|
||||
as211024 = {
|
||||
ipv4 = {
|
||||
|
@@ -1,4 +1,9 @@
|
||||
{ lib, ... }: {
|
||||
{ lib, ... }:
|
||||
let
|
||||
inherit (lib.my) net;
|
||||
inherit (lib.my.colony) domain prefixes;
|
||||
in
|
||||
{
|
||||
nixos.systems.chatterbox = {
|
||||
system = "x86_64-linux";
|
||||
nixpkgs = "mine";
|
||||
@@ -6,11 +11,11 @@
|
||||
assignments = {
|
||||
internal = {
|
||||
name = "chatterbox-ctr";
|
||||
domain = lib.my.colony.domain;
|
||||
ipv4.address = "${lib.my.colony.start.ctrs.v4}5";
|
||||
inherit domain;
|
||||
ipv4.address = net.cidr.host 5 prefixes.ctrs.v4;
|
||||
ipv6 = {
|
||||
iid = "::5";
|
||||
address = "${lib.my.colony.start.ctrs.v6}5";
|
||||
address = net.cidr.host 5 prefixes.ctrs.v6;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
@@ -1,4 +1,9 @@
|
||||
{ lib, ... }: {
|
||||
{ lib, ... }:
|
||||
let
|
||||
inherit (lib.my) net;
|
||||
inherit (lib.my.colony) domain prefixes;
|
||||
in
|
||||
{
|
||||
nixos.systems.colony-psql = {
|
||||
system = "x86_64-linux";
|
||||
nixpkgs = "mine";
|
||||
@@ -7,11 +12,11 @@
|
||||
internal = {
|
||||
name = "colony-psql-ctr";
|
||||
altNames = [ "colony-psql" ];
|
||||
domain = lib.my.colony.domain;
|
||||
ipv4.address = "${lib.my.colony.start.ctrs.v4}4";
|
||||
inherit domain;
|
||||
ipv4.address = net.cidr.host 4 prefixes.ctrs.v4;
|
||||
ipv6 = {
|
||||
iid = "::4";
|
||||
address = "${lib.my.colony.start.ctrs.v6}4";
|
||||
address = net.cidr.host 4 prefixes.ctrs.v6;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
@@ -1,4 +1,9 @@
|
||||
{ lib, ... }: {
|
||||
{ lib, ... }:
|
||||
let
|
||||
inherit (lib.my) net;
|
||||
inherit (lib.my.colony) domain prefixes;
|
||||
in
|
||||
{
|
||||
nixos.systems.jackflix = {
|
||||
system = "x86_64-linux";
|
||||
nixpkgs = "mine";
|
||||
@@ -6,11 +11,11 @@
|
||||
assignments = {
|
||||
internal = {
|
||||
name = "jackflix-ctr";
|
||||
domain = lib.my.colony.domain;
|
||||
ipv4.address = "${lib.my.colony.start.ctrs.v4}6";
|
||||
inherit domain;
|
||||
ipv4.address = net.cidr.host 6 prefixes.ctrs.v4;
|
||||
ipv6 = {
|
||||
iid = "::6";
|
||||
address = "${lib.my.colony.start.ctrs.v6}6";
|
||||
address = net.cidr.host 6 prefixes.ctrs.v6;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
@@ -1,4 +1,9 @@
|
||||
{ lib, ... }: {
|
||||
{ lib, ... }:
|
||||
let
|
||||
inherit (lib.my) net;
|
||||
inherit (lib.my.colony) domain prefixes;
|
||||
in
|
||||
{
|
||||
nixos.systems.middleman = {
|
||||
system = "x86_64-linux";
|
||||
nixpkgs = "mine";
|
||||
@@ -6,11 +11,11 @@
|
||||
assignments = {
|
||||
internal = {
|
||||
name = "middleman-ctr";
|
||||
domain = lib.my.colony.domain;
|
||||
ipv4.address = "${lib.my.colony.start.ctrs.v4}2";
|
||||
inherit domain;
|
||||
ipv4.address = net.cidr.host 2 prefixes.ctrs.v4;
|
||||
ipv6 = {
|
||||
iid = "::2";
|
||||
address = "${lib.my.colony.start.ctrs.v6}2";
|
||||
address = net.cidr.host 2 prefixes.ctrs.v6;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
@@ -1,4 +1,9 @@
|
||||
{ lib, ... }: {
|
||||
{ lib, ... }:
|
||||
let
|
||||
inherit (lib.my) net;
|
||||
inherit (lib.my.colony) domain prefixes;
|
||||
in
|
||||
{
|
||||
nixos.systems.object = {
|
||||
system = "x86_64-linux";
|
||||
nixpkgs = "mine";
|
||||
@@ -6,11 +11,11 @@
|
||||
assignments = {
|
||||
internal = {
|
||||
name = "object-ctr";
|
||||
domain = lib.my.colony.domain;
|
||||
ipv4.address = "${lib.my.colony.start.ctrs.v4}7";
|
||||
inherit domain;
|
||||
ipv4.address = net.cidr.host 7 prefixes.ctrs.v4;
|
||||
ipv6 = {
|
||||
iid = "::7";
|
||||
address = "${lib.my.colony.start.ctrs.v6}7";
|
||||
address = net.cidr.host 7 prefixes.ctrs.v6;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
@@ -1,4 +1,9 @@
|
||||
{ lib, ... }: {
|
||||
{ lib, ... }:
|
||||
let
|
||||
inherit (lib.my) net;
|
||||
inherit (lib.my.colony) domain prefixes;
|
||||
in
|
||||
{
|
||||
nixos.systems.toot = {
|
||||
system = "x86_64-linux";
|
||||
nixpkgs = "mine";
|
||||
@@ -6,11 +11,11 @@
|
||||
assignments = {
|
||||
internal = {
|
||||
name = "toot-ctr";
|
||||
domain = lib.my.colony.domain;
|
||||
ipv4.address = "${lib.my.colony.start.ctrs.v4}8";
|
||||
inherit domain;
|
||||
ipv4.address = net.cidr.host 8 prefixes.ctrs.v4;
|
||||
ipv6 = {
|
||||
iid = "::8";
|
||||
address = "${lib.my.colony.start.ctrs.v6}8";
|
||||
address = net.cidr.host 8 prefixes.ctrs.v6;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
@@ -1,4 +1,9 @@
|
||||
{ lib, ... }: {
|
||||
{ lib, ... }:
|
||||
let
|
||||
inherit (lib.my) net;
|
||||
inherit (lib.my.colony) domain prefixes;
|
||||
in
|
||||
{
|
||||
nixos.systems.vaultwarden = {
|
||||
system = "x86_64-linux";
|
||||
nixpkgs = "mine";
|
||||
@@ -6,11 +11,11 @@
|
||||
assignments = {
|
||||
internal = {
|
||||
name = "vaultwarden-ctr";
|
||||
domain = lib.my.colony.domain;
|
||||
ipv4.address = "${lib.my.colony.start.ctrs.v4}3";
|
||||
inherit domain;
|
||||
ipv4.address = net.cidr.host 3 prefixes.ctrs.v4;
|
||||
ipv6 = {
|
||||
iid = "::3";
|
||||
address = "${lib.my.colony.start.ctrs.v6}3";
|
||||
address = net.cidr.host 3 prefixes.ctrs.v6;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
@@ -1,4 +1,9 @@
|
||||
{ lib, ... }: {
|
||||
{ lib, ... }:
|
||||
let
|
||||
inherit (lib.my) net;
|
||||
inherit (lib.my.colony) domain prefixes;
|
||||
in
|
||||
{
|
||||
imports = [ ./containers ];
|
||||
|
||||
nixos.systems.shill = {
|
||||
@@ -8,32 +13,32 @@
|
||||
assignments = {
|
||||
routing = {
|
||||
name = "shill-vm-routing";
|
||||
domain = lib.my.colony.domain;
|
||||
ipv4.address = "${lib.my.colony.start.vms.v4}2";
|
||||
inherit domain;
|
||||
ipv4.address = net.cidr.host 2 prefixes.vms.v4;
|
||||
};
|
||||
internal = {
|
||||
name = "shill-vm";
|
||||
altNames = [ "ctr" ];
|
||||
domain = lib.my.colony.domain;
|
||||
inherit domain;
|
||||
ipv4 = {
|
||||
address = "${lib.my.colony.start.vip1}5";
|
||||
address = net.cidr.host 1 prefixes.vip1;
|
||||
mask = 32;
|
||||
gateway = null;
|
||||
genPTR = false;
|
||||
};
|
||||
ipv6 = {
|
||||
iid = "::2";
|
||||
address = "${lib.my.colony.start.vms.v6}2";
|
||||
address = net.cidr.host 2 prefixes.vms.v6;
|
||||
};
|
||||
};
|
||||
ctrs = {
|
||||
name = "shill-vm-ctrs";
|
||||
domain = lib.my.colony.domain;
|
||||
inherit domain;
|
||||
ipv4 = {
|
||||
address = "${lib.my.colony.start.ctrs.v4}1";
|
||||
address = net.cidr.host 1 prefixes.ctrs.v4;
|
||||
gateway = null;
|
||||
};
|
||||
ipv6.address = "${lib.my.colony.start.ctrs.v6}1";
|
||||
ipv6.address = net.cidr.host 1 prefixes.ctrs.v6;
|
||||
};
|
||||
};
|
||||
|
||||
|
@@ -1,7 +1,8 @@
|
||||
{ lib, ... }:
|
||||
let
|
||||
inherit (builtins) mapAttrs;
|
||||
inherit (lib) mkForce;
|
||||
inherit (lib.my) net;
|
||||
inherit (lib.my.colony) domain prefixes;
|
||||
in
|
||||
{
|
||||
nixos.systems.whale2 = {
|
||||
@@ -11,41 +12,41 @@ in
|
||||
assignments = {
|
||||
routing = {
|
||||
name = "whale-vm-routing";
|
||||
domain = lib.my.colony.domain;
|
||||
ipv4.address = "${lib.my.colony.start.vms.v4}3";
|
||||
inherit domain;
|
||||
ipv4.address = net.cidr.host 3 prefixes.vms.v4;
|
||||
};
|
||||
internal = {
|
||||
name = "whale-vm";
|
||||
altNames = [ "oci" ];
|
||||
domain = lib.my.colony.domain;
|
||||
inherit domain;
|
||||
ipv4 = {
|
||||
address = "${lib.my.colony.start.vip1}6";
|
||||
address = net.cidr.host 2 prefixes.vip1;
|
||||
mask = 32;
|
||||
gateway = null;
|
||||
genPTR = false;
|
||||
};
|
||||
ipv6 = {
|
||||
iid = "::3";
|
||||
address = "${lib.my.colony.start.vms.v6}3";
|
||||
address = net.cidr.host 3 prefixes.vms.v6;
|
||||
};
|
||||
};
|
||||
oci = {
|
||||
name = "whale-vm-oci";
|
||||
domain = lib.my.colony.domain;
|
||||
inherit domain;
|
||||
ipv4 = {
|
||||
address = "${lib.my.colony.start.oci.v4}1";
|
||||
address = net.cidr.host 1 prefixes.oci.v4;
|
||||
gateway = null;
|
||||
};
|
||||
ipv6.address = "${lib.my.colony.start.oci.v6}1";
|
||||
ipv6.address = net.cidr.host 1 prefixes.oci.v6;
|
||||
};
|
||||
};
|
||||
|
||||
extraAssignments = mapAttrs (n: i: {
|
||||
internal = {
|
||||
name = n;
|
||||
domain = lib.my.colony.domain;
|
||||
ipv4.address = "${lib.my.colony.start.oci.v4}${toString i}";
|
||||
ipv6.address = "${lib.my.colony.start.oci.v6}${toString i}";
|
||||
inherit domain;
|
||||
ipv4.address = net.cidr.host i prefixes.oci.v4;
|
||||
ipv6.address = net.cidr.host i prefixes.oci.v6;
|
||||
};
|
||||
}) {
|
||||
valheim-oci = 2;
|
||||
@@ -130,14 +131,14 @@ in
|
||||
ranges = [
|
||||
[
|
||||
{
|
||||
subnet = lib.my.colony.prefixes.oci.v4;
|
||||
gateway = lib.my.colony.start.oci.v4 + "1";
|
||||
subnet = prefixes.oci.v4;
|
||||
gateway = net.cidr.host 1 prefixes.oci.v4;
|
||||
}
|
||||
]
|
||||
[
|
||||
{
|
||||
subnet = lib.my.colony.prefixes.oci.v6;
|
||||
gateway = lib.my.colony.start.oci.v6 + "1";
|
||||
subnet = prefixes.oci.v6;
|
||||
gateway = net.cidr.host 1 prefixes.oci.v6;
|
||||
}
|
||||
]
|
||||
];
|
||||
|
Reference in New Issue
Block a user