diff --git a/flake.nix b/flake.nix index 50cf7d1..c74b34c 100755 --- a/flake.nix +++ b/flake.nix @@ -4,8 +4,6 @@ nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; nixos-hardware.url = "github:nixos/nixos-hardware/master"; - proxmox-nixos.url = "github:SaumonNet/proxmox-nixos"; - lix-module = { url = "https://git.lix.systems/lix-project/nixos-module/archive/2.93.0.tar.gz"; inputs.nixpkgs.follows = "nixpkgs"; @@ -85,20 +83,8 @@ ./hosts/valefar lix-module.nixosModules.default vscode-server.nixosModules.default + microvm.nixosModules.host - proxmox-nixos.nixosModules.proxmox-ve - - ({ pkgs, lib, ... }: { - services.proxmox-ve = { - enable = true; - ipAddress = "10.0.0.30"; - }; - - nixpkgs.overlays = [ - proxmox-nixos.overlays.x86_64-linux - ]; - }) - { imports = builtins.attrValues nixosModules; } ]; }; diff --git a/hosts/valefar/default.nix b/hosts/valefar/default.nix index e2df20a..1d3c272 100755 --- a/hosts/valefar/default.nix +++ b/hosts/valefar/default.nix @@ -5,17 +5,21 @@ # IMPORTS # ============================================================================= imports = [ + # Host-specific hardware ./hardware.nix ./secrets.nix ../../common/nvidia.nix + # Common secrets ../../host-secrets.nix + # Common modules shared across hosts ../../common/system.nix ../../common/users.nix ../../common/services.nix ../../common/efi.nix + # Hardware-specific (commented out) ../../common/nvidia.nix ]; @@ -55,23 +59,21 @@ networking.hostId = "2a07da90"; networking.firewall.enable = false; - services.proxmox-ve.bridges = [ "vmbr0" ]; - systemd.network.networks."10-lan" = { - matchConfig.Name = ["enp6s0"]; + matchConfig.Name = ["enp6s0" "vm-*"]; networkConfig = { - Bridge = "vmbr0"; + Bridge = "br0"; }; }; systemd.network.netdevs."br0" = { netdevConfig = { - Name = "vmbr0"; + Name = "br0"; Kind = "bridge"; }; }; systemd.network.networks."10-lan-bridge" = { - matchConfig.Name = "vmbr0"; + matchConfig.Name = "br0"; networkConfig = { Address = ["10.0.0.30/24" "2601:5c2:8400:26c0::30/64"]; Gateway = "10.0.0.1"; diff --git a/hosts/valefar/gamevm.nix b/hosts/valefar/gamevm.nix new file mode 100755 index 0000000..def1019 --- /dev/null +++ b/hosts/valefar/gamevm.nix @@ -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; + }; +} \ No newline at end of file