mirror of
https://github.com/NixOS/nixos-hardware
synced 2024-12-20 16:49:44 +01:00
gpd-win-max-2-2023: init BMI260 driver
This commit is contained in:
parent
d1117dcf09
commit
c1db24a14b
3 changed files with 81 additions and 0 deletions
33
gpd/win-max-2/2023/bmi260/default.nix
Normal file
33
gpd/win-max-2/2023/bmi260/default.nix
Normal file
|
@ -0,0 +1,33 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
|
||||
bmi260 = config.boot.kernelPackages.callPackage ./package.nix { };
|
||||
|
||||
in
|
||||
{
|
||||
|
||||
meta.maintainers = [ maintainers.Cryolitia ];
|
||||
|
||||
###### interface
|
||||
|
||||
options = {
|
||||
|
||||
hardware.sensor.iio.bmi260.enable = mkOption {
|
||||
default = false;
|
||||
type = types.bool;
|
||||
description = mdDoc ''
|
||||
Enable Bosch BMI260 IMU kernel module driver.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
###### implementation
|
||||
|
||||
config = mkIf config.hardware.sensor.iio.bmi260.enable {
|
||||
boot.extraModulePackages = [ bmi260 ];
|
||||
boot.kernelModules = [ "bmi260_core" "bmi260_i2c" ];
|
||||
};
|
||||
}
|
42
gpd/win-max-2/2023/bmi260/package.nix
Normal file
42
gpd/win-max-2/2023/bmi260/package.nix
Normal file
|
@ -0,0 +1,42 @@
|
|||
{ lib
|
||||
, stdenv
|
||||
, fetchFromGitHub
|
||||
, fetchurl
|
||||
, kernel
|
||||
}:
|
||||
|
||||
stdenv.mkDerivation (finalAttr: {
|
||||
pname = "bmi260";
|
||||
version = "0.0.2";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "hhd-dev";
|
||||
repo = finalAttr.pname;
|
||||
rev = "v${finalAttr.version}";
|
||||
hash = "sha256-J0npD75QqOGY1QUoznBjQ+jX28gq5u6b0JZOseclwE8=";
|
||||
};
|
||||
|
||||
hardeningDisable = [ "pic" ];
|
||||
|
||||
nativeBuildInputs = kernel.moduleBuildDependencies;
|
||||
|
||||
makeFlags = [
|
||||
"KERNEL_SRC=${kernel.dev}/lib/modules/${kernel.modDirVersion}/build"
|
||||
];
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
|
||||
install *.ko -Dm444 -t $out/lib/modules/${kernel.modDirVersion}/kernel/drivers/bmi260
|
||||
|
||||
runHook postInstall
|
||||
'';
|
||||
|
||||
meta = with lib; {
|
||||
homepage = "https://github.com/hhd-dev/bmi260";
|
||||
description = "A kernel module driver for the Bosch BMI260 IMU";
|
||||
license = with licenses; [ bsd3 gpl2Only ];
|
||||
maintainers = with maintainers; [ Cryolitia ];
|
||||
platforms = platforms.linux;
|
||||
};
|
||||
})
|
|
@ -6,5 +6,11 @@ with lib;
|
|||
../../../common/cpu/amd
|
||||
../../../common/cpu/amd/pstate.nix
|
||||
../../../common/gpu/amd
|
||||
./bmi260
|
||||
];
|
||||
|
||||
hardware.sensor.iio.bmi260.enable = lib.mkDefault true;
|
||||
|
||||
#see README
|
||||
boot.blacklistedKernelModules = mkIf config.hardware.sensor.iio.bmi260.enable [ "bmi160_spi" "bmi160_i2c" "bmi160_core" ];
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue