System/modules/linux/hardware.nix

55 lines
1.5 KiB
Nix
Raw Normal View History

2022-06-23 02:57:41 -04:00
{ config, lib, pkgs, ... }:
let nw = config.nathan.hardware;
in with lib; {
2022-10-09 21:43:38 -04:00
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; };
2022-10-10 23:03:38 -04:00
runAsRoot = true;
2022-10-09 21:43:38 -04:00
swtpm.enable = true;
};
};
2022-11-05 23:54:11 -04:00
})
(mkIf nw.printing {
services.printing = {
enable = true;
drivers = with pkgs; [ canon-cups-ufr2 ];
};
2022-11-12 16:20:40 -05:00
environment.systemPackages = with pkgs; [ canon-cups-ufr2 ];
2022-11-05 23:54:11 -04:00
# Enable avahi for printer discovery
services.avahi = {
enable = true;
2022-11-12 16:20:40 -05:00
nssmdns = false;
interfaces = [ "enp6s0" ];
hostName = "levitation";
domainName = "local";
openFirewall = true;
2022-11-05 23:54:11 -04:00
};
2022-11-12 16:20:40 -05:00
system.nssModules = with pkgs.lib;
optional (!config.services.avahi.nssmdns) pkgs.nssmdns;
system.nssDatabases.hosts = with pkgs.lib;
optionals (!config.services.avahi.nssmdns) (mkMerge [
(mkOrder 900
[ "mdns4_minimal [NOTFOUND=return]" ]) # must be before resolve
(mkOrder 1501 [ "mdns4" ]) # 1501 to ensure it's after dns
]);
2022-10-09 21:43:38 -04:00
})
];
2022-06-23 02:57:41 -04:00
}