Clean up microvm bits

This commit is contained in:
Gene Liverman 2024-04-02 23:28:56 -04:00
parent 48f74e7c6a
commit 891be5631c
5 changed files with 50 additions and 178 deletions

View file

@ -0,0 +1,31 @@
{ ... }: {
containers.nginx-proxy = {
autoStart = true;
privateNetwork = true;
hostBridge = "br1-23";
localAddress = "192.168.23.21/24";
config = { config, pkgs, lib, ... }: {
system.stateVersion = "23.11";
services.nginx = {
enable = true;
virtualHosts.default.listen = [{
port = 80;
addr = "0.0.0.0";
}];
};
networking = {
firewall = {
enable = true;
allowedTCPPorts = [ 80 ];
};
defaultGateway = "192.168.23.1";
# Use systemd-resolved inside the container
# Workaround for bug https://github.com/NixOS/nixpkgs/issues/162686
useHostResolvConf = lib.mkForce false;
};
services.resolved.enable = true;
};
};
}

View file

@ -1,32 +0,0 @@
{ inputs, config, hostname, microvm, pkgs, sops-nix, username, ... }: {
microvm = {
hypervisor = "qemu";
socket = "control.socket";
vcpu = 1;
volumes = [
{
#image = "/persist/microvm/${config.networking.hostName}-var.img";
image = "/tmp/${config.networking.hostName}-var.img";
mountPoint = "/var";
size = 1024;
}
];
shares = [
{
# use "virtiofs" for MicroVMs that are started by systemd
proto = "9p";
tag = "ro-store";
# a host's /nix/store will be picked up so that no
# squashfs/erofs will be built for it.
source = "/nix/store";
mountPoint = "/nix/.ro-store";
}
];
interfaces = [{
type = "tap";
id = "vm-nginx-proxy";
mac = "02:00:00:00:00:01";
}];
};
}

View file

@ -1,8 +1,8 @@
{ inputs, config, hostname, microvm, pkgs, sops-nix, username, ... }: {
{ inputs, config, hostname, pkgs, sops-nix, username, ... }: {
imports = [
./hardware-configuration.nix
./audiobookshelf.nix
#../microvms/nginx-proxy
../containers/nginx-proxy.nix
];
system.stateVersion = "23.11";
@ -20,36 +20,6 @@
};
};
containers.nginx-proxy = {
autoStart = true;
privateNetwork = true;
hostBridge = "br1-23";
localAddress = "192.168.23.21/24";
config = { config, pkgs, lib, ... }: {
system.stateVersion = "23.11";
services.nginx = {
enable = true;
virtualHosts.default.listen = [{
port = 80;
addr = "0.0.0.0";
}];
};
networking = {
firewall = {
enable = true;
allowedTCPPorts = [ 80 ];
};
defaultGateway = "192.168.23.1";
# Use systemd-resolved inside the container
# Workaround for bug https://github.com/NixOS/nixpkgs/issues/162686
useHostResolvConf = lib.mkForce false;
};
services.resolved.enable = true;
};
};
environment.systemPackages = with pkgs; [
intel-gpu-tools
jellyfin