From 6e80224000e1ee4a883cb0f26e3ac7510aaefe90 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebasti=C3=A1n=20Zavala=20Villag=C3=B3mez?= Date: Mon, 28 Apr 2025 02:37:02 -0400 Subject: [PATCH] lenovo/thinkpad/p14s: check kernel version through `config` instead of `pkgs` The previous implementation was checking the kernel version through `pkgs.linux`, which is only representative of the final system if `boot.kernelPackages` is left as the default value of `pkgs.linuxPackages`. You can of course change this to other package sets, such as `pkgs.linuxPackages_latest`. Instead, we now reference the kernel through `config.boot.kernelPackages.kernel`. --- lenovo/thinkpad/p14s/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lenovo/thinkpad/p14s/default.nix b/lenovo/thinkpad/p14s/default.nix index edaeda86..6e87b7bc 100644 --- a/lenovo/thinkpad/p14s/default.nix +++ b/lenovo/thinkpad/p14s/default.nix @@ -1,4 +1,4 @@ -{ lib, pkgs, ... }: +{ config, lib, pkgs, ... }: { # P14s is a rebadged T14 with slight internal differences. @@ -14,7 +14,7 @@ # "vendor" setting, in this case the thinkpad_acpi driver. # See https://hansdegoede.livejournal.com/27130.html # See https://lore.kernel.org/linux-acpi/20221105145258.12700-1-hdegoede@redhat.com/ - boot.kernelParams = lib.mkIf (lib.versionOlder pkgs.linux.version "6.2") [ "acpi_backlight=native" ]; + boot.kernelParams = lib.mkIf (lib.versionOlder config.boot.kernelPackages.kernel.version "6.2") [ "acpi_backlight=native" ]; # see https://github.com/NixOS/nixpkgs/issues/69289 boot.kernelPackages = lib.mkIf (lib.versionOlder pkgs.linux.version "5.2") pkgs.linuxPackages_latest;