feat: added zookeeper package to microvm

This commit is contained in:
Nick 2025-11-28 00:45:51 -06:00
parent 743dd70775
commit 766a177ce6

View file

@ -1,5 +1,7 @@
{ {
flake, flake,
pkgs,
lib,
... ...
}: }:
let let
@ -16,33 +18,30 @@ in
config = { config = {
system.stateVersion = "24.05"; system.stateVersion = "24.05";
time.timeZone = "America/Winnipeg"; time.timeZone = "America/Winnipeg";
imports = [
flake.inputs.zookeeper.nixosModules.default
];
users.users.root.openssh.authorizedKeys.keys = flake.config.people.users.${user0}.sshKeys; users.users.root.openssh.authorizedKeys.keys = flake.config.people.users.${user0}.sshKeys;
services = { services.openssh = {
zookeeperbot.enable = true; enable = true;
openssh = { settings.PasswordAuthentication = false;
enable = true;
settings = {
PasswordAuthentication = false;
PermitRootLogin = "prohibit-password";
};
};
}; };
networking.firewall.allowedTCPPorts = [ 22 ];
networking.firewall.allowedTCPPorts = [
22
];
systemd = { systemd = {
services = {
zookeeper = {
serviceConfig = {
ExecStart = lib.getExe flake.self.packages.${pkgs.system}.zookeeper;
Restart = "always";
RestartSec = 2;
EnvironmentFile = "/run/secrets/env";
};
wantedBy = [ "multi-user.target" ];
};
systemd-networkd.wantedBy = [ "multi-user.target" ];
};
network = { network = {
enable = true; enable = true;
networks."20-lan" = { networks."20-lan" = {
matchConfig.Name = "enp0s5"; matchConfig.Name = "enp0s3";
addresses = [ addresses = [ { Address = "${serviceCfg.interface.ip}/24"; } ];
{ Address = "${serviceCfg.interface.ip}/24"; }
];
routes = [ routes = [
{ {
Destination = "${hostCfg.localhost.address1}/0"; Destination = "${hostCfg.localhost.address1}/0";
@ -55,18 +54,10 @@ in
]; ];
}; };
}; };
tmpfiles.rules = [
"Z ${serviceCfg.varPaths.path0} 0755 ${serviceCfg.name} ${serviceCfg.name} -"
];
}; };
systemd.services.systemd-networkd.wantedBy = [ "multi-user.target" ];
microvm = { microvm = {
vcpu = 2; vcpu = 1;
mem = 3072; mem = 1024;
hypervisor = "qemu"; hypervisor = "qemu";
interfaces = [ interfaces = [
{ {
@ -105,12 +96,10 @@ in
}; };
}; };
}; };
sops.secrets = { sops.secrets = {
"${serviceCfg.name}/env" = { "${serviceCfg.name}/env" = {
owner = "root"; owner = "root";
mode = "0600"; mode = "0600";
}; };
}; };
} }