forked from mirrors_public/oddlama_nix-config
feat: wip: add container backend to guests
This commit is contained in:
parent
83f1908e21
commit
abb8330d86
23 changed files with 256 additions and 208 deletions
|
@ -43,17 +43,13 @@
|
|||
# TODO track my github stats
|
||||
# services.telegraf.extraConfig.inputs.github = {};
|
||||
|
||||
meta.microvms.commonImports = [
|
||||
../../modules
|
||||
./microvms/common.nix
|
||||
];
|
||||
|
||||
#guests.adguardhome = {
|
||||
# backend = "microvm";
|
||||
# microvm = {
|
||||
# system = "x86_64-linux";
|
||||
# autostart = true;
|
||||
# macvtapInterface = "lan";
|
||||
# };
|
||||
# autostart = true;
|
||||
# zfs = {
|
||||
# enable = true;
|
||||
# pool = "rpool";
|
||||
|
@ -62,53 +58,47 @@
|
|||
#};
|
||||
|
||||
guests = let
|
||||
mkMicrovm = system: module: {
|
||||
backend = "microvm";
|
||||
microvm = {
|
||||
system = "x86_64-linux";
|
||||
autostart = true;
|
||||
};
|
||||
zfs = {
|
||||
enable = true;
|
||||
pool = "rpool";
|
||||
};
|
||||
modules = [
|
||||
../../modules
|
||||
module
|
||||
];
|
||||
};
|
||||
in {
|
||||
adguardhome = mkMicrovm "x86_64-linux" ./guests/adguardhome.nix;
|
||||
};
|
||||
|
||||
meta.microvms.vms = let
|
||||
defaultConfig = name: {
|
||||
system = "x86_64-linux";
|
||||
mkGuest = mainModule: {
|
||||
autostart = true;
|
||||
zfs = {
|
||||
enable = true;
|
||||
pool = "rpool";
|
||||
};
|
||||
modules = [
|
||||
# XXX: this could be interpolated in-place but statix has a bug https://github.com/nerdypepper/statix/issues/75
|
||||
(./microvms + "/${name}.nix")
|
||||
{node.secretsDir = ./secrets + "/${name}";}
|
||||
../../modules
|
||||
./guests/common.nix
|
||||
({config, ...}: {node.secretsDir = ./secrets + "/${config.node.name}";})
|
||||
mainModule
|
||||
];
|
||||
};
|
||||
|
||||
mkMicrovm = system: mainModule:
|
||||
mkGuest mainModule
|
||||
// {
|
||||
backend = "microvm";
|
||||
microvm = {
|
||||
system = "x86_64-linux";
|
||||
macvtapInterface = "lan";
|
||||
};
|
||||
};
|
||||
|
||||
mkContainer = mainModule:
|
||||
mkGuest mainModule
|
||||
// {
|
||||
backend = "container";
|
||||
container.macvlan = "lan";
|
||||
};
|
||||
in
|
||||
lib.mkIf (!minimal) (
|
||||
lib.genAttrs [
|
||||
"adguardhome"
|
||||
"forgejo"
|
||||
"grafana"
|
||||
"influxdb"
|
||||
"kanidm"
|
||||
"loki"
|
||||
"paperless"
|
||||
"vaultwarden"
|
||||
]
|
||||
defaultConfig
|
||||
);
|
||||
lib.mkIf (!minimal) {
|
||||
adguardhome = mkContainer ./guests/adguardhome.nix;
|
||||
forgejo = mkContainer ./guests/forgejo.nix;
|
||||
grafana = mkContainer ./guests/grafana.nix;
|
||||
influxdb = mkContainer ./guests/influxdb.nix;
|
||||
kanidm = mkContainer ./guests/kanidm.nix;
|
||||
loki = mkContainer ./guests/loki.nix;
|
||||
paperless = mkContainer ./guests/paperless.nix;
|
||||
vaultwarden = mkContainer ./guests/vaultwarden.nix;
|
||||
};
|
||||
|
||||
#ddclient = defineVm;
|
||||
#samba+wsdd = defineVm;
|
||||
|
|
|
@ -6,9 +6,8 @@
|
|||
sentinelCfg = nodes.sentinel.config;
|
||||
paperlessDomain = "paperless.${sentinelCfg.repo.secrets.local.personalDomain}";
|
||||
in {
|
||||
microvm.mem = 1024 * 12;
|
||||
# XXX: increase once real hardware is used
|
||||
microvm.vcpu = 4;
|
||||
# XXX: remove microvm.mem = 1024 * 12;
|
||||
# XXX: remove microvm.vcpu = 4;
|
||||
|
||||
meta.wireguard-proxy.sentinel.allowedTCPPorts = [
|
||||
config.services.paperless.port
|
|
@ -45,12 +45,12 @@ in {
|
|||
data = net.cidr.host 1 lanCidrv4;
|
||||
}
|
||||
];
|
||||
reservations = [
|
||||
{
|
||||
hw-address = nodes.ward-adguardhome.config.lib.microvm.mac;
|
||||
ip-address = dnsIp;
|
||||
}
|
||||
];
|
||||
# TODO reservations = [
|
||||
# TODO {
|
||||
# TODO hw-address = nodes.ward-adguardhome.config.lib.microvm.mac;
|
||||
# TODO ip-address = dnsIp;
|
||||
# TODO }
|
||||
# TODO ];
|
||||
}
|
||||
];
|
||||
};
|
||||
|
|
|
@ -124,11 +124,6 @@ in {
|
|||
};
|
||||
};
|
||||
|
||||
meta.microvms.networking = {
|
||||
baseMac = config.repo.secrets.local.networking.interfaces.lan.mac;
|
||||
macvtapInterface = "lan";
|
||||
};
|
||||
|
||||
# Allow accessing influx
|
||||
meta.wireguard.proxy-sentinel.client.via = "sentinel";
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue