From f8e89e4e847d25f32c68adccf61e3ad42967847b Mon Sep 17 00:00:00 2001 From: Sebastian Sellmeier Date: Sun, 7 Apr 2024 21:31:18 +0200 Subject: [PATCH] framework: Add framework-laptop-kmod as default for NixOS >= 24.05 --- framework/13-inch/common/default.nix | 1 + framework/kmod.nix | 17 +++++++++++++++++ 2 files changed, 18 insertions(+) create mode 100644 framework/kmod.nix diff --git a/framework/13-inch/common/default.nix b/framework/13-inch/common/default.nix index c79061a..b7b961d 100644 --- a/framework/13-inch/common/default.nix +++ b/framework/13-inch/common/default.nix @@ -2,6 +2,7 @@ imports = [ ../../../common/pc/laptop ../../../common/pc/laptop/ssd + ../../kmod.nix ]; # Fix TRRS headphones missing a mic diff --git a/framework/kmod.nix b/framework/kmod.nix new file mode 100644 index 0000000..81ce37a --- /dev/null +++ b/framework/kmod.nix @@ -0,0 +1,17 @@ +{ config, lib, ... }: +{ + options.hardware.framework.enableKmod = lib.mkEnableOption (lib.mdDoc + "Enable the community created Framework kernel module that allows interacting with the embedded controller from sysfs." + ) // { + # Enable by default if on new enough version of NixOS + default = (lib.versionAtLeast (lib.versions.majorMinor lib.version) "24.05"); + }; + + config = lib.mkIf config.hardware.framework.enableKmod { + boot.extraModulePackages = with config.boot.kernelPackages; [ + framework-laptop-kmod + ]; + # https://github.com/DHowett/framework-laptop-kmod?tab=readme-ov-file#usage + boot.kernelModules = [ "cros_ec" "cros_ec_lpcs" ]; + }; +}