commit then think
This commit is contained in:
29
modules/nixos/system/virtual/docker.nix
Normal file
29
modules/nixos/system/virtual/docker.nix
Normal file
@ -0,0 +1,29 @@
|
||||
{
|
||||
# pkgs,
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
cfg = config.virtual.docker;
|
||||
in {
|
||||
options = {
|
||||
virtual.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";
|
||||
};
|
||||
}
|
35
modules/nixos/system/virtual/libvirt.nix
Normal file
35
modules/nixos/system/virtual/libvirt.nix
Normal file
@ -0,0 +1,35 @@
|
||||
{
|
||||
pkgs,
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
cfg = config.virtual.libvirt;
|
||||
in {
|
||||
options = {
|
||||
virtual.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
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
7
modules/nixos/system/virtual/main.nix
Normal file
7
modules/nixos/system/virtual/main.nix
Normal file
@ -0,0 +1,7 @@
|
||||
{
|
||||
imports = [
|
||||
./libvirt.nix
|
||||
./podman.nix
|
||||
./docker.nix
|
||||
];
|
||||
}
|
28
modules/nixos/system/virtual/podman.nix
Normal file
28
modules/nixos/system/virtual/podman.nix
Normal file
@ -0,0 +1,28 @@
|
||||
{
|
||||
pkgs,
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
cfg = config.virtual.podman;
|
||||
in {
|
||||
options = {
|
||||
virtual.podman.enable =
|
||||
mkEnableOption "enables podman";
|
||||
};
|
||||
config = mkIf cfg.enable {
|
||||
virtualisation = {
|
||||
containers.enable = true;
|
||||
podman = {
|
||||
enable = true;
|
||||
dockerCompat = true;
|
||||
defaultNetwork.settings.dns_enabled = true;
|
||||
};
|
||||
};
|
||||
environment.systemPackages = with pkgs; [
|
||||
podman-tui
|
||||
podman-compose
|
||||
];
|
||||
};
|
||||
}
|
Reference in New Issue
Block a user