From 8dcba104aa329870d34f4c9ae2735c8182bb2ade Mon Sep 17 00:00:00 2001 From: MatthiasBenaets Date: Fri, 27 May 2022 17:00:06 +0200 Subject: [PATCH] new-lg4ff: init at 0.3.3 --- nixos/modules/hardware/new-lg4ff.nix | 28 +++++++++++++++ nixos/modules/module-list.nix | 1 + pkgs/os-specific/linux/new-lg4ff/default.nix | 36 ++++++++++++++++++++ pkgs/top-level/all-packages.nix | 4 +++ 4 files changed, 69 insertions(+) create mode 100644 nixos/modules/hardware/new-lg4ff.nix create mode 100644 pkgs/os-specific/linux/new-lg4ff/default.nix diff --git a/nixos/modules/hardware/new-lg4ff.nix b/nixos/modules/hardware/new-lg4ff.nix new file mode 100644 index 000000000000..46581e478640 --- /dev/null +++ b/nixos/modules/hardware/new-lg4ff.nix @@ -0,0 +1,28 @@ +{ pkgs, lib, config, ... }: + +with lib; + +let + cfg = config.hardware.new-lg4ff; +in { + options.hardware.new-lg4ff = { + enable = mkOption { + type = types.bool; + default = false; + description = '' + Enables improved Linux module drivers for Logitech driving wheels. + This will replace the existing in-kernel hid-logitech modules. + Works most notably on the Logitech G25, G27, G29 and Driving Force (GT). + ''; + }; + }; + + config = { + boot = { + extraModulePackages = [ pkgs.new-lg4ff ]; + kernelModules = [ "hid-logitech-new" ]; + }; + }; + + meta.maintainers = with lib.maintainers; [ matthiasbenaets ]; +} diff --git a/nixos/modules/module-list.nix b/nixos/modules/module-list.nix index 7ca90fc3ec34..d6cfe0c35645 100644 --- a/nixos/modules/module-list.nix +++ b/nixos/modules/module-list.nix @@ -66,6 +66,7 @@ ./hardware/network/ath-user-regd.nix ./hardware/network/b43.nix ./hardware/network/intel-2200bg.nix + ./hardware/new-lg4ff.nix ./hardware/nitrokey.nix ./hardware/opengl.nix ./hardware/openrazer.nix diff --git a/pkgs/os-specific/linux/new-lg4ff/default.nix b/pkgs/os-specific/linux/new-lg4ff/default.nix new file mode 100644 index 000000000000..df2b66e9079a --- /dev/null +++ b/pkgs/os-specific/linux/new-lg4ff/default.nix @@ -0,0 +1,36 @@ +{ lib, stdenv, kernel, fetchFromGitHub }: + +stdenv.mkDerivation rec { + pname = "new-lg4ff"; + version = "0.3.3"; + + src = fetchFromGitHub { + owner = "berarma"; + repo = "new-lg4ff"; + rev = "${version}"; + sha256 = "+05xDpNI4m6wTS+YPgA0fP4iM10nMOZOtCrdQxpevBU="; + }; + + preBuild = '' + substituteInPlace Makefile --replace "modules_install" "INSTALL_MOD_PATH=$out modules_install" + sed -i '/depmod/d' Makefile + sed -i "10i\\\trmmod hid-logitech 2> /dev/null || true" Makefile + sed -i "11i\\\trmmod hid-logitech-new 2> /dev/null || true" Makefile + ''; + + nativeBuildInputs = kernel.moduleBuildDependencies; + + makeFlags = [ + "KVERSION=${kernel.modDirVersion}" + "KDIR=${kernel.dev}/lib/modules/${kernel.modDirVersion}/build" + ]; + + meta = with lib; { + description = "Experimental Logitech force feedback module for Linux"; + homepage = "https://github.com/berarma/new-lg4ff"; + license = licenses.gpl2Only; + maintainers = with maintainers; [ matthiasbenaets ]; + platforms = platforms.linux; + broken = stdenv.isAarch64; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index bb47bea65e2e..7066c9b98c25 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -23057,6 +23057,10 @@ with pkgs; stdenv = gcc11Stdenv; }; + new-lg4ff = callPackage ../os-specific/linux/new-lg4ff { + inherit (linuxPackages) kernel; + }; + nmon = callPackage ../os-specific/linux/nmon { }; hwdata = callPackage ../os-specific/linux/hwdata { };