added stuff
This commit is contained in:
parent
e8d9044d2b
commit
9d0ebdfbd0
907 changed files with 70990 additions and 0 deletions
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
imports = [
|
||||
./distrobox.nix
|
||||
./podman.nix
|
||||
./qemu.nix
|
||||
./waydroid.nix
|
||||
];
|
||||
}
|
39
nyx/modules/core/common/system/virtualization/distrobox.nix
Normal file
39
nyx/modules/core/common/system/virtualization/distrobox.nix
Normal file
|
@ -0,0 +1,39 @@
|
|||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib) mkIf;
|
||||
|
||||
sys = config.modules.system.virtualization;
|
||||
in {
|
||||
config = mkIf sys.distrobox.enable {
|
||||
environment.systemPackages = with pkgs; [
|
||||
distrobox
|
||||
];
|
||||
|
||||
# if distrobox is enabled, update it periodically
|
||||
systemd.user = {
|
||||
timers."distrobox-update" = {
|
||||
enable = true;
|
||||
wantedBy = ["timers.target"];
|
||||
timerConfig = {
|
||||
OnBootSec = "1h";
|
||||
OnUnitActiveSec = "1d";
|
||||
Unit = "distrobox-update.service";
|
||||
};
|
||||
};
|
||||
|
||||
services."distrobox-update" = {
|
||||
enable = true;
|
||||
script = ''
|
||||
${pkgs.distrobox}/bin/distrobox upgrade --all
|
||||
'';
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
39
nyx/modules/core/common/system/virtualization/podman.nix
Normal file
39
nyx/modules/core/common/system/virtualization/podman.nix
Normal file
|
@ -0,0 +1,39 @@
|
|||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib) mkIf;
|
||||
|
||||
sys = config.modules.system.virtualization;
|
||||
in {
|
||||
config = mkIf (sys.docker.enable || sys.podman.enable) {
|
||||
environment.systemPackages = with pkgs; [
|
||||
podman-compose
|
||||
podman-desktop
|
||||
];
|
||||
|
||||
virtualisation.podman = {
|
||||
enable = true;
|
||||
|
||||
# make docker backwards compatible with docker interface
|
||||
# certain interface elements will be different, but unless hardcoded
|
||||
# does not cause problems for us
|
||||
dockerCompat = true;
|
||||
dockerSocket.enable = true;
|
||||
|
||||
defaultNetwork.settings.dns_enabled = true;
|
||||
|
||||
# enable nvidia support if any of the video drivers are nvidia
|
||||
enableNvidia = builtins.any (driver: driver == "nvidia") config.services.xserver.videoDrivers;
|
||||
|
||||
# prune images and containers periodically
|
||||
autoPrune = {
|
||||
enable = true;
|
||||
flags = ["--all"];
|
||||
dates = "weekly";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
62
nyx/modules/core/common/system/virtualization/qemu.nix
Normal file
62
nyx/modules/core/common/system/virtualization/qemu.nix
Normal file
|
@ -0,0 +1,62 @@
|
|||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib) mkIf;
|
||||
|
||||
sys = config.modules.system.virtualization;
|
||||
in {
|
||||
config = mkIf sys.qemu.enable {
|
||||
environment.systemPackages = with pkgs; [
|
||||
virt-manager
|
||||
virt-viewer
|
||||
qemu_kvm
|
||||
qemu
|
||||
];
|
||||
|
||||
virtualisation = {
|
||||
kvmgt.enable = true;
|
||||
spiceUSBRedirection.enable = true;
|
||||
|
||||
libvirtd = {
|
||||
enable = true;
|
||||
qemu = {
|
||||
package = pkgs.qemu_kvm;
|
||||
runAsRoot = false;
|
||||
swtpm.enable = true;
|
||||
|
||||
ovmf = {
|
||||
enable = true;
|
||||
packages = [pkgs.OVMFFull.fd];
|
||||
};
|
||||
|
||||
verbatimConfig = ''
|
||||
namespaces = []
|
||||
|
||||
# Whether libvirt should dynamically change file ownership
|
||||
dynamic_ownership = 0
|
||||
'';
|
||||
};
|
||||
|
||||
onBoot = "ignore";
|
||||
onShutdown = "shutdown";
|
||||
};
|
||||
};
|
||||
|
||||
# this allows libvirt to use pulseaudio socket
|
||||
# which is useful for virt-manager
|
||||
hardware.pulseaudio.extraConfig = ''
|
||||
load-module module-native-protocol-unix auth-group=qemu-libvirtd socket=/tmp/pulse-socket
|
||||
'';
|
||||
|
||||
# additional kernel modules that may be needed by libvirt
|
||||
boot.kernelModules = [
|
||||
"vfio-pci"
|
||||
];
|
||||
|
||||
# trust bridge network interface(s)
|
||||
networking.firewall.trustedInterfaces = ["virbr0" "br0"];
|
||||
};
|
||||
}
|
34
nyx/modules/core/common/system/virtualization/waydroid.nix
Normal file
34
nyx/modules/core/common/system/virtualization/waydroid.nix
Normal file
|
@ -0,0 +1,34 @@
|
|||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib) mkIf;
|
||||
|
||||
sys = config.modules.system;
|
||||
|
||||
waydroid-ui = pkgs.writeShellScriptBin "waydroid-ui" ''
|
||||
export WAYLAND_DISPLAY=wayland-0
|
||||
${pkgs.weston}/bin/weston -Swayland-1 --width=600 --height=1000 --shell="kiosk-shell.so" &
|
||||
WESTON_PID=$!
|
||||
|
||||
export WAYLAND_DISPLAY=wayland-1
|
||||
${pkgs.waydroid}/bin/waydroid show-full-ui &
|
||||
|
||||
wait $WESTON_PID
|
||||
waydroid session stop
|
||||
'';
|
||||
in {
|
||||
config = mkIf sys.virtualization.waydroid.enable {
|
||||
environment.systemPackages = with pkgs; [
|
||||
waydroid
|
||||
waydroid-ui
|
||||
];
|
||||
|
||||
virtualisation = {
|
||||
lxd.enable = sys.waydroid.enable; # TODO: make this also acceept sys.lxd.enable
|
||||
waydroid.enable = sys.waydroid.enable;
|
||||
};
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue