nixpkgs/pkgs/by-name/s0/s0ix-selftest-tool/package.nix
2024-05-05 18:46:50 -04:00

75 lines
1.5 KiB
Nix

{
acpica-tools,
bc,
coreutils,
fetchFromGitHub,
gawk,
gnugrep,
gnused,
linuxPackages,
lib,
pciutils,
powertop,
makeWrapper,
stdenv,
unstableGitUpdater,
util-linux,
xorg,
xxd,
}:
let
deps = [
acpica-tools
bc
coreutils
gawk
gnugrep
gnused
linuxPackages.turbostat
pciutils
powertop
util-linux
xorg.xset
xxd
];
in
stdenv.mkDerivation {
pname = "s0ix-selftest-tool";
version = "0-unstable-2024-02-07";
src = fetchFromGitHub {
owner = "intel";
repo = "S0ixSelftestTool";
rev = "c12ae3ea611812547e09bb755dd015dd969b664c";
hash = "sha256-9O72TxlLrkQbt80izWdbLQt9OW/4Aq1p4RuQoD2yQ5E=";
};
# don't use the bundled turbostat binary
postPatch = ''
substituteInPlace s0ix-selftest-tool.sh --replace '"$DIR"/turbostat' 'turbostat'
'';
nativeBuildInputs = [ makeWrapper ];
dontConfigure = true;
dontBuild = true;
installPhase = ''
runHook preInstall
install -Dm555 s0ix-selftest-tool.sh "$out/bin/s0ix-selftest-tool"
wrapProgram "$out/bin/s0ix-selftest-tool" --prefix PATH : ${lib.escapeShellArg deps}
runHook postInstall
'';
passthru.updateScript = unstableGitUpdater { };
meta = with lib; {
homepage = "https://github.com/intel/S0ixSelftestTool";
description = "A tool for testing the S2idle path CPU Package C-state and S0ix failures";
license = licenses.gpl2Only;
platforms = platforms.linux;
maintainers = with maintainers; [ adamcstephens ];
mainProgram = "s0ix-selftest-tool";
};
}