hosts/leoncloud: init

This commit is contained in:
Astro 2022-09-05 22:17:11 +02:00
parent 62bd624527
commit a0dc08e97b
3 changed files with 113 additions and 1 deletions

View File

@ -737,6 +737,13 @@
];
};
leoncloud = nixosSystem' {
modules = [
self.nixosModules.microvm
./hosts/leoncloud
];
};
nfsroot = nixosSystem' {
modules = [
self.nixosModules.microvm

View File

@ -80,7 +80,7 @@ in
# try harder disabling global ipv6
networkConfig.LinkLocalAddressing = "no";
addresses = [ {
addressConfig.Address = "${config.c3d2.hosts.leon.ip4}/${toString zentralwerk.lib.config.site.net.serv.subnet4Len}";
addressConfig.Address = "${config.c3d2.hosts.${config.networking.hostName}.ip4}/${toString zentralwerk.lib.config.site.net.serv.subnet4Len}";
} ];
routes = [ {
routeConfig = {

105
hosts/leoncloud/default.nix Normal file
View File

@ -0,0 +1,105 @@
{ zentralwerk, config, pkgs, ... }:
let
netConfig = zentralwerk.lib.config.site.net.serv;
mac = {
serv = "e2:e9:bb:f4:4a:fe";
pub = "e2:e9:bb:f4:4a:ff";
};
in
{
microvm = {
mem = 1024;
};
c3d2.deployment = {
server = "server9";
mounts = [ "etc" "home" "var"];
autoNetSetup = false;
};
microvm.interfaces = [ {
type = "tap";
id = "pub-leoncloud";
mac = mac.pub;
} {
type = "tap";
id = "serv-leoncloud";
mac = mac.serv;
} ];
networking = {
hostName = "leoncloud";
firewall.enable = true;
};
systemd.network = {
enable = true;
# On the serv network I have a static IPv4 and only a route to the
# rest of the network so that I am reachable by
# public-access-proxy.
links."00-serv" = {
matchConfig.MACAddress = mac.serv;
linkConfig.Name = "serv";
};
networks."00-serv" = {
matchConfig.MACAddress = mac.serv;
networkConfig.IPv6AcceptRA = false;
# try harder disabling global ipv6
networkConfig.LinkLocalAddressing = "no";
addresses = [ {
addressConfig.Address = "${config.c3d2.hosts.${config.networking.hostName}.ip4}/${toString zentralwerk.lib.config.site.net.serv.subnet4Len}";
} ];
routes = [ {
routeConfig = {
Destination = "172.20.0.0/14";
Gateway = config.c3d2.hosts.serv-gw.ip4;
};
} ];
};
# On the pub network I am a normal client.
links."00-pub" = {
matchConfig.MACAddress = mac.pub;
linkConfig.Name = "pub";
};
networks."01-pub" = {
matchConfig.MACAddress = mac.pub;
networkConfig.DHCP = "ipv4";
networkConfig.IPv6AcceptRA = true;
};
};
security.sudo = {
enable = true;
wheelNeedsPassword = false;
};
c3d2.hq.statistics.enable = true;
# List packages installed in system profile. To search, run:
# $ nix search wget
environment.systemPackages = with pkgs; [
wget vim python3Full nmap htop wireguard-tools
];
users.users.leon = {
isNormalUser = true;
extraGroups = [ "wheel" ];
createHome = true;
openssh.authorizedKeys.keys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIM2zpmWA3Z9zshWaU8k1SWyJnbAyasOu9pV+9BvTY0XE leon@¯\_()_/¯"
];
};
networking.firewall = {
allowedTCPPorts = [ 80 443 ];
allowedUDPPorts = [ ];
};
system.stateVersion = "22.05";
}