add declarative vm to valefar
This commit is contained in:
parent
7a31cdd170
commit
915e2d6377
4 changed files with 202 additions and 22 deletions
|
@ -1,5 +1,5 @@
|
|||
# hosts/valefar/configuration.nix (or default.nix)
|
||||
{ config, lib, pkgs, modulesPath, inputs, ... }:
|
||||
{ config, lib, pkgs, modulesPath, microvm, inputs, ... }:
|
||||
{
|
||||
# =============================================================================
|
||||
# IMPORTS
|
||||
|
@ -8,6 +8,7 @@
|
|||
# Host-specific hardware
|
||||
./hardware.nix
|
||||
./secrets.nix
|
||||
../../common/nvidia.nix
|
||||
|
||||
# Common modules shared across hosts
|
||||
../../common/system.nix
|
||||
|
@ -42,7 +43,7 @@
|
|||
# =============================================================================
|
||||
# NETWORKING
|
||||
# =============================================================================
|
||||
networking = {
|
||||
/*networking = {
|
||||
hostName = "valefar";
|
||||
hostId = "2a07da90";
|
||||
firewall.enable = false;
|
||||
|
@ -51,6 +52,35 @@
|
|||
useDHCP = true;
|
||||
firewall.allowedTCPPorts = [ 22 80 443 2049 2456 2457 9000 9001 9002 ];
|
||||
firewall.allowedUDPPorts = [ 2049 ];
|
||||
};*/
|
||||
networking.useNetworkd = true;
|
||||
systemd.network.enable = true;
|
||||
networking.hostName = "valefar";
|
||||
networking.hostId = "2a07da90";
|
||||
networking.firewall.enable = false;
|
||||
|
||||
systemd.network.networks."10-lan" = {
|
||||
matchConfig.Name = ["enp6s0" "vm-*"];
|
||||
networkConfig = {
|
||||
Bridge = "br0";
|
||||
};
|
||||
};
|
||||
systemd.network.netdevs."br0" = {
|
||||
netdevConfig = {
|
||||
Name = "br0";
|
||||
Kind = "bridge";
|
||||
};
|
||||
};
|
||||
|
||||
systemd.network.networks."10-lan-bridge" = {
|
||||
matchConfig.Name = "br0";
|
||||
networkConfig = {
|
||||
Address = ["10.0.0.30/24" "2601:5c2:8400:26c0::30/64"];
|
||||
Gateway = "10.0.0.1";
|
||||
DNS = ["10.0.0.210" "1.1.1.1" "1.0.0.1"];
|
||||
IPv6AcceptRA = true;
|
||||
};
|
||||
linkConfig.RequiredForOnline = "routable";
|
||||
};
|
||||
|
||||
# DNS resolution
|
||||
|
@ -158,22 +188,19 @@
|
|||
inputs.agenix.packages.x86_64-linux.default
|
||||
];
|
||||
|
||||
|
||||
# =============================================================================
|
||||
# COMMENTED OUT / DISABLED
|
||||
# VIRTUAL MACHINES
|
||||
# =============================================================================
|
||||
# Remote unlock via SSH (commented out)
|
||||
# boot.kernelParams = [ "ip=dhcp" ];
|
||||
# boot.initrd = {
|
||||
# availableKernelModules = [ "r8169" ];
|
||||
# network = {
|
||||
# enable = true;
|
||||
# ssh = {
|
||||
# enable = true;
|
||||
# port = 22;
|
||||
# authorizedKeys = [ "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJ0pU82lV9dSjkgYbdh9utZ5CDM2dPN70S5fBqN1m3Pb" ];
|
||||
# hostKeys = [ "/etc/secrets/initrd/ssh_host_rsa_key" ];
|
||||
# shell = "/bin/cryptsetup-askpass";
|
||||
# };
|
||||
# };
|
||||
# };
|
||||
systemd.services."microvm@".after = [ "microvm-virtiofsd@%i.service" ];
|
||||
|
||||
microvm.vms = {
|
||||
gameservers = {
|
||||
config = import ./gamevm.nix;
|
||||
};
|
||||
};
|
||||
|
||||
microvm.autostart = [
|
||||
"gameservers"
|
||||
];
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue