Add version mismatch/build failure warnings to default overlay

This commit is contained in:
Lan Tian 2026-01-24 19:51:55 -08:00
parent df9b9eb25f
commit 286f9777b3
No known key found for this signature in database
GPG Key ID: 04E66B6B25A0862B
2 changed files with 16 additions and 10 deletions

View File

@ -48,7 +48,7 @@ This repo provides the following kernel variants, consistent with the [upstream
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.
Use `nix flake show github:xddxdd/nix-cachyos-kernel/release` to see the current effective versions.
The kernels ending in `-lto` has Clang+ThinLTO enabled.
@ -65,6 +65,7 @@ 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";
# Do not override its nixpkgs input, otherwise there can be mismatch between patches and kernel version
}
}
```
@ -93,14 +94,14 @@ Add the repo's overlay in your NixOS configuration, this will expose the package
{ 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.
nix-cachyos-kernel.overlays.default
# Alternatively: use the exact kernel versions as defined in this repo.
# Use the exact kernel versions as defined in this repo.
# Guarantees you have binary cache.
nix-cachyos-kernel.overlays.pinned
# Alternatively, build the kernels on top of nixpkgs version in your flake.
# This might cause version mismatch/build failures!
nix-cachyos-kernel.overlays.default
# Only use one of the two overlays!
];

View File

@ -78,10 +78,15 @@
};
flake = {
overlay = self.overlays.default;
overlays.default = final: prev: {
cachyosKernels = loadPackages prev;
};
overlay = self.overlays.pinned;
overlays.default =
builtins.warn
"\"nix-cachyos-kernel.overlays.default\" may cause kernel/patch version mismatch and build failure. Please use \"nix-cachyos-kernel.overlays.pinned\" instead."
(
final: prev: {
cachyosKernels = loadPackages prev;
}
);
overlays.pinned = final: prev: {
cachyosKernels = self.legacyPackages."${final.stdenv.hostPlatform.system}";
};