freifunk: microvmize

This commit is contained in:
Astro 2022-06-13 20:00:35 +02:00
parent a96244697a
commit a4723c6cf2
3 changed files with 27 additions and 2 deletions

View File

@ -314,6 +314,7 @@
freifunk = nixosSystem' {
modules = [
microvm.nixosModules.microvm
./hosts/containers/freifunk
{
nixpkgs.overlays = with secrets.overlays; [

View File

@ -24,10 +24,33 @@ let
in {
imports = [
"${modulesPath}/profiles/minimal.nix"
../../../config/lxc-container.nix
../../../config/shared.nix
];
microvm = {
mem = 512;
hypervisor = "cloud-hypervisor";
shares = [ {
source = "/nix/store";
mountPoint = "/nix/.ro-store";
tag = "store";
proto = "virtiofs";
socket = "store.socket";
} ] ++ map (dir: {
source = "/var/lib/microvms/${config.networking.hostName}/${dir}";
mountPoint = "/${dir}";
tag = dir;
proto = "virtiofs";
socket = "${dir}.socket";
}) [ "etc" "home" "var"];
interfaces = [ {
type = "tap";
id = "freifunk";
mac = "00:de:13:cb3:9a:7b";
} ];
};
boot.tmpOnTmpfs = true;
boot.postBootCommands = ''
if [ ! -c /dev/net/tun ]; then

View File

@ -2,6 +2,7 @@
microvm.autostart = [ "oparl" "leon" "nfsroot" ];
c3d2.server.bridgePorts = {
serv = [ "oparl" "leon" "nfsroot" ];
core = [ "freifunk" ];
};
nix = {