System/modules/linux/hardware.nix

43 lines
973 B
Nix

{ config, lib, pkgs, ... }:
let nw = config.nathan.hardware;
in with lib; {
config = mkMerge [
{
hardware.logitech.wireless = mkIf nw.logitech {
enable = true;
enableGraphical = true;
};
}
(mkIf nw.amdPassthrough {
# Turn on IOMMU and the needed drivers
boot = {
kernelParams = [ "amd_iommu=on" ];
kernelModules = [ "kvm-amd" "vifo-pci" ];
};
# Enable libvirtd
virtualisation.libvirtd = {
enable = true;
onBoot = "ignore";
onShutdown = "shutdown";
qemu = {
ovmf = { enable = true; };
runAsRoot = true;
swtpm.enable = true;
};
};
})
(mkIf nw.printing {
services.printing = {
enable = true;
drivers = with pkgs; [ canon-cups-ufr2 ];
};
# Enable avahi for printer discovery
services.avahi = {
enable = true;
nssmdns = true;
};
})
];
}