Loading pkgs/os-specific/linux/msi-ec/default.nix +5 −13 Original line number Diff line number Diff line Loading @@ -8,26 +8,18 @@ }: stdenv.mkDerivation { pname = "msi-ec-kmods"; version = "0-unstable-2024-09-19"; version = "0-unstable-2024-11-04"; src = fetchFromGitHub { owner = "BeardOverflow"; repo = "msi-ec"; rev = "94c2a45c04a07096e10d7cb1240e1a201a025dc0"; hash = "sha256-amJUoIf5Sl62BLyHLeam2fzN1s+APoWh2dH5QVfJhCs="; rev = "be6f7156cd15f6ecf9d48dfcc30cbd1f693916b8"; hash = "sha256-gImiP4OaBt80n+qgVnbhd0aS/zW+05o3DzGCw0jq+0g="; }; dontMakeSourcesWritable = false; postPatch = let targets = builtins.filter (v: v != "") [ (lib.strings.optionalString (kernel.kernelOlder "6.2") "older-kernel-patch") (lib.strings.optionalString (kernel.kernelAtLeast "6.11") "6.11-kernel-patch") ]; commands = builtins.map (target: "make ${target}") targets; in lib.concatStringsSep "\n" ([ "cp ${./patches/Makefile} ./Makefile" ] ++ commands); patches = [ ./patches/makefile.patch ]; hardeningDisable = [ "pic" ]; Loading @@ -48,6 +40,6 @@ stdenv.mkDerivation { license = lib.licenses.gpl2Plus; maintainers = [ lib.maintainers.m1dugh ]; platforms = lib.platforms.linux; broken = kernel.kernelOlder "6.2"; broken = kernel.kernelOlder "5.5"; }; } pkgs/os-specific/linux/msi-ec/patches/Makefiledeleted 100644 → 0 +0 −27 Original line number Diff line number Diff line # Out of the box, the build with this Makefile only works in FHS environments, # such as on Ubuntu or Debian. On NixOS, you either need to open an FHS # environment using a Nix shell or build this from a specially crafted Nix # derivation. # # This file follows the conventions written down here: # https://docs.kernel.org/kbuild/modules.html # Make it possible to override the kernel src tree location from Nix derivation. KERNEL ?= $(shell uname -r) KERNELDIR ?= /lib/modules/$(KERNEL)/build/ ccflags-y := -std=gnu11 -Wno-declaration-after-statement .PHONY: default default: modules # -m: Build as module. obj-m = msi-ec.o .PHONY: modules modules: @#"M=": Module source. Special variable of the kernel's main Makefile. $(MAKE) -C $(KERNELDIR) M=$(PWD) modules .PHONY: modules_install modules_install: $(MAKE) -C $(KERNELDIR) M=$(PWD) modules_install 6.11-kernel-patch: git apply 6.11-kernel.patch older-kernel-patch: git apply older-kernel.patch pkgs/os-specific/linux/msi-ec/patches/makefile.patch 0 → 100644 +28 −0 Original line number Diff line number Diff line diff --git a/Makefile b/Makefile index bffcbd4..fd1d8a3 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,7 @@ VERSION := 0.08 DKMS_ROOT_PATH := /usr/src/msi_ec-$(VERSION) TARGET ?= $(shell uname -r) +KERNELDIR ?= /lib/modules/$(TARGET)/build/ ccflags-y := -std=gnu11 -Wno-declaration-after-statement @@ -10,11 +11,14 @@ obj-m += msi-ec.o all: modules modules: - @$(MAKE) -C /lib/modules/$(TARGET)/build M=$(CURDIR) modules + @$(MAKE) -C $(KERNELDIR) M=$(CURDIR) modules clean: @$(MAKE) -C /lib/modules/$(TARGET)/build M=$(CURDIR) clean +modules_install: + @$(MAKE) -C $(KERNELDIR) M=$(CURDIR) modules_install + load: insmod msi-ec.ko Loading
pkgs/os-specific/linux/msi-ec/default.nix +5 −13 Original line number Diff line number Diff line Loading @@ -8,26 +8,18 @@ }: stdenv.mkDerivation { pname = "msi-ec-kmods"; version = "0-unstable-2024-09-19"; version = "0-unstable-2024-11-04"; src = fetchFromGitHub { owner = "BeardOverflow"; repo = "msi-ec"; rev = "94c2a45c04a07096e10d7cb1240e1a201a025dc0"; hash = "sha256-amJUoIf5Sl62BLyHLeam2fzN1s+APoWh2dH5QVfJhCs="; rev = "be6f7156cd15f6ecf9d48dfcc30cbd1f693916b8"; hash = "sha256-gImiP4OaBt80n+qgVnbhd0aS/zW+05o3DzGCw0jq+0g="; }; dontMakeSourcesWritable = false; postPatch = let targets = builtins.filter (v: v != "") [ (lib.strings.optionalString (kernel.kernelOlder "6.2") "older-kernel-patch") (lib.strings.optionalString (kernel.kernelAtLeast "6.11") "6.11-kernel-patch") ]; commands = builtins.map (target: "make ${target}") targets; in lib.concatStringsSep "\n" ([ "cp ${./patches/Makefile} ./Makefile" ] ++ commands); patches = [ ./patches/makefile.patch ]; hardeningDisable = [ "pic" ]; Loading @@ -48,6 +40,6 @@ stdenv.mkDerivation { license = lib.licenses.gpl2Plus; maintainers = [ lib.maintainers.m1dugh ]; platforms = lib.platforms.linux; broken = kernel.kernelOlder "6.2"; broken = kernel.kernelOlder "5.5"; }; }
pkgs/os-specific/linux/msi-ec/patches/Makefiledeleted 100644 → 0 +0 −27 Original line number Diff line number Diff line # Out of the box, the build with this Makefile only works in FHS environments, # such as on Ubuntu or Debian. On NixOS, you either need to open an FHS # environment using a Nix shell or build this from a specially crafted Nix # derivation. # # This file follows the conventions written down here: # https://docs.kernel.org/kbuild/modules.html # Make it possible to override the kernel src tree location from Nix derivation. KERNEL ?= $(shell uname -r) KERNELDIR ?= /lib/modules/$(KERNEL)/build/ ccflags-y := -std=gnu11 -Wno-declaration-after-statement .PHONY: default default: modules # -m: Build as module. obj-m = msi-ec.o .PHONY: modules modules: @#"M=": Module source. Special variable of the kernel's main Makefile. $(MAKE) -C $(KERNELDIR) M=$(PWD) modules .PHONY: modules_install modules_install: $(MAKE) -C $(KERNELDIR) M=$(PWD) modules_install 6.11-kernel-patch: git apply 6.11-kernel.patch older-kernel-patch: git apply older-kernel.patch
pkgs/os-specific/linux/msi-ec/patches/makefile.patch 0 → 100644 +28 −0 Original line number Diff line number Diff line diff --git a/Makefile b/Makefile index bffcbd4..fd1d8a3 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,7 @@ VERSION := 0.08 DKMS_ROOT_PATH := /usr/src/msi_ec-$(VERSION) TARGET ?= $(shell uname -r) +KERNELDIR ?= /lib/modules/$(TARGET)/build/ ccflags-y := -std=gnu11 -Wno-declaration-after-statement @@ -10,11 +11,14 @@ obj-m += msi-ec.o all: modules modules: - @$(MAKE) -C /lib/modules/$(TARGET)/build M=$(CURDIR) modules + @$(MAKE) -C $(KERNELDIR) M=$(CURDIR) modules clean: @$(MAKE) -C /lib/modules/$(TARGET)/build M=$(CURDIR) clean +modules_install: + @$(MAKE) -C $(KERNELDIR) M=$(CURDIR) modules_install + load: insmod msi-ec.ko