rework modules

Signed-off-by: unexplrd <unexplrd@linerds.us>
This commit is contained in:
2025-06-19 10:22:49 +03:00
parent 422b0551db
commit f3bf120805
15 changed files with 38 additions and 41 deletions

View File

@ -0,0 +1,7 @@
{
imports = [
./libvirt.nix
./podman.nix
./docker.nix
];
}

View File

@ -0,0 +1,29 @@
{
# pkgs,
config,
lib,
...
}:
with lib; let
cfg = config.module.virt.docker;
in {
options = {
module.virt.docker.enable =
mkEnableOption "enable docker";
};
config = mkIf cfg.enable {
virtualisation.docker = {
enable = true;
rootless = {
enable = true;
setSocketVariable = true;
};
storageDriver = "btrfs";
autoPrune.enable = true;
#defaultNetwork.settings = {
# dns_enabled = true;
#};
};
virtualisation.oci-containers.backend = "docker";
};
}

View File

@ -0,0 +1,35 @@
{
pkgs,
config,
lib,
...
}:
with lib; let
cfg = config.module.virt.libvirt;
in {
options = {
module.virt.libvirt.enable =
mkEnableOption "enables virtualisation";
};
config = mkIf cfg.enable {
virtualisation.libvirtd = {
enable = true;
qemu = {
package = pkgs.qemu_kvm;
runAsRoot = false;
swtpm.enable = true;
vhostUserPackages = [pkgs.virtiofsd];
ovmf = {
enable = true;
packages = [
(pkgs.OVMF.override {
secureBoot = true;
tpmSupport = true;
})
.fd
];
};
};
};
};
}

View File

@ -0,0 +1,29 @@
{
pkgs,
config,
lib,
...
}:
with lib; let
cfg = config.module.virt.podman;
in {
options = {
module.virt.podman.enable =
mkEnableOption "enables podman";
};
config = mkIf cfg.enable {
virtualisation = {
containers.enable = true;
podman = {
enable = true;
dockerCompat = true;
defaultNetwork.settings.dns_enabled = true;
};
};
virtualisation.oci-containers.backend = "podman";
environment.systemPackages = with pkgs; [
podman-tui
podman-compose
];
};
}