nix/hardware.nix
Tristan Druyen ea93b74da5
Various tweaks
- Untested: make dongle gateways device specific
- try to fix network config when usbc-dongle is not avail
- disable broken autoLogin

Signed-off-by: Tristan Druyen <tristan@vault81.de>
2023-09-19 03:13:48 +02:00

81 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 = ["nvme" "xhci_pci" "uas" "usbhid" "usb_storage" "sd_mod"];
kernelModules = [];
};
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;
}
];
};
};
# TODO delete if network specific gateway is validated to work
# defaultGateway = {
# address = "192.168.0.5";
# interface = "enp5s0f4u1u1c2";
# };
};
# TODO validate his works
systemd.network.networks.enp5s0f4u1u1c2.gateway = "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}"
];
}