I’m trying to switch to chaotic nyx’s CachyOS kernel for my NixOS setup on a 2025 Framework Laptop 13" (AMD AI 300 series). I’ve added the input and overlays to my flake and now I’d like to actually use it.
The relevant piece of configuration is here:
# hosts/nixluon/kernel.nix
{ lib
, pkgs
, ...
}:
let
kernelPackages = pkgs.linuxPackages_cachyos;
in
{
boot.kernelPackages = kernelPackages;
# extra modules
boot.extraModulePackages = with kernelPackages; [ acpi_call ];
# eBPF-based scheduler
services.scx.enable = true;
# workaround for 25.05, see https://github.com/chaotic-cx/nyx/issues/1158#issuecomment-3216945109
system.modulesTree = [ (lib.getOutput "modules" kernelPackages.kernel) ];
}
At the same time, my config relies on nixos-harware, particularly kmod.nix. This file depends on boot.kernelPackages like so:
kernel_version_compatible = lib.versionAtLeast config.boot.kernelPackages.kernel.version "6.10";
When trying to build the NixOS configuration, the process runs into an infinite recursion error:
error:
… while calling the 'head' builtin
at /nix/store/9vlgmff04ygym3d24mci9ws579xibax1-source/lib/attrsets.nix:1571:13:
1570| if length values == 1 || pred here (elemAt values 1) (head values) then
1571| head values
| ^
1572| else
… while evaluating the attribute 'value'
at /nix/store/9vlgmff04ygym3d24mci9ws579xibax1-source/lib/modules.nix:1083:7:
1082| // {
1083| value = addErrorContext "while evaluating the option `${showOption loc}':" value;
| ^
1084| inherit (res.defsFinal') highestPrio;
… while evaluating the option `system.build.toplevel':
… while evaluating definitions from `/nix/store/9vlgmff04ygym3d24mci9ws579xibax1-source/nixos/modules/system/activation/top-level.nix':
… while evaluating the option `assertions':
… while evaluating definitions from `/nix/store/9vlgmff04ygym3d24mci9ws579xibax1-source/nixos/modules/system/boot/systemd.nix':
… while evaluating the option `systemd.services':
… while evaluating definitions from `/nix/store/cdsm0z7c11r7fwxgwh1x35djb34b6dhi-source/framework/bluetooth.nix':
… while evaluating the option `boot.kernelPatches':
… while evaluating definitions from `/nix/store/cdsm0z7c11r7fwxgwh1x35djb34b6dhi-source/framework/kmod.nix':
… while evaluating the option `hardware.framework.enableKmod':
(stack trace truncated; use '--show-trace' to show the full, detailed trace)
error: infinite recursion encountered
at /nix/store/cdsm0z7c11r7fwxgwh1x35djb34b6dhi-source/framework/kmod.nix:8:50:
7| let
8| kernel_version_compatible = lib.versionAtLeast config.boot.kernelPackages.kernel.version "6.10";
| ^
9| in
Of course, I could set enableKmod = false but I’d prefer to use this feature. Enabling it explicitly (skipping the version check) doesn’t help, because kernel_version_compatible is then used again to determine whether to apply a patch or not. More importantly though, I’d like to understand what’s wrong. I’ve tried asking Claude for pointers but the results weren’t helpful (it suggested forking nixos-hardware or using a Nixpkgs overlay that didn’t solve the issue).
I don’t have the expertise necessary to tell whether this is a problem of my setup, of nixos-hardware, or of nyx. Any advice would be much appreciated.