pxeboot rewrite, bridge for qemu

This commit is contained in:
bogale 2026-10-27 00:08:14 +09:00
commit 1dd7fac8ed
10 changed files with 129 additions and 112 deletions

62
mods/host.nix Normal file
View file

@ -0,0 +1,62 @@
{ config, pkgs, ... }: {
boot = {
extraModulePackages = [ config.boot.kernelPackages.amneziawg ];
kernelModules = [ "amneziawg" ];
};
fileSystems = {
"/".options = [ "noatime" ];
"/boot".options = [ "noatime" ];
};
imports = [
../common.nix
./pxeboot.nix
./vps-init.nix
];
networking = {
networkmanager = {
dns = "dnsmasq";
ensureProfiles = {
environmentFiles = [ config.sops.secrets.wifi-env.path ];
profiles.home-wifi = {
connection = {
id = "home-wifi";
type = "wifi";
};
ipv4 = {
gateway = "10.1.0.1";
method = "manual";
};
ipv6 = {
gateway = "fc01::1";
method = "manual";
};
wifi-security = {
key-mgmt = "sae";
psk = "$BOGALE_5_PSK";
};
wifi.ssid = "bogale_5";
};
};
};
wg-quick.interfaces.awg0.type = "amneziawg";
};
services.dnsmasq = {
enable = true;
settings = {
bogus-priv = true;
cache-size = 4096;
domain-needed = true;
no-resolv = true;
server = [
"1.0.0.2"
"1.1.1.2"
"2606:4700:4700::1002"
"2606:4700:4700::1112"
];
};
};
sops.secrets = {
awg-obf = { };
wifi-env = { };
};
}

View file

@ -16,33 +16,47 @@
nat = {
enable = true;
enableIPv6 = true;
internalInterfaces = [ "enp1s0" ];
internalInterfaces = [ "br0" ];
};
networkmanager.ensureProfiles.profiles.static-eth = {
connection = {
id = "static-eth";
networkmanager.ensureProfiles.profiles = {
slave-ethernet.connection = {
controller = "br0";
id = "slave-ethernet";
type = "ethernet";
};
ipv4 = {
addresses = "10.2.0.1/16";
method = "manual";
static-bridge = {
connection = {
id = "static-bridge";
interface-name = "br0";
type = "bridge";
};
ipv4 = {
addresses = "10.2.0.1/16";
method = "manual";
};
ipv6 = {
addresses = "fc02::1/64";
method = "manual";
};
};
ipv6 = {
addresses = "fc02::1/64";
method = "manual";
dhcp-bridge.connection = {
id = "dhcp-bridge";
interface-name = "br0";
type = "bridge";
};
};
};
services = {
dnsmasq.settings = {
bind-dynamic = true;
bind-interfaces = true;
dhcp-boot = "grubx64.efi";
dhcp-range = [
"10.2.0.2,10.2.255.254,12h"
"fc02::2,fc02::ffff:ffff:ffff:ffff,12h"
];
enable-ra = true;
enable-tftp = true;
interface = "enp1s0";
interface = "br0";
tftp-root = "/srv/tftp";
};
nfs.server = {
@ -62,7 +76,7 @@
grub2_efi
xz
];
requiredBy = [ "nfs-server.service" ];
#requiredBy = [ "nfs-server.service" ];
script = ''
if [ ! -e /srv/nfs/nixos ]; then
mkdir -p /srv/nfs/nixos