nix/hardware.nix

84 lines
2.2 KiB
Nix

{
config,
lib,
pkgs,
modulesPath,
...
}: {
imports = [
(modulesPath + "/installer/scan/not-detected.nix")
];
boot = {
loader = {
systemd-boot.enable = true;
efi.canTouchEfiVariables = true;
};
initrd = {
availableKernelModules = ["amdgpu" "nvme" "xhci_pci" "uas" "usbhid" "usb_storage" "sd_mod"];
kernelModules = [];
systemd.enable = true;
};
kernelModules = ["kvm-amd" "amdgpu"];
extraModulePackages = [];
};
services.xserver.videoDrivers = ["amdgpu"];
networking = {
useDHCP = lib.mkDefault true;
interfaces = {
enp5s0f4u1u1c2 = {
useDHCP = false;
ipv4.addresses = [
{
address = "192.168.0.21";
prefixLength = 24;
}
];
ipv4.routes = [
{
address = "192.168.0.0";
prefixLength = 24;
}
{
address = "0.0.0.0";
prefixLength = 0;
via = "192.168.0.5";
}
];
};
};
};
# This manually configures the automatically created network-adresses service to be more flexible
# regarding booting without the the device being available on boot
# It prevents slow timeouts & errors on boot while preserving Plug & Play ability
systemd.services.network-addresses-enp5s0f4u1u1c2.unitConfig.ConditionPathExists = "/sys/class/net/enp5s0f4u1u1c2";
systemd.services.network-addresses-enp5s0f4u1u1c2.unitConfig.BindsTo = lib.mkForce null;
services.udev.extraRules = ''
ACTION=="add", KERNEL=="enp5s0f4u1u1c2", TAG+="systemd", ENV{SYSTEMD_WANTS}="network-addresses-enp5s0f4u1u1c2.service"
ACTION=="remove", KERNEL=="enp5s0f4u1u1c2", RUN+="${pkgs.systemd}/bin/systemctl stop network-addresses-enp5s0f4u1u1c2.service"
'';
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
hardware = {
opengl = {
driSupport = true;
driSupport32Bit = true;
extraPackages = with pkgs; [
rocm-opencl-icd
rocm-opencl-runtime
];
};
cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
};
systemd.tmpfiles.rules = [
"L+ /opt/rocm/hip - - - - ${pkgs.hip}"
];
}