Files
nixos/configuration/modules/virtualisation.nix

56 lines
1.6 KiB
Nix

{ pkgs, lib, config, inputs, ... }:
with lib;
{
options.virtualisation.containerManagement = mkOption {
type = types.enum [ "docker" "podman" ];
default = "docker";
};
config = {
virtualisation = {
containers = {
# Enable common container config files in /etc/containers
enable = true;
};
libvirtd = {
enable = true;
qemu = {
vhostUserPackages = [ pkgs.virtiofsd ];
ovmf.enable = true;
};
};
# remember to add the necessary users to the podman group
podman = {
enable = if (config.virtualisation.containerManagement == "podman") then true else false;
dockerSocket.enable = true;
dockerCompat = true;
defaultNetwork.settings.dns_enabled = true;
};
# remember to add the necessary users to the docker group
docker = {
enable = if (config.virtualisation.containerManagement == "docker") then true else false;
storageDriver = "btrfs";
};
waydroid = {
enable = true;
# 25.11 move to stable
package = inputs.nixpkgs-unstable.legacyPackages."${pkgs.system}".waydroid-nftables;
};
};
programs.virt-manager.enable = true;
environment.systemPackages = with pkgs;[
inputs.nixpkgs-unstable.legacyPackages."${pkgs.system}".waydroid-helper
] ++ optionals (config.virtualisation.containerManagement == "podman") [
docker-compose
# podman-compose
podman-tui
podman-desktop
] ++ optionals (config.virtualisation.containerManagement == "docker") [
lazydocker
];
};
}