add declarative vm to valefar

This commit is contained in:
waveringana 2025-06-18 06:30:26 -04:00
parent 7a31cdd170
commit 915e2d6377
4 changed files with 202 additions and 22 deletions

80
hosts/valefar/gamevm.nix Normal file
View file

@ -0,0 +1,80 @@
{ config, lib, pkgs, modulesPath, microvm, inputs, ... }:
{
# =============================================================================
# IMPORTS
# =============================================================================
imports = [
# Common modules shared across hosts
../../common/system.nix
../../common/users.nix
../../common/services.nix
];
system.stateVersion = "25.05";
networking.hostName = "gameservers";
virtualisation.docker = {
enable = true;
enableOnBoot = true;
};
systemd.network.networks."20-lan" = {
matchConfig.Type = "ether";
networkConfig = {
Address = [
"10.0.0.31/24"
"2601:5c2:8400:26c0::31/64"
];
Gateway = "10.0.0.1";
DNS = [
"10.0.0.210"
"1.1.1.1"
"1.0.0.1"
];
IPv6AcceptRA = true;
DHCP = "no";
};
};
systemd.network.networks."19-docker" = {
matchConfig.Name = "veth*";
linkConfig = {
Unmanaged = true;
};
};
microvm = {
interfaces = [
{
type = "tap";
id = "vm-test1";
mac = "02:00:00:00:00:01";
}
];
shares = [
{
source = "/nix/store";
mountPoint = "/nix/.ro-store";
tag = "ro-store";
proto = "virtiofs";
}
{
source = "/etc/ssh";
mountPoint = "/etc/ssh";
tag = "ssh";
proto = "virtiofs";
}
{
source = "/home/regent/gamedata";
mountPoint = "/root/gamedata";
tag = "gamedata";
proto = "virtiofs";
}
];
vcpu = 4;
mem = 8192;
};
}