This commit is contained in:
4DBug
2026-02-03 15:05:17 -06:00
parent bac01b58e4
commit d25f508b25
3 changed files with 421 additions and 6 deletions

View File

@@ -13,9 +13,29 @@
url = "github:nix-community/stylix"; url = "github:nix-community/stylix";
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";
}; };
nixVirt = {
url = "https://flakehub.com/f/AshleyYakeley/NixVirt/*.tar.gz";
inputs.nixpkgs.follows = "nixpkgs";
};
noctalia = {
url = "github:noctalia-dev/noctalia-shell";
inputs.nixpkgs.follows = "nixpkgs";
};
quickshell = {
url = "git+https://git.outfoxxed.me/quickshell/quickshell";
inputs.nixpkgs.follows = "nixpkgs";
};
dms-plugin-registry = {
url = "github:AvengeMedia/dms-plugin-registry";
inputs.nixpkgs.follows = "nixpkgs";
};
}; };
outputs = inputs@{ self, nixpkgs, stylix, home-manager, flatpaks, hytale-launcher, ... }: outputs = inputs@{ self, nixpkgs, stylix, home-manager, flatpaks, hytale-launcher, nixVirt, noctalia, quickshell, dms-plugin-registry, ... }:
let let
deviceType = import /etc/nixos/device.nix; deviceType = import /etc/nixos/device.nix;
system = "x86_64-linux"; system = "x86_64-linux";
@@ -36,7 +56,7 @@
flatpaks.nixosModules.nix-flatpak flatpaks.nixosModules.nix-flatpak
stylix.nixosModules.stylix nixVirt.nixosModules.default
./configuration.nix ./configuration.nix
]; ];

View File

@@ -1,11 +1,17 @@
{ lib, config, inputs, pkgs, options, desktop, ... }: { lib, config, inputs, pkgs, options, desktop, ... }:
let let
#inherit (inputs) nixVirt;
#nixvirt.lib = nixVirt.lib;
nix-gaming = import (builtins.fetchTarball "https://github.com/fufexan/nix-gaming/archive/master.tar.gz"); nix-gaming = import (builtins.fetchTarball "https://github.com/fufexan/nix-gaming/archive/master.tar.gz");
nix-alien = import ( nix-alien = import (
builtins.fetchTarball "https://github.com/thiagokokada/nix-alien/tarball/master" builtins.fetchTarball "https://github.com/thiagokokada/nix-alien/tarball/master"
) {}; ) {};
#nvramPath = "/home/bug/.local/share/libvirt/qemu";
#win10Config = import ./vms/win10.nix { inherit pkgs nvramPath; uuid = "c08333dc-33f9-4117-969a-ac46e19ba81f"; };
in in
{ {
imports = [ imports = [
@@ -29,7 +35,7 @@ in
users.users.bug = { users.users.bug = {
isNormalUser = true; isNormalUser = true;
description = "Bug"; description = "Bug";
extraGroups = [ "networkmanager" "wheel" "audio" "video" "libvirtd" "ydotool" ]; extraGroups = [ "networkmanager" "wheel" "audio" "video" "libvirtd" "ydotool" "dialout" ];
}; };
hardware = { hardware = {
@@ -138,7 +144,6 @@ in
}; };
services.cloudflare-warp.enable = !desktop; services.cloudflare-warp.enable = !desktop;
security = { security = {
rtkit.enable = true; rtkit.enable = true;
@@ -318,6 +323,18 @@ in
sha256 = "sha256-SUxfyovC2umZmsOj5bOTZ8WfGCpnWcz7svOESwNekV0="; sha256 = "sha256-SUxfyovC2umZmsOj5bOTZ8WfGCpnWcz7svOESwNekV0=";
}}"; }}";
} }
# add Polytoria client
# https://cdn.polytoria.com/releases/installer/linux/Polytoria%20Setup%204.12.0.flatpak
{
appId = "com.polytoria.launcher";
sha256 = "sha256-VjhNiJfSdCtlH2SuP3Mn8jjOrx5xcOqhtDKaWYIwxYg=";
bundle = "${pkgs.fetchurl {
url = "https://github.com/4DBug/poly/releases/download/poly/poly.flatpak";
sha256 = "sha256-VjhNiJfSdCtlH2SuP3Mn8jjOrx5xcOqhtDKaWYIwxYg=";
}}";
}
]; ];
overrides = { overrides = {
@@ -400,7 +417,6 @@ in
obsidian obsidian
vesktop vesktop
nicotine-plus nicotine-plus
ptyxis
fastfetch fastfetch
tree tree
gh gh
@@ -408,7 +424,6 @@ in
samrewritten samrewritten
impression impression
# resources
mission-center mission-center
authenticator authenticator
@@ -424,6 +439,8 @@ in
kooha kooha
loupe loupe
arduino-ide
]; ];
environment = { environment = {
@@ -546,7 +563,15 @@ in
extraPkgs = pkgs: [ pkgs.xorg.libxshmfence pkgs.linuxPackages.nvidia_x11 ]; extraPkgs = pkgs: [ pkgs.xorg.libxshmfence pkgs.linuxPackages.nvidia_x11 ];
}) })
] else [ ] else [
(nix-gaming.packages.${pkgs.stdenv.hostPlatform.system}.star-citizen.override {
tricks = [ "arial" "vcrun2019" "win10" "sound=alsa" ];
})
bambu-studio bambu-studio
inputs.noctalia.packages.${pkgs.stdenv.hostPlatform.system}.default
kitty
]); ]);
}; };
@@ -564,11 +589,65 @@ in
}; };
virtualisation = { virtualisation = {
/*
libvirt = {
enable = true;
connections."qemu:///system" = {
networks = [
{
definition = nixvirt.lib.network.writeXML (nixvirt.lib.network.templates.bridge {
name = "default";
uuid = "cda3b7dd-71fd-44e3-8093-340f47a88c83";
subnet_byte = 122;
bridge_name = "virbr0";
});
active = true;
}
];
domains = lib.mkForce [
{ definition = nixvirt.lib.domain.writeXML win10Config; }
];
};
};
*/
libvirtd.enable = true; libvirtd.enable = true;
spiceUSBRedirection.enable = true; spiceUSBRedirection.enable = true;
}; };
programs = { programs = {
hyprland.enable = !desktop;
labwc.enable = !desktop;
dms-shell = {
enable = false; # !desktop;
enableSystemMonitoring = true;
enableClipboard = true;
enableDynamicTheming = true;
enableAudioWavelength = true;
enableCalendarEvents = true;
plugins = {
#nixMonitor.enable = true;
DankNixMonitor = {
enable = true;
src = pkgs.fetchFromGitHub {
owner = "antonjah";
repo = "nix-monitor";
rev = "f3dbe00";
hash = "sha256-biRc7ESKzPK5Ueus1xjVT8OXCHar3+Qi+Osv/++A+Ls=";
};
};
};
};
appimage = { appimage = {
enable = true; enable = true;
binfmt = true; binfmt = true;
@@ -637,6 +716,8 @@ ssh -R \"$\{name}:80:localhost:$\{port}\" tuns.sh'\'' _";
]; ];
}; };
virt-manager.enable = true;
nix-ld = { nix-ld = {
enable = true; enable = true;

314
vms/win10.nix Normal file
View File

@@ -0,0 +1,314 @@
{
nvramPath,
pkgs,
uuid,
}:
{
inherit uuid;
type = "kvm";
title = "Windows 10";
name = "win10";
description = "A Windows 10 vm define in nix";
sysinfo = {
type = "smbios";
bios.entry = [
{
name = "vendor";
value = "INSYDE Corp.";
}
{
name = "version";
value = "03.02";
}
{
name = "date";
value = "01/23/2024";
}
];
system.entry = [
{
name = "manufacturer";
value = "Framework";
}
{
name = "product";
value = "Laptop 16 (AMD Ryzen 7040 Series)";
}
{
name = "version";
value = "AG";
}
{
name = "serial";
value = "FRAGADDPAG4096006K";
}
{
name = "uuid";
value = uuid;
}
{
name = "sku";
value = "FRAGACCP0G";
}
{
name = "family";
value = "16in";
}
];
};
vcpu = {
count = 4;
placement = "static";
};
memory = {
count = 16;
unit = "GiB";
};
cputune = {
vcpupin = [
{
vcpu = 0;
cpuset = "4";
}
{
vcpu = 1;
cpuset = "5";
}
{
vcpu = 2;
cpuset = "6";
}
{
vcpu = 3;
cpuset = "7";
}
];
};
cpu = {
mode = "host-passthrough";
check = "none";
migratable = true;
cache = {
level = 3;
mode = "emulate";
};
feature = [
{
policy = "disable";
name = "hypervisor";
}
{
policy = "require";
name = "svm";
}
{
policy = "require";
name = "topoext";
}
];
topology = {
sockets = 1;
dies = 1;
cores = 2;
threads = 2;
};
};
# OS
os = {
type = "hvm";
arch = "x86_64";
machine = "pc-q35-8.2";
loader = {
readonly = true;
type = "pflash";
path = "${pkgs.OVMFFull.fd}/FV/OVMF_CODE.ms.fd";
};
nvram = {
template = "${pkgs.OVMFFull.fd}/FV/OVMF_VARS.ms.fd";
path = "${nvramPath}/win10gpu.nvram";
};
smbios.mode = "sysinfo";
};
features = {
acpi = { };
apic = { };
hyperv = {
mode = "custom";
relaxed = {
state = true;
};
vapic = {
state = true;
};
spinlocks = {
state = true;
retries = 8191;
};
vendor_id = {
state = true;
value = "1234567890ab";
};
};
kvm.hidden = {
state = true;
};
vmport.state = false;
};
clock = {
offset = "localtime";
timer = [
{
name = "rtc";
tickpolicy = "catchup";
}
{
name = "pit";
tickpolicy = "delay";
}
{
name = "hpet";
present = false;
}
{
name = "hypervclock";
present = true;
}
];
};
pm = {
suspend-to-mem = {
enabled = false;
};
suspend-to-disk = {
enabled = false;
};
};
devices = {
emulator = "${pkgs.qemu}/bin/qemu-system-x86_64";
# Disks
hostdev = [];
# Input
input = [
{
type = "keyboard";
bus = "virtio";
}
{
type = "mouse";
bus = "virtio";
}
];
# Video + Audio
graphics = {
type = "spice";
autoport = true;
listen = {
type = "address";
};
image = {
compression = false;
};
};
video = {
model = {
type = "vga";
vram = 65536;
heads = 1;
primary = true;
};
};
sound = {
model = "ich9";
};
audio = {
id = 1;
type = "spice";
};
# Interfaces
controller = [
{
type = "usb";
index = 0;
model = "qemu-xhci";
ports = 15;
}
{
type = "pci";
index = 0;
model = "pcie-root";
}
{
type = "virtio-serial";
index = 0;
}
];
serial = [
{
type = "pty";
target = {
type = "isa-serial";
port = 0;
model.name = "isa-serial";
};
}
];
console = [
{
type = "pty";
target = {
type = "serial";
port = 0;
};
}
];
channel = [
{
type = "spicevmc";
target = {
type = "virtio";
name = "com.redhat.spice.0";
};
}
];
# Other
watchdog = {
model = "itco";
action = "reset";
};
memballoon.model = "none";
};
qemu-commandline = {
arg = [
{ value = "-cpu"; }
{ value = "host,kvm=off,hv_time,hv_vendor_id=null,-hypervisor"; }
{ value = "-machine"; }
{ value = "q35"; }
{ value = "-device"; }
{ value = "{\"driver\":\"ivshmem-plain\",\"id\":\"shmem0\",\"memdev\":\"looking-glass\"}"; }
{ value = "-object"; }
{
value = "{\"qom-type\":\"memory-backend-file\",\"id\":\"looking-glass\",\"mem-path\":\"/dev/kvmfr0\",\"size\":134217728,\"share\":true}";
}
];
};
}