From c27621eea0858ace5306ef62bed9bc07388ecd2d Mon Sep 17 00:00:00 2001 From: Ross Smyth <18294397+RossSmyth@users.noreply.github.com> Date: Thu, 22 Oct 2026 00:17:42 -0400 Subject: [PATCH] linuxPackages.new-lg4ff: fix & use modules_install --- pkgs/os-specific/linux/new-lg4ff/default.nix | 40 +++++++++++++------- 1 file changed, 27 insertions(+), 13 deletions(-) diff --git a/pkgs/os-specific/linux/new-lg4ff/default.nix b/pkgs/os-specific/linux/new-lg4ff/default.nix index 3a25fb8556b3..a49302232939 100644 --- a/pkgs/os-specific/linux/new-lg4ff/default.nix +++ b/pkgs/os-specific/linux/new-lg4ff/default.nix @@ -6,19 +6,24 @@ fetchFromGitHub, }: -stdenv.mkDerivation rec { +stdenv.mkDerivation (finalAttrs: { pname = "new-lg4ff"; version = "0.5.0"; src = fetchFromGitHub { owner = "berarma"; repo = "new-lg4ff"; - tag = "v${version}"; - sha256 = "sha256-nh5J89S3z0odzh2fDsAVVY1X6lr4ZUwoyu3UVOYQiq8="; + tag = "v${finalAttrs.version}"; + hash = "sha256-nh5J89S3z0odzh2fDsAVVY1X6lr4ZUwoyu3UVOYQiq8="; }; + strictDeps = true; + __structuredAttrs = true; + preBuild = '' - substituteInPlace Makefile --replace-fail "modules_install" "INSTALL_MOD_PATH=$out modules_install" + substituteInPlace Makefile \ + --replace-fail "/lib/modules" "${kernel.dev}/lib/modules" + 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 @@ -26,14 +31,23 @@ stdenv.mkDerivation rec { nativeBuildInputs = kernel.moduleBuildDependencies; - preConfigure = '' - makeFlagsArray+=( - KVERSION="${kernel.modDirVersion}" - KDIR="${kernel.dev}/lib/modules/${kernel.modDirVersion}/build" - KCFLAGS="-DCONFIG_LOGIWHEELS_FF -DCONFIG_LEDS_CLASS" - ${builtins.concatStringsSep " " kernelModuleMakeFlags} - ) - ''; + makeFlags = kernelModuleMakeFlags ++ [ + "INSTALL_MOD_PATH=${placeholder "out"}" + "INSTALL_MOD_DIR=kernel/misc" + "INSTALL_MOD_STRIP=1" + "DEPMOD=true" + "KVERSION=${kernel.modDirVersion}" + "KDIR=${kernel.dev}/lib/modules/${kernel.modDirVersion}/build" + "KCFLAGS=-DCONFIG_LOGIWHEELS_FF -DCONFIG_LEDS_CLASS" + ]; + + installFlags = [ + "-C" + "${kernel.dev}/lib/modules/${kernel.modDirVersion}/build" + "M=$(PWD)" + ]; + + installTargets = [ "modules_install" ]; meta = { description = "Experimental Logitech force feedback module for Linux"; @@ -46,4 +60,4 @@ stdenv.mkDerivation rec { platforms = lib.platforms.linux; broken = stdenv.hostPlatform.isAarch64; }; -} +})