updates and migrations

This commit is contained in:
Vivian 2023-04-28 10:28:06 +02:00
parent 8612ea5e53
commit 2b16f87b36
7 changed files with 1363 additions and 27 deletions

View file

@ -6,6 +6,11 @@ let
hostName = hostname;
ipAddress = ip;
};
hostToKea = {hostname, mac, ip, ...}: {
inherit hostname;
hw-address = mac;
ip-address = ip;
};
localDomain = config.networking.domain;
hosts =
filter (h: hasAttr "ip" h && hasAttr "mac" h && h.realm == localDomain)
@ -51,4 +56,73 @@ in {
'';
machines = map hostToDhcp hosts;
};
services.kea = {
dhcp4 = {
enable = false;
settings = {
authoritative = true;
valid-lifetime = 4000;
rebind-timer = 2000;
renew-timer = 1000;
interfaces-config.interfaces = [ "eth0" ];
lease-database = {
name = "/var/lib/kea/dhcp4.leases";
persist = true;
type = "memfile";
};
option-data = [
{
space = "dhcp4";
name = "subnet-mask";
code = 1;
data = "255.255.254.0";
}
{
space = "dhcp4";
name = "broadcast-address";
code = 28;
data = "10.42.43.255";
}
{
space = "dhcp4";
name = "routers";
code = 3;
data = "10.42.42.1";
}
{
space = "dhcp4";
name = "domain-name-servers";
code = 6;
data = "10.42.42.15; 10.42.42.16";
}
{
space = "dhcp4";
name = "domain-name";
code = 15;
data = "${localDomain}";
}
{
space = "dhcp4";
name = "domain-search";
code = 119;
data = "${localDomain}";
}
];
subnet4 = [{
id = 1;
pools = [{ pool = "10.42.43.1 - 10.42.43.254"; }];
subnet = "10.42.42.0/23";
}];
host-reservation-identifiers = [ "hw-address" ];
reservation-mode = "global";
reservations = map hostToKea hosts;
};
};
};
}

View file

@ -22,7 +22,7 @@ in
environment.noXlibs = lib.mkForce false;
networking.firewall.allowedTCPPorts = [ config.services.gitea.httpPort ];
networking.firewall.allowedTCPPorts = [ config.services.gitea.settings.server.HTTP_PORT ];
services.openssh.startWhenNeeded = false;
@ -47,9 +47,7 @@ in
services.gitea = {
enable = true;
domain = "git.0x76.dev";
package = pkgs.forgejo;
rootUrl = "https://git.0x76.dev";
lfs.enable = true;
dump.type = "tar.gz";
database.type = "postgres";
@ -80,8 +78,10 @@ in
"USE_SERVICE_WORKER" = true;
};
server = {
"LANDING_PAGE" = "explore";
"SSH_PORT" = 42;
LANDING_PAGE = "explore";
SSH_PORT = 42;
DOMAIN = "git.0x76.dev";
ROOT_URL = "https://git.0x76.dev";
};
session = {
"PROVIDER" = "db";