create virtualisation component.
All checks were successful
Build all NixOS Configurations / nix build (push) Successful in 15m3s

This commit is contained in:
Ingolf Wagner 2024-08-11 14:46:03 +02:00
parent 7e1e13e897
commit 29e3213e4b
Signed by: palo
GPG key ID: 76BF5F1928B9618B
14 changed files with 106 additions and 70 deletions

View file

@ -10,6 +10,7 @@
./nixos
./terminal
./timezone.nix
./virtualisation
./yubikey.nix
];

View file

@ -5,9 +5,11 @@ let
cfg = config.components.mainUser;
# todo : use optionalList
dockerGroup =
if (config.virtualisation.docker.enable) then [ "docker" ] else [ ];
# todo : use optionalList
vboxGroup =
if (config.virtualisation.virtualbox.host.enable) then
[ "vboxusers" ]

View file

@ -0,0 +1,15 @@
{ config, lib, ... }:
{
imports = [
./docker.nix
./podman.nix
./virtualbox.nix
./qemu.nix
];
options.components.virtualisation.enable = lib.mkOption {
type = lib.types.bool;
default = false;
};
}

View file

@ -0,0 +1,16 @@
{ config, lib, pkgs, ... }:
with lib;
{
options.components.virtualisation.docker.enable = lib.mkOption {
type = lib.types.bool;
default = config.components.virtualisation.enable;
};
config = mkIf config.components.virtualisation.docker.enable {
virtualisation.docker.enable = true;
};
}

View file

@ -0,0 +1,19 @@
{ config, lib, pkgs, ... }:
with lib;
{
options.components.virtualisation.podman.enable = lib.mkOption {
type = lib.types.bool;
default = config.components.virtualisation.enable;
};
config = mkIf config.components.virtualisation.podman.enable {
virtualisation.podman.enable = true;
# make sure /var/lib/containers/storage is a zfs dataset
virtualisation.podman.extraPackages = [ pkgs.zfs ];
};
}

View file

@ -0,0 +1,27 @@
{ config, lib, pkgs, ... }:
with lib;
{
options.components.virtualisation.qemu.enable = lib.mkOption {
type = lib.types.bool;
default = config.components.virtualisation.enable;
};
config = mkIf config.components.virtualisation.qemu.enable {
virtualisation.libvirtd.enable = true;
#virtualisation.libvirtd.allowedBridges = ["virbr0"];
virtualisation.libvirtd.onShutdown = "shutdown";
environment.systemPackages = [
pkgs.qemu_kvm
#(pkgs.quickemu.override { qemu_full = pkgs.qemu_kvm; })
pkgs.quickemu
pkgs.virt-manager
];
users.users.mainUser.extraGroups = [ "libvirtd" ];
};
}

View file

@ -0,0 +1,21 @@
{ config, lib, pkgs, ... }:
with lib;
{
options.components.virtualisation.virtualbox.enable = lib.mkOption {
type = lib.types.bool;
default = config.components.virtualisation.enable;
};
config = mkIf config.components.virtualisation.virtualbox.enable {
virtualisation.virtualbox = {
host.enable = true;
guest.enable = true;
};
users.extraGroups.vboxusers.members = [ config.users.users.mainUser.name ];
};
}

View file

@ -6,7 +6,6 @@
./hardware-configuration
./syncthing.nix
./qemu.nix
./network-tinc.nix
./network-tinc_retiolum.nix
@ -38,6 +37,8 @@
# (promptKey "pushover.api_key");
components.virtualisation.enable = true;
components.gui.enable = true;
components.mainUser.enable = true;
components.media.enable = true;
@ -124,16 +125,6 @@
services.printing.enable = true;
virtualisation = {
docker.enable = true;
podman.enable = true;
virtualbox = {
host.enable = true;
guest.enable = true;
};
};
users.extraGroups.vboxusers.members = [ config.users.users.mainUser.name ];
# for congress and streaming
hardware.graphics.enable = true;

View file

@ -1,17 +0,0 @@
{ config, lib, pkgs, ... }:
{
virtualisation.libvirtd.enable = true;
#virtualisation.libvirtd.allowedBridges = ["virbr0"];
virtualisation.libvirtd.onShutdown = "shutdown";
environment.systemPackages = [
pkgs.qemu_kvm
#(pkgs.quickemu.override { qemu_full = pkgs.qemu_kvm; })
pkgs.quickemu
pkgs.virt-manager
];
users.users.mainUser.extraGroups = [ "libvirtd" ];
}

View file

@ -66,7 +66,6 @@
services.printing.enable = false;
virtualisation.podman.extraPackages = [ pkgs.zfs ]; # make sure /var/lib/containers/storage is a zfs dataset
networking.hostName = "chungus";

View file

@ -6,7 +6,6 @@
./hardware-configuration.nix
./syncthing.nix
./qemu.nix
./network-tinc.nix
./network-tinc_retiolum.nix
@ -22,6 +21,8 @@
boot.loader.efi.canTouchEfiVariables = true;
boot.tmp.useTmpfs = true; # make /tmp a tmpfs (performance!)
components.virtualisation.enable = true;
components.gui.enable = true;
components.gui.xorg.enable = true;
components.gui.wayland.enable = false;
@ -111,17 +112,6 @@
services.printing.enable = true;
virtualisation = {
docker.enable = true;
podman.enable = true;
virtualbox = {
host.enable = true;
guest.enable = true;
};
};
users.extraGroups.vboxusers.members = [ config.users.users.mainUser.name ];
samba-share = {
enable = false;
folders = {

View file

@ -1,17 +0,0 @@
{ config, lib, pkgs, ... }:
{
virtualisation.libvirtd.enable = true;
#virtualisation.libvirtd.allowedBridges = ["virbr0"];
virtualisation.libvirtd.onShutdown = "shutdown";
environment.systemPackages = [
pkgs.qemu_kvm
#(pkgs.quickemu.override { qemu_full = pkgs.qemu_kvm; })
pkgs.quickemu
pkgs.virt-manager
];
users.users.mainUser.extraGroups = [ "libvirtd" ];
}

View file

@ -3,10 +3,7 @@ let inherit (utils) escapeSystemdPath;
in
{
virtualisation = {
# docker.enable = true;
podman.enable = true;
};
virtualisation.podman.enable = true;
#nix.settings.trusted-users = [ "root" "gitea-runner"];
nix.settings.allowed-users = [ "*" "gitea-runner" ];

View file

@ -84,13 +84,5 @@
};
};
virtualisation = {
docker.enable = false;
virtualbox = {
host.enable = false;
guest.enable = false;
};
};
}