feat: NixOS | enable virtualization and lock when key unplugged

This commit is contained in:
2025-01-10 12:11:07 +05:00
parent fb5fe03637
commit 9133eb3a50

View File

@@ -100,6 +100,15 @@
#media-session.enable = true; #media-session.enable = true;
}; };
services.udev.extraRules = ''
ACTION=="remove",\
ENV{ID_BUS}=="usb",\
ENV{ID_MODEL_ID}=="0407",\
ENV{ID_VENDOR_ID}=="1050",\
ENV{ID_VENDOR}=="Yubico",\
RUN+="${pkgs.systemd}/bin/loginctl lock-sessions"
'';
# Enable sound with pipewire. # Enable sound with pipewire.
hardware = { hardware = {
pulseaudio.enable = false; pulseaudio.enable = false;
@@ -126,7 +135,7 @@
isNormalUser = true; isNormalUser = true;
description = "Shahab Dogar"; description = "Shahab Dogar";
extraGroups = [ "networkmanager" "wheel" "input" ]; extraGroups = [ "networkmanager" "wheel" "input" "libvirtd" ];
}; };
# Allow unfree packages # Allow unfree packages
@@ -136,6 +145,13 @@
# $ nix search wget # $ nix search wget
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
pciutils pciutils
virt-manager
virt-viewer
spice
spice-gtk
spice-protocol
win-virtio
win-spice
]; ];
programs._1password.enable = true; programs._1password.enable = true;
@@ -146,6 +162,8 @@
polkitPolicyOwners = [ "shahab" ]; polkitPolicyOwners = [ "shahab" ];
}; };
programs.dconf.enable = true;
# Hyprland # Hyprland
programs.hyprland = { programs.hyprland = {
enable = true; enable = true;
@@ -174,8 +192,24 @@
search = ["docker.io"]; search = ["docker.io"];
}; };
}; };
libvirtd = {
enable = true;
qemu = {
swtpm.enable = true;
ovmf = {
enable = true;
packages = with pkgs; [ OVMFFull.fd ];
};
};
};
spiceUSBRedirection.enable = true;
}; };
services.spice-vdagentd.enable = true;
# Some programs need SUID wrappers, can be configured further or are # Some programs need SUID wrappers, can be configured further or are
# started in user sessions. # started in user sessions.
# programs.mtr.enable = true; # programs.mtr.enable = true;