summary refs log tree commit diff
path: root/pkgs/os-specific/linux/x86info/default.nix
blob: f330fbbe6c7a4b74ae2c47fe3fe1b4db535b17da (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
{ lib
, stdenv
, fetchFromGitHub
, pciutils
, pkg-config
, python3
}:

stdenv.mkDerivation rec {
  pname = "x86info";
  version = "unstable-2021-08-07";

  src = fetchFromGitHub {
    owner = "kernelslacker";
    repo = pname;
    rev = "061ea35ecb0697761b6260998fa2045b8bb0be68";
    hash = "sha256-/qWioC4dV1bQkU4SiTR8duYqoGIMIH7s8vuAXi75juo=";
  };

  nativeBuildInputs = [
    pkg-config
    python3
  ];

  buildInputs = [
    pciutils
  ];

  # causes redefinition of _FORTIFY_SOURCE
  hardeningDisable = [ "fortify3" ];

  postBuild = ''
    patchShebangs lsmsr/createheader.py
    make -C lsmsr
  '';

  installPhase = ''
    mkdir -p $out/bin
    cp x86info $out/bin
    cp lsmsr/lsmsr $out/bin
  '';

  meta = {
    description = "Identification utility for the x86 series of processors";
    longDescription = ''
      x86info will identify all Intel/AMD/Centaur/Cyrix/VIA CPUs. It leverages
      the cpuid kernel module where possible.  it supports parsing model specific
      registers (MSRs) via the msr kernel module.  it will approximate processor
      frequency, and identify the cache sizes and layout.
    '';
    platforms = [ "i686-linux" "x86_64-linux" ];
    license = lib.licenses.gpl2;
    homepage = "https://github.com/kernelslacker/x86info";
    maintainers = with lib.maintainers; [ jcumming ];
  };
}