Add docker, virtualization
This commit is contained in:
parent
75a35714f2
commit
d918a4ae44
@ -10,6 +10,6 @@
|
||||
# ./pipewire
|
||||
./theming
|
||||
# ./users
|
||||
# ./virtualization
|
||||
./virtualization
|
||||
];
|
||||
}
|
||||
|
||||
89
modules/components/virtualization/default.nix
Normal file
89
modules/components/virtualization/default.nix
Normal file
@ -0,0 +1,89 @@
|
||||
{
|
||||
lib,
|
||||
config,
|
||||
pkgs,
|
||||
username,
|
||||
vars,
|
||||
...
|
||||
}:
|
||||
let
|
||||
cfg = config.virtualization;
|
||||
in
|
||||
{
|
||||
options = {
|
||||
virtualization = {
|
||||
enable = lib.mkEnableOption "Enable virtualization in NixOS & home-manager";
|
||||
};
|
||||
};
|
||||
config = lib.mkIf cfg.enable {
|
||||
environment = {
|
||||
systemPackages = with pkgs; [
|
||||
docker-compose
|
||||
podlet
|
||||
quickemu
|
||||
spice
|
||||
spice-protocol
|
||||
virt-manager
|
||||
virtiofsd
|
||||
virtio-win
|
||||
win-spice
|
||||
];
|
||||
};
|
||||
services = {
|
||||
spice-vdagentd.enable = true;
|
||||
};
|
||||
virtualisation = {
|
||||
docker = {
|
||||
enable = true;
|
||||
enableOnBoot = true;
|
||||
autoPrune = {
|
||||
enable = true;
|
||||
dates = "weekly";
|
||||
};
|
||||
defaultNetwork.settings.dns_enabled = true;
|
||||
|
||||
enableNvidia = if vars.nvidia then true else false;
|
||||
};
|
||||
libvirtd = {
|
||||
# Make sure you run this once: "sudo virsh net-autostart default"
|
||||
enable = true;
|
||||
qemu = {
|
||||
swtpm.enable = true;
|
||||
ovmf.enable = true;
|
||||
ovmf.packages = [ pkgs.OVMFFull.fd ];
|
||||
};
|
||||
};
|
||||
spiceUSBRedirection.enable = true;
|
||||
vmVariant = {
|
||||
virtualisation = {
|
||||
memorySize = 4096;
|
||||
cores = 3;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
users = {
|
||||
users = {
|
||||
${username} = {
|
||||
extraGroups = [
|
||||
"docker"
|
||||
"libvirtd"
|
||||
"podman"
|
||||
];
|
||||
# quadlets
|
||||
autoSubUidGidRange = true;
|
||||
linger = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
home-manager.users.${username} = {
|
||||
dconf.settings = {
|
||||
"org/virt-manager/virt-manager/connections" = {
|
||||
autoconnect = [ "qemu:///system" ];
|
||||
uris = [ "qemu:///system" ];
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
@ -68,7 +68,7 @@ in
|
||||
secrets.enable = true;
|
||||
syncthing.enable = true;
|
||||
# users.enable = true;
|
||||
# virtualization.enable = true;
|
||||
virtualization.enable = false;
|
||||
|
||||
console = {
|
||||
earlySetup = true;
|
||||
|
||||
@ -18,6 +18,7 @@ in
|
||||
config = lib.mkIf cfg.enable {
|
||||
# Custom modules
|
||||
base.enable = true;
|
||||
virtualization.enable = true;
|
||||
catppuccinTheming.enable = lib.mkForce false;
|
||||
packages.enable = lib.mkForce false;
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user