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 = [
./bolty-boot.nix
./real-hardware.nix
@ -12,7 +16,24 @@
networking = {
hostName = "bolty";
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";

View file

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