forked from NixOS/nixpkgs
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
msi-ec-kmods: init at 0-unstable-2024-09-19 (NixOS#343038)
- Loading branch information
Showing
4 changed files
with
88 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12697,6 +12697,12 @@ | |
githubId = 3044438; | ||
name = "Lucas Savva"; | ||
}; | ||
m1dugh = { | ||
email = "[email protected]"; | ||
name = "Romain LE MIERE"; | ||
github = "m1dugh"; | ||
githubId = 42266017; | ||
}; | ||
ma27 = { | ||
email = "[email protected]"; | ||
matrix = "@ma27:nicht-so.sexy"; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
{ | ||
stdenv, | ||
lib, | ||
fetchFromGitHub, | ||
linuxPackages, | ||
git, | ||
kernel ? linuxPackages.kernel, | ||
}: | ||
stdenv.mkDerivation { | ||
pname = "msi-ec-kmods"; | ||
version = "0-unstable-2024-09-19"; | ||
|
||
src = fetchFromGitHub { | ||
owner = "BeardOverflow"; | ||
repo = "msi-ec"; | ||
rev = "94c2a45c04a07096e10d7cb1240e1a201a025dc0"; | ||
hash = "sha256-amJUoIf5Sl62BLyHLeam2fzN1s+APoWh2dH5QVfJhCs="; | ||
}; | ||
|
||
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); | ||
|
||
hardeningDisable = [ "pic" ]; | ||
|
||
makeFlags = kernel.makeFlags ++ [ | ||
"KERNELDIR=${kernel.dev}/lib/modules/${kernel.modDirVersion}/build" | ||
"INSTALL_MOD_PATH=$(out)" | ||
]; | ||
|
||
nativeBuildInputs = kernel.moduleBuildDependencies ++ [ git ]; | ||
|
||
installTargets = [ "modules_install" ]; | ||
|
||
enableParallelBuilding = true; | ||
|
||
meta = { | ||
description = "Kernel modules for MSI Embedded controller"; | ||
homepage = "https://github.com/BeardOverflow/msi-ec"; | ||
license = lib.licenses.gpl2Plus; | ||
maintainers = [ lib.maintainers.m1dugh ]; | ||
platforms = lib.platforms.linux; | ||
broken = kernel.kernelOlder "6.2"; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters