Files
nix/hosts/himalia/hardware/default.nix
Nikolaos Karaolidis ab8feea39c Add hypridle
Signed-off-by: Nikolaos Karaolidis <nick@karaolidis.com>
2025-07-30 10:59:07 +01:00

184 lines
4.3 KiB
Nix

{
config,
pkgs,
lib,
...
}:
{
imports = [
./display.nix
./keybinds.nix
];
hardware = {
enableAllFirmware = true;
cpu = {
cores = 16;
threads = 16;
intel.updateMicrocode = true;
};
nvidia = {
open = true;
powerManagement.enable = true;
# TODO: Enable
# dynamicBoost.enable = true;
prime = {
offload = {
enable = true;
enableOffloadCmd = true;
};
intelBusId = "PCI:0:2:0";
nvidiaBusId = "PCI:1:0:0";
};
};
graphics = {
enable32Bit = true;
extraPackages = with pkgs; [
vaapiVdpau
intel-vaapi-driver
libvdpau-va-gl
intel-media-driver
];
};
nvidia-container-toolkit.enable =
config.virtualisation.containerd.enable || config.virtualisation.podman.enable;
};
boot = {
kernelParams = [
"pci=noaer"
"i915.enable_dpcd_backlight=1"
];
kernelModules = [ "kvm-intel" ];
kernelPatches = [
{
name = "alc285-fixup";
patch = ./gu605c-spi-cs-gpio/alc285-fixup.patch;
}
{
name = "iwlwifi-no-disable-all-chans";
patch = ./iwlwifi/iwlwifi-no-disable-all-chans.patch;
}
];
initrd = {
prepend = [ "${import ./gu605c-spi-cs-gpio { inherit pkgs; }}/asus-gu605c-acpi.cpio" ];
kernelModules = [
"i915"
"xhci_pci"
"thunderbolt"
"vmd"
"nvme"
"usbhid"
"sd_mod"
];
};
};
nixpkgs.config.cudaSupport = true;
services = {
xserver.videoDrivers = [ "nvidia" ];
fstrim.enable = true;
tlp.settings.DISK_DEVICES = lib.mkDefault "nvme0n1 nvme1n1";
asusd = {
enable = true;
# FIXME: https://gitlab.com/asus-linux/asusctl/-/issues/532
# enableUserService = true;
asusdConfig.text = ''
(
charge_control_end_threshold: 60,
disable_nvidia_powerd_on_battery: true,
ac_command: "",
bat_command: "",
platform_profile_linked_epp: true,
platform_profile_on_battery: Quiet,
change_platform_profile_on_battery: true,
platform_profile_on_ac: Quiet,
change_platform_profile_on_ac: true,
profile_quiet_epp: Power,
profile_balanced_epp: BalancePower,
profile_custom_epp: Performance,
profile_performance_epp: Performance,
ac_profile_tunings: {},
dc_profile_tunings: {},
armoury_settings: {},
)
'';
};
supergfxd = {
enable = true;
settings = {
vfio_enable = true;
no_logind = true;
};
};
};
programs.gamescope.args = [
# FIXME: https://github.com/ValveSoftware/gamescope/issues/1590
"--prefer-vk-device"
"10de:2f58"
];
environment.persistence."/persist/state"."/etc/asusd/aura_19b6.ron" = { };
home-manager.sharedModules = [
{
wayland.windowManager.hyprland.settings.env = [
"AQ_DRM_DEVICES,/dev/dri/card0:/dev/dri/card1"
"__NV_PRIME_RENDER_OFFLOAD,1"
"__VK_LAYER_NV_optimus,NVIDIA_only"
"__GLX_VENDOR_LIBRARY_NAME,nvidia"
];
services.hypridle.settings = lib.mkForce {
listener = [
{
timeout = 60;
on-timeout = "brightnessctl -d intel_backlight -s set 5%";
on-resume = "brightnessctl -d intel_backlight -r";
}
{
timeout = 60;
on-timeout = "brightnessctl -d asus::kbd_backlight -s set 0%";
on-resume = "brightnessctl -d asus::kbd_backlight -r";
}
{
timeout = 300;
on-timeout = "hyprctl dispatch dpms off";
on-resume = "hyprctl dispatch dpms on";
}
];
};
theme = {
template.".config/asusctl/keyboard".source =
pkgs.writeText ".config/asusctl/keyboard" "{{colors.primary_container.default.hex_stripped}}";
initExtraConfig = "${
lib.meta.getExe (
pkgs.writeShellApplication {
name = "theme-asusctl";
runtimeInputs = with pkgs; [ asusctl ];
text = ''
asusctl aura static -c "$(<"$HOME/.config/asusctl/keyboard")"
'';
}
)
} &";
};
}
];
}