finally system boots with new config

need to add all my stuff btw
This commit is contained in:
2026-07-11 23:14:30 -05:00
parent bbdb6339b0
commit c5209b0d90
17 changed files with 578 additions and 252 deletions
+1 -1
View File
@@ -3,6 +3,6 @@
imports = [
./podman.nix
./qemu.nix
./lima.nix
./options.nix
];
}
+13 -5
View File
@@ -1,7 +1,15 @@
{ pkgs, ... }:
{
environment.systemPackages = with pkgs; [
lima
];
config,
lib,
pkgs,
}:
let
cfg = config.workstation.virtualization.lima;
in
{
config = lib.mkIf cfg.enable {
environment.systemPackages = with pkgs; [
lima
];
};
}
+46
View File
@@ -0,0 +1,46 @@
{
lib,
...
}:
{
options.workstation.virtualization = {
user = lib.mkOption {
type = lib.types.str;
default = "river";
description = "The user to run virtualization services as.";
};
# podman
podman = {
enable = lib.mkEnableOption "Podman support";
packages = {
enable = lib.mkEnableOption "relevant Podman packages";
};
};
# qemu
qemu = {
enable = lib.mkEnableOption "QEMU support";
containers = lib.mkEnableOption "container support for QEMU";
spiceUSBRedirection = lib.mkEnableOption "spice USB redirection support for QEMU";
virtManager = lib.mkEnableOption "virt-manager support for QEMU";
bootModules = lib.mkOption {
type = lib.types.listOf lib.types.str;
default = [
"kvm-intel"
"kvm-amd"
];
description = "The kernel modules to load for QEMU support.";
};
};
lima = {
enable = lib.mkEnableOption "Lima lite VM";
};
};
}
+47 -34
View File
@@ -1,42 +1,55 @@
{ pkgs, ... }:
{
virtualisation = {
oci-containers.backend = "podman";
containers.registries.search = [ "docker.io" ];
podman = {
enable = true;
config,
lib,
pkgs,
...
}:
let
cfg = config.workstation.virtualization;
in
{
config = lib.mkMerge [
(lib.mkIf cfg.podman.enable {
virtualisation = {
oci-containers.backend = "podman";
podman = {
dockerCompat = true;
defaultNetwork.settings.dns_enabled = true;
};
};
enable = true;
# For rootless containers
security.unprivilegedUsernsClone = true;
dockerCompat = true;
defaultNetwork.settings.dns_enabled = true;
};
};
users.users.river = {
subUidRanges = [
{
startUid = 100000;
count = 65536;
}
];
subGidRanges = [
{
startGid = 100000;
count = 65536;
}
];
# For rootless containers
security.unprivilegedUsernsClone = true;
extraGroups = [
"podman"
];
};
users.users.${cfg.user} = {
subUidRanges = [
{
startUid = 100000;
count = 65536;
}
];
subGidRanges = [
{
startGid = 100000;
count = 65536;
}
];
environment.systemPackages = with pkgs; [
podman
podman-compose
podman-desktop
extraGroups = [
"podman"
];
};
})
(lib.mkIf cfg.podman.packages.enable {
environment.systemPackages = with pkgs; [
podman
podman-compose
podman-desktop
];
})
];
}
+36 -22
View File
@@ -1,30 +1,44 @@
{ pkgs, ... }:
{
virtualisation.spiceUSBRedirection.enable = true;
virtualisation = {
containers.enable = true;
libvirtd = {
enable = true;
qemu = {
package = pkgs.qemu_kvm;
swtpm.enable = true;
config,
lib,
pkgs,
...
}:
let
cfg = config.workstation.virtualization;
in
{
config = lib.mkMerge [
(lib.mkIf cfg.qemu.enable {
virtualisation = {
libvirtd = {
enable = true;
qemu = {
package = pkgs.qemu_kvm;
swtpm.enable = true;
};
};
};
};
};
users.users.${cfg.user}.extraGroups = [
"libvirtd"
"kvm"
];
})
networking.firewall.trustedInterfaces = [ "virbr0" ];
(lib.mkIf cfg.qemu.spiceUSBRedirection {
virtualisation.spiceUSBRedirection.enable = true;
})
programs.virt-manager.enable = true;
(lib.mkIf cfg.qemu.virtManager {
programs.virt-manager.enable = true;
})
users.users.river.extraGroups = [
"libvirtd"
"kvm"
];
(lib.mkIf (cfg.qemu.enable && cfg.qemu.containers) {
virtualisation.containers.enable = true;
})
boot.kernelModules = [
"kvm-intel"
"kvm-amd"
(lib.mkIf cfg.qemu.enable {
boot.kernelModules = cfg.qemu.bootModules;
})
];
}