stream: microvmify

This commit is contained in:
Astro 2022-06-28 03:26:08 +02:00
parent 4078d6c707
commit 2792bd107c
3 changed files with 46 additions and 5 deletions

View File

@ -544,7 +544,7 @@
stream = nixosSystem' {
modules = [
./config/lxc-container.nix
self.nixosModules.microvm
./hosts/containers/stream
];
};

View File

@ -1,17 +1,50 @@
{ zentralwerk, config, pkgs, ... }:
let
authFile = pkgs.writeText "htpasswd" "k-ot:sawCOTsl/fIUY";
mac = {
pub = "DE:91:C7:51:D1:C5";
serv = "C6:40:E0:21:9B:A4";
};
in
{
networking.hostName = "stream";
c3d2.hq.statistics.enable = true;
c3d2.autoUpdate = true;
c3d2.deployment = {
server = "server9";
autoNetSetup = false;
mounts = [];
};
microvm.mem = 2048;
microvm.interfaces = [ {
type = "tap";
id = "pub-stream";
mac = mac.pub;
} {
type = "tap";
id = "serv-stream";
mac = mac.serv;
} ];
microvm.shares = map (name: {
source = "/tank/storage/stream/${name}";
mountPoint = "/${name}";
tag = name;
proto = "virtiofs";
socket = "${name}.socket";
}) [ "etc" "home" "var" ];
systemd.network = {
enable = true;
links."00-serv" = {
matchConfig.MACAddress = mac.serv;
linkConfig.Name = "serv";
};
networks."00-serv" = {
matchConfig.MACAddress = "C6:40:E0:21:9B:A4";
matchConfig.MACAddress = mac.serv;
networkConfig.IPv6AcceptRA = false;
# try harder disabling global ipv6
networkConfig.LinkLocalAddressing = "no";
addresses = [ {
addressConfig.Address = "${config.c3d2.hosts.stream.ip4}/${toString zentralwerk.lib.config.site.net.serv.subnet4Len}";
} ];
@ -23,9 +56,15 @@ in
} ];
};
links."00-pub" = {
matchConfig.MACAddress = mac.pub;
linkConfig.Name = "pub";
};
networks."01-pub" = {
matchConfig.MACAddress = "DE:91:C7:51:D1:C5";
matchConfig.MACAddress = mac.pub;
networkConfig.DHCP = "ipv4";
networkConfig.IPv6AcceptRA = true;
};
};
networking.firewall.allowedTCPPorts = [ 80 443 ];
@ -63,4 +102,6 @@ in
};
};
};
system.stateVersion = "22.05";
}

View File

@ -29,7 +29,7 @@ in
{
options.c3d2.deployment = with lib; {
server = mkOption {
type = types.enum [ "server10" ];
type = types.enum [ "server9" "server10" ];
description = "Server that is supposed to host this MicroVM.";
};