btrbk: add mainProgram (#356350)
[NixPkgs.git] / pkgs / by-name / s0 / s0ix-selftest-tool / package.nix
blobb607fcc861f6a8f97c81dce9996862f38f025ef6
2   acpica-tools,
3   bc,
4   coreutils,
5   fetchFromGitHub,
6   gawk,
7   gnugrep,
8   gnused,
9   linuxPackages,
10   lib,
11   pciutils,
12   powertop,
13   makeWrapper,
14   stdenv,
15   unstableGitUpdater,
16   util-linux,
17   xorg,
18   xxd,
21 let
22   deps = [
23     acpica-tools
24     bc
25     coreutils
26     gawk
27     gnugrep
28     gnused
29     linuxPackages.turbostat
30     pciutils
31     powertop
32     util-linux
33     xorg.xset
34     xxd
35   ];
37 stdenv.mkDerivation {
38   pname = "s0ix-selftest-tool";
39   version = "0-unstable-2024-09-22";
41   src = fetchFromGitHub {
42     owner = "intel";
43     repo = "S0ixSelftestTool";
44     rev = "3af4af2009cb01da43ddae906f671d435494a0dc";
45     hash = "sha256-phQxlbQB3J08tPtcw4vqupVgAT9gsSJxgPT044SMMNk=";
46   };
48   # don't use the bundled turbostat binary
49   postPatch = ''
50     substituteInPlace s0ix-selftest-tool.sh --replace '"$DIR"/turbostat' 'turbostat'
51   '';
53   nativeBuildInputs = [ makeWrapper ];
54   dontConfigure = true;
55   dontBuild = true;
57   installPhase = ''
58     runHook preInstall
59     install -Dm555 s0ix-selftest-tool.sh "$out/bin/s0ix-selftest-tool"
60     wrapProgram "$out/bin/s0ix-selftest-tool" --prefix PATH : ${lib.escapeShellArg deps}
61     runHook postInstall
62   '';
64   passthru.updateScript = unstableGitUpdater { };
66   meta = with lib; {
67     homepage = "https://github.com/intel/S0ixSelftestTool";
68     description = "Tool for testing the S2idle path CPU Package C-state and S0ix failures";
69     license = licenses.gpl2Only;
70     platforms = platforms.linux;
71     maintainers = with maintainers; [ adamcstephens ];
72     mainProgram = "s0ix-selftest-tool";
73   };