2024-03-25 22:29:41 -03:00
|
|
|
{ lib, stdenv, fetchFromGitHub, kernel, kmod }:
|
|
|
|
|
2024-04-04 15:24:35 -03:00
|
|
|
let kernelDirectory = "${kernel.dev}/lib/modules/${kernel.modDirVersion}/build";
|
|
|
|
in stdenv.mkDerivation {
|
2024-03-25 22:29:41 -03:00
|
|
|
pname = "zenergy";
|
|
|
|
version = "a3e124477ee8197015481156b90100d49fa3cd84";
|
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "BoukeHaarsma23";
|
|
|
|
repo = "zenergy";
|
2024-05-25 19:50:55 -03:00
|
|
|
rev = "d65592b3c9d171ba70e6017e0827191214d81937";
|
|
|
|
hash = "sha256-10hiUHJvLTG3WGrr4WXMo/mCoJGFqWk2l5PryjNhcHg=";
|
2024-03-25 22:29:41 -03:00
|
|
|
};
|
|
|
|
|
|
|
|
hardeningDisable = [ "format" "pic" ];
|
|
|
|
|
2024-04-04 15:24:35 -03:00
|
|
|
makeFlags = kernel.makeFlags ++ [ "KDIR=${kernelDirectory}" ];
|
2024-03-25 22:29:41 -03:00
|
|
|
|
|
|
|
preBuild = ''
|
|
|
|
substituteInPlace Makefile --replace-fail "PWD modules_install" "PWD INSTALL_MOD_PATH=$out modules_install"
|
|
|
|
'';
|
|
|
|
|
|
|
|
nativeBuildInputs = [ kmod ] ++ kernel.moduleBuildDependencies;
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
make modules_install KDIR=${kernelDirectory}
|
|
|
|
'';
|
|
|
|
|
|
|
|
outputs = [ "out" ];
|
|
|
|
|
|
|
|
meta = with lib; {
|
2024-04-04 15:24:35 -03:00
|
|
|
description =
|
|
|
|
"Based on AMD_ENERGY driver, but with some jiffies added so non-root users can read it safely.";
|
2024-03-25 22:29:41 -03:00
|
|
|
homepage = "https://github.com/BoukeHaarsma23/zenergy";
|
|
|
|
license = licenses.gpl2Only;
|
|
|
|
maintainers = with maintainers; [ wizardlink ];
|
|
|
|
platforms = platforms.linux;
|
|
|
|
outputsToInstall = [ "out" ];
|
|
|
|
};
|
|
|
|
}
|