37 lines
765 B
Nix
37 lines
765 B
Nix
{ lib, pkgs, ... }:
|
|
let
|
|
attrs = {
|
|
forgejo-runner = {
|
|
ipv4 = "10.0.0.2";
|
|
subnet = "/24";
|
|
mac = "02:00:00:00:00:01";
|
|
};
|
|
};
|
|
genVMConfig = name: addr: {
|
|
restartIfChanged = true;
|
|
pkgs = pkgs;
|
|
config = {
|
|
microvm = {
|
|
shares = lib.mkIf (addr.ro-store == true) [
|
|
{
|
|
source = "/nix/store";
|
|
mountPoint = "/nix/.ro-store";
|
|
tag = "ro-store";
|
|
proto = "virtiofs";
|
|
}
|
|
];
|
|
interfaces = [
|
|
{
|
|
type = "tap";
|
|
id = name;
|
|
mac = attrs.${name}.mac;
|
|
}
|
|
];
|
|
};
|
|
}
|
|
// import ./configuration.nix { inherit name attrs; };
|
|
};
|
|
in
|
|
{
|
|
microvm.vms = lib.mapAttrs genVMConfig attrs;
|
|
}
|