From 5ade35b9a982456f695733a6f01704a979d533dc Mon Sep 17 00:00:00 2001
From: Dmitriy Pleshevskiy <dmitriy@pleshevski.ru>
Date: Fri, 21 Feb 2025 21:46:04 +0300
Subject: [PATCH] host/home: use lts to fix wifi module

---
 hosts/home/hardware-configuration/default.nix | 2 ++
 modules/nixos/configs/system.nix              | 6 +++++-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/hosts/home/hardware-configuration/default.nix b/hosts/home/hardware-configuration/default.nix
index a049286..9ef597b 100644
--- a/hosts/home/hardware-configuration/default.nix
+++ b/hosts/home/hardware-configuration/default.nix
@@ -11,6 +11,8 @@
   # See: https://github.com/NixOS/nixpkgs/issues/38676
   boot.kernelModules = [ "veth" ];
 
+  # rtl88x2bu doesn't work on stable at the moment 🤔
+  local.system.kernel = "lts";
   boot.extraModulePackages = with config.boot.kernelPackages; [
     rtl88x2bu # wifi
   ];
diff --git a/modules/nixos/configs/system.nix b/modules/nixos/configs/system.nix
index abbfcec..890d4d3 100644
--- a/modules/nixos/configs/system.nix
+++ b/modules/nixos/configs/system.nix
@@ -12,7 +12,7 @@ in
 
   options.local.system = with lib; {
     kernel = mkOption {
-      type = types.enum [ "hardened" "stable" "latest" ];
+      type = types.enum [ "hardened" "stable" "lts" "latest" ];
       default = "latest";
     };
     headless = mkEnableOption "headless profile";
@@ -48,6 +48,10 @@ in
       boot.kernelPackages = pkgs.unstable.linuxPackages_6_13;
     })
 
+    (lib.mkIf (cfg.kernel == "lts") {
+      boot.kernelPackages = pkgs.unstable.linuxPackages_6_12;
+    })
+
     (lib.mkIf (cfg.kernel == "latest") {
       boot.kernelPackages = pkgs.unstable.linuxPackages_latest;
     })