set bolty to static ip address and create a bridge

This commit is contained in:
Cyryl Płotnicki 2022-11-09 17:50:48 +00:00
parent 1762022e66
commit ce31b2de37
2 changed files with 35 additions and 16 deletions

View file

@ -1,4 +1,8 @@
{ config, pkgs, inputs, lib, ... }: { { config, pkgs, inputs, lib, ... }:
let
physicalInterface = "enp4s0";
bridgeInterface = "br0";
in {
imports = [ imports = [
./bolty-boot.nix ./bolty-boot.nix
./real-hardware.nix ./real-hardware.nix
@ -12,7 +16,24 @@
networking = { networking = {
hostName = "bolty"; hostName = "bolty";
useDHCP = false; useDHCP = false;
interfaces.enp4s0.useDHCP = true; defaultGateway = {
address = "10.0.0.1";
interface = "${bridgeInterface}";
};
nameservers = [ "91.239.100.100" "89.233.43.71" "1.1.1.1" ];
interfaces = {
"${physicalInterface}" = {
useDHCP = false;
wakeOnLan.enable = true;
};
"${bridgeInterface}" = {
ipv4.addresses = [{
"address" = "10.0.0.8";
"prefixLength" = 24;
}];
};
};
bridges = { "${bridgeInterface}".interfaces = [ "${physicalInterface}" ]; };
}; };
powerManagement.cpuFreqGovernor = lib.mkDefault "powersave"; powerManagement.cpuFreqGovernor = lib.mkDefault "powersave";

View file

@ -1,19 +1,17 @@
{ config, pkgs, inputs, lib, ... }: { { config, pkgs, inputs, lib, ... }:
let port = 8123;
in {
imports = [ ]; imports = [ ];
networking.firewall.allowedTCPPorts = [ 8123 ]; networking.firewall.allowedTCPPorts = [ port ];
virtualisation.oci-containers = {
backend = "podman"; boot.kernelModules = [ "kvm_amd" ];
containers.homeassistant = { virtualisation = {
volumes = [ "home-assistant:/config" ]; libvirtd = {
environment.TZ = "Europe/London"; enable = true;
image = qemu.ovmf.enable = true;
"ghcr.io/home-assistant/home-assistant:stable@sha256:5e3d2dde141812a4a54c140f3cbf52b9c74168bf25e8560978f499578902a363";
extraOptions = [
"--network=host"
"--privileged"
"--device=/dev/ttyACM1:/dev/ttyACM1"
];
}; };
}; };
environment.systemPackages = with pkgs; [ qemu virt-manager usbutils ];
} }