From 351a4de0988a5a88b343c4dedae345b9888c6d30 Mon Sep 17 00:00:00 2001 From: Sean Buckley Date: Fri, 4 Mar 2022 22:50:54 -0500 Subject: [PATCH] add testing new-lg4ff driver --- modules/new-lg4ff/default.nix | 14 ++++++++++++++ modules/new-lg4ff/pkg.nix | 25 +++++++++++++++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 modules/new-lg4ff/default.nix create mode 100644 modules/new-lg4ff/pkg.nix diff --git a/modules/new-lg4ff/default.nix b/modules/new-lg4ff/default.nix new file mode 100644 index 0000000..ec775cd --- /dev/null +++ b/modules/new-lg4ff/default.nix @@ -0,0 +1,14 @@ +{ config, lib, pkgs, ... }: +let + cfg = config.sconfig.new-lg4ff; +in +{ + options.sconfig.new-lg4ff.enable = lib.mkEnableOption "Enable new-lg4ff"; + + config = lib.mkIf cfg.enable { + boot.kernelModules = [ "hid-logitech-new" ]; + boot.extraModulePackages = [ + (config.boot.kernelPackages.callPackage ./pkg.nix { }) + ]; + }; +} diff --git a/modules/new-lg4ff/pkg.nix b/modules/new-lg4ff/pkg.nix new file mode 100644 index 0000000..a7d3561 --- /dev/null +++ b/modules/new-lg4ff/pkg.nix @@ -0,0 +1,25 @@ +{ stdenv, lib, fetchFromGitHub, kernel, kmod }: + +stdenv.mkDerivation { + name = "new-lg4ff-${kernel.version}"; + + src = fetchFromGitHub { + owner = "berarma"; + repo = "new-lg4ff"; + # Rev with G923 support + rev = "faeb74fecb0e8ce631758ac1df3f9a341a4d5eed"; + sha256 = "sha256-uXdV7KZeQGyA2u1WfC3V3pG3ZbVff3gIdTaPfCXrtm4="; + }; + + buildPhase = '' + make -C ${kernel.dev}/lib/modules/${kernel.modDirVersion}/build M=$(pwd) modules + ''; + + installPhase = '' + export INSTALL_MOD_PATH="$out" + make -C ${kernel.dev}/lib/modules/${kernel.modDirVersion}/build M=$(pwd) modules_install + ''; + + hardeningDisable = [ "pic" "format" ]; + nativeBuildInputs = kernel.moduleBuildDependencies; +}