chore: use nixfmt instead of nixpkgs-fmt and add zenergy kernel module

This commit is contained in:
Alexandre Cavalheiro S. Tiago da Silva 2024-03-25 22:29:41 -03:00
parent d784cb0241
commit caa804bf86
Signed by: wizardlink
GPG key ID: A5767B54367CFBDF
5 changed files with 107 additions and 49 deletions

43
kernel/zenergy.nix Normal file
View file

@ -0,0 +1,43 @@
{ lib, stdenv, fetchFromGitHub, kernel, kmod }:
let
kernelDirectory = "${kernel.dev}/lib/modules/${kernel.modDirVersion}/build";
in
stdenv.mkDerivation {
pname = "zenergy";
version = "a3e124477ee8197015481156b90100d49fa3cd84";
src = fetchFromGitHub {
owner = "BoukeHaarsma23";
repo = "zenergy";
rev = "a3e124477ee8197015481156b90100d49fa3cd84";
hash = "sha256-s1aoipSsLKO23kTd2uGxVUpqYSeitiz3UIoDIxg/Dj8=";
};
hardeningDisable = [ "format" "pic" ];
makeFlags = kernel.makeFlags ++ [
"KDIR=${kernelDirectory}"
];
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; {
description = "Based on AMD_ENERGY driver, but with some jiffies added so non-root users can read it safely.";
homepage = "https://github.com/BoukeHaarsma23/zenergy";
license = licenses.gpl2Only;
maintainers = with maintainers; [ wizardlink ];
platforms = platforms.linux;
outputsToInstall = [ "out" ];
};
}