| .github | ||
| kernel-cachyos | ||
| zfs-cachyos | ||
| .gitignore | ||
| default.nix | ||
| flake.lock | ||
| flake.nix | ||
| garnix.yaml | ||
| helpers.nix | ||
| README.md | ||
Nix packages for CachyOS Kernel
This repo contains Linux kernels with both CachyOS patches and CachyOS tunings, as well as CachyOS-patched ZFS module.
Note: If you see "all builds failed" from Garnix, it means I ran out of free plan's build time. I also have my own Hydra CI that's building the kernels.
Which kernel versions are provided?
This repo provides the following kernel variants, consistent with the upstream definitions:
└───packages
└───x86_64-linux
# Latest kernel, provide all LTO/CPU arch variants
├───linux-cachyos-latest
├───linux-cachyos-latest-x86_64-v2
├───linux-cachyos-latest-x86_64-v3
├───linux-cachyos-latest-x86_64-v4
├───linux-cachyos-latest-zen4
├───linux-cachyos-latest-lto
├───linux-cachyos-latest-lto-x86_64-v2
├───linux-cachyos-latest-lto-x86_64-v3
├───linux-cachyos-latest-lto-x86_64-v4
├───linux-cachyos-latest-lto-zen4
# LTS kernel, provide LTO variants
├───linux-cachyos-lts
├───linux-cachyos-lts-lto
# Additional CachyOS kernel variants
├───linux-cachyos-bmq
├───linux-cachyos-bmq-lto
├───linux-cachyos-bore
├───linux-cachyos-bore-lto
├───linux-cachyos-deckify
├───linux-cachyos-deckify-lto
├───linux-cachyos-eevdf
├───linux-cachyos-eevdf-lto
├───linux-cachyos-hardened
├───linux-cachyos-hardened-lto
├───linux-cachyos-rc
├───linux-cachyos-rc-lto
├───linux-cachyos-rt-bore
├───linux-cachyos-rt-bore-lto
├───linux-cachyos-server
└───linux-cachyos-server-lto
The kernel versions are automatically kept in sync with Nixpkgs, so once the latest/LTS kernel is updated in Nixpkgs, CachyOS kernels in this repo will automatically catch up.
Use nix flake show github:xddxdd/nix-cachyos-kernel to see the current effective versions.
The kernels ending in -lto has Clang+ThinLTO enabled.
For each linux kernel entry under packages, we have a corresponding linuxPackages entry under legacyPackages for easier use in your NixOS configuration, e.g.:
linux-cachyos-latest->inputs.nix-cachyos-kernel.legacyPackages.x86_64-linux.linuxPackages-cachyos-latestlinux-cachyos-lts-lto->inputs.nix-cachyos-kernel.legacyPackages.x86_64-linux.linuxPackages-cachyos-lts-lto
How to use kernels
Add the release branch this repo to the inputs section of your flake.nix:
{
inputs = {
nix-cachyos-kernel.url = "github:xddxdd/nix-cachyos-kernel/release";
}
}
The release branch contains the latest kernel that has been built by my Hydra CI and is present in binary cache.
If you want the absolute latest version with or without binary cache, use the
masterbranch (default branch) instead:{ inputs = { nix-cachyos-kernel.url = "github:xddxdd/nix-cachyos-kernel"; } }
Add the repo's overlay in your NixOS configuration, this will expose the packages in this flake as pkgs.cachyosKernels.*.
{
nixosConfigurations.example = inputs.nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
(
{ pkgs, ... }:
{
nixpkgs.overlays = [
# Build the kernels on top of nixpkgs version in your flake.
# Binary cache may be unavailable for the kernel/nixpkgs version combos.
self.overlays.default
# Alternatively: use the exact kernel versions as defined in this repo.
# Guarantees you have binary cache.
self.overlays.pinned
# Only use one of the two overlays!
];
# ... your other configs
}
)
];
};
}
Then specify pkgs.cachyosKernels.linuxPackages-cachyos-latest (or other variants you'd like) in your boot.kernelPackages option.
Binary cache
I'm running a Hydra CI to build the kernels and push them to my Attic binary cache. You can see the build status here: https://hydra.lantian.pub/jobset/lantian/nix-cachyos-kernel
To use my binary cache, please add the following config:
{
nix.settings.substituters = [ "https://attic.xuyh0120.win/lantian" ];
nix.settings.trusted-public-keys = [ "lantian:EeAUQ+W+6r7EtwnmYjeVwx5kOGEBpjlBfPlzGlTNvHc=" ];
}
This repo also has Garnix CI set up, and should work as long as the total build time is below the free plan threshold.
If you see "all builds failed" from Garnix, it means I ran out of free plan's build time.
{
nix.settings.substituters = [ "https://cache.garnix.io" ];
nix.settings.trusted-public-keys = [ "cache.garnix.io:CTFPyKSLcx5RMJKfLo5EEPUObbA78b0YQ2DTCJXqr9g=" ];
}
Example configuration
{
nixosConfigurations.example = inputs.nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
(
{ pkgs, ... }:
{
nixpkgs.overlays = [ self.overlays.pinned ];
boot.kernelPackages = pkgs.cachyosKernels.linuxPackages-cachyos-latest;
# Binary cache
nix.settings.substituters = [ "https://attic.xuyh0120.win/lantian" ];
nix.settings.trusted-public-keys = [ "lantian:EeAUQ+W+6r7EtwnmYjeVwx5kOGEBpjlBfPlzGlTNvHc=" ];
# ... your other configs
}
)
];
};
}
Help! My kernel is failing to build!
In most cases, failing to build a kernel is caused by CachyOS not updating patches for the latest kernel version. (e.g. hardened 6.18 kernel as of 2025-12-12)
Common symptoms are:
- "File not found" error, which indicates that CachyOS patches for given kernel version/variant are unavailable.
- Failures/conflicts when applying patches, which indicates that CachyOS patches are for an older kernel version.
If this is the case, the only option is to wait for CachyOS team to update the patches.
How to use ZFS modules
Note: CachyOS-patched ZFS module may fail to compile from time to time. Most compilation failures are caused by incompatibilities between kernel and ZFS. Please check ZFS upstream issues for any compatibility reports, and try switching between
zfs_2_3,zfs_unstableandzfs_cachyos.
To use ZFS module with linuxPackages-cachyos-* provided by this flake, point boot.zfs.package to config.boot.kernelPackages.zfs_cachyos.
{
nixosConfigurations.example = inputs.nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
(
{ pkgs, ... }:
{
nixpkgs.overlays = [ self.overlay ];
boot.kernelPackages = pkgs.cachyosKernels.linuxPackages-cachyos-latest;
# ZFS config
boot.supportedFilesystems.zfs = true;
boot.zfs.package = config.boot.kernelPackages.zfs_cachyos;
# ... your other configs
}
)
];
};
}
If you want to construct your own linuxPackages attrset with linuxKernel.packagesFor (path to your kernel), you can directly reference the zfs-cachyos attribute in this flake's packages / legayPackages output, or the cachyosKernels overlay:
{
nixosConfigurations.example = inputs.nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
(
{ pkgs, ... }:
{
nixpkgs.overlays = [ self.overlay ];
boot.kernelPackages = pkgs.linuxKernel.packagesFor pkgs.cachyosKernels.linux-cachyos-latest;
# ZFS config
boot.supportedFilesystems.zfs = true;
boot.zfs.package = pkgs.cachyosKernels.zfs-cachyos.override {
kernel = config.boot.kernelPackages.kernel;
};
# ... your other configs
}
)
];
};
}
Help! My ZFS module is failing to build!
In most cases, failing to build ZFS module is caused by CachyOS not updating patches for the latest kernel version. The only option is to wait for CachyOS team to update the patches.
How to apply CachyOS patches on your own kernel
The kernels provided in this flake can be overridden to use your own kernel source. This is helpful if you want to use a kernel version not available in Nixpkgs.
{
kernel = pkgs.cachyosKernels.linux-cachyos-latest.override {
pname = "linux-cachyos-with-custom-source";
version = "6.12.34";
src = pkgs.fetchurl {
# ...
};
# Additional args are available. See kernel-cachyos/mkCachyKernel.nix
};
# For non-LTO kernels
kernelPackages = pkgs.linuxKernel.packagesFor kernel;
# helpers.nix provides a few utilities for building kernel with LTO.
# I haven't figured out a clean way to expose it in flakes.
helpers = pkgs.callPackage "${inputs.nix-cachyos-kernel.outPath}/helpers.nix" {};
# For LTO kernels, helpers.kernelModuleLLVMOverride fixes compilation for some
# out-of-tree modules in nixpkgs.
kernelPackagesWithLTOFix = helpers.kernelModuleLLVMOverride (pkgs.linuxKernel.packagesFor kernel);
}