about summary refs log tree commit diff
path: root/pkgs/by-name/cp
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/by-name/cp')
-rw-r--r--pkgs/by-name/cp/cp2k/package.nix273
-rw-r--r--pkgs/by-name/cp/cp2k/remove-compiler-options.patch37
-rw-r--r--pkgs/by-name/cp/cppcheck/package.nix97
-rw-r--r--pkgs/by-name/cp/cppitertools/package.nix99
-rw-r--r--pkgs/by-name/cp/cpu-energy-meter/package.nix40
-rw-r--r--pkgs/by-name/cp/cpu-x/package.nix107
-rw-r--r--pkgs/by-name/cp/cpuinfo/package.nix51
7 files changed, 676 insertions, 28 deletions
diff --git a/pkgs/by-name/cp/cp2k/package.nix b/pkgs/by-name/cp/cp2k/package.nix
new file mode 100644
index 0000000000000..95c7f04610327
--- /dev/null
+++ b/pkgs/by-name/cp/cp2k/package.nix
@@ -0,0 +1,273 @@
+{
+  lib,
+  stdenv,
+  fetchFromGitHub,
+  mpiCheckPhaseHook,
+  python3,
+  gfortran,
+  blas,
+  lapack,
+  fftw,
+  libint,
+  libvori,
+  libxc,
+  dftd4,
+  mctc-lib,
+  mstore,
+  multicharge,
+  mpi,
+  gsl,
+  scalapack,
+  openssh,
+  makeWrapper,
+  libxsmm,
+  spglib,
+  which,
+  pkg-config,
+  plumed,
+  zlib,
+  hdf5-fortran,
+  sirius,
+  libvdwxc,
+  spla,
+  spfft,
+  enableElpa ? false,
+  elpa,
+  cudaPackages,
+  rocmPackages,
+  config,
+  gpuBackend ? (
+    if config.cudaSupport then
+      "cuda"
+    else if config.rocmSupport then
+      "rocm"
+    else
+      "none"
+  ),
+  # Change to a value suitable for your target GPU.
+  # For AMD values see https://github.com/cp2k/cp2k/blob/master/INSTALL.md#2v-rocmhip-support-for-amd-gpu
+  # and for Nvidia see https://github.com/cp2k/cp2k/blob/master/INSTALL.md#2i-cuda-optional-improved-performance-on-gpu-systems
+  gpuVersion ? (if gpuBackend == "cuda" then "A100" else "Mi100"),
+  gpuArch ? (if gpuBackend == "cuda" then "sm_80" else "gfx908"),
+}:
+
+assert builtins.elem gpuBackend [
+  "none"
+  "cuda"
+  "rocm"
+];
+
+let
+  cp2kVersion = "psmp";
+  arch = "Linux-x86-64-gfortran";
+
+in
+stdenv.mkDerivation rec {
+  pname = "cp2k";
+  version = "2024.3";
+
+  src = fetchFromGitHub {
+    owner = "cp2k";
+    repo = "cp2k";
+    rev = "v${version}";
+    hash = "sha256-TeVQ0wVUx6d4knwMi9z3LjQZ4ELE6s1TnvwfFz8jbYk=";
+    fetchSubmodules = true;
+  };
+
+  patches = [
+    # Remove the build command line from the source.
+    # This avoids dependencies to .dev inputs
+    ./remove-compiler-options.patch
+  ];
+
+  nativeBuildInputs = [
+    python3
+    which
+    openssh
+    makeWrapper
+    pkg-config
+  ] ++ lib.optional (gpuBackend == "cuda") cudaPackages.cuda_nvcc;
+
+  buildInputs =
+    [
+      gfortran
+      fftw
+      gsl
+      libint
+      libvori
+      libxc
+      dftd4
+      mctc-lib
+      mstore
+      multicharge
+      libxsmm
+      mpi
+      spglib
+      scalapack
+      blas
+      lapack
+      plumed
+      zlib
+      hdf5-fortran
+      sirius
+      spla
+      spfft
+      libvdwxc
+    ]
+    ++ lib.optional enableElpa elpa
+    ++ lib.optionals (gpuBackend == "cuda") [
+      cudaPackages.cuda_cudart
+      cudaPackages.libcublas
+      cudaPackages.cuda_nvrtc
+    ]
+    ++ lib.optionals (gpuBackend == "rocm") [
+      rocmPackages.clr
+      rocmPackages.rocm-core
+      rocmPackages.hipblas
+      rocmPackages.hipfft
+      rocmPackages.rocblas
+    ];
+
+  propagatedBuildInputs = [ (lib.getBin mpi) ];
+  propagatedUserEnvPkgs = [ mpi ];
+
+  makeFlags = [
+    "ARCH=${arch}"
+    "VERSION=${cp2kVersion}"
+  ];
+
+  doCheck = gpuBackend == "none";
+
+  enableParallelBuilding = true;
+
+  postPatch = ''
+    patchShebangs tools exts/dbcsr/tools/build_utils exts/dbcsr/.cp2k
+    substituteInPlace exts/build_dbcsr/Makefile \
+      --replace '/usr/bin/env python3' '${python3}/bin/python' \
+      --replace 'SHELL = /bin/sh' 'SHELL = bash'
+  '';
+
+  configurePhase = ''
+    runHook preConfigure
+
+    cat > arch/${arch}.${cp2kVersion} << EOF
+    CC         = mpicc
+    CPP        =
+    FC         = mpif90
+    LD         = mpif90
+    AR         = ar -r
+    ${lib.strings.optionalString (gpuBackend == "cuda") ''
+      OFFLOAD_CC = nvcc
+      OFFLOAD_FLAGS = -O3 -g -w --std=c++11 -arch ${gpuArch}
+      OFFLOAD_TARGET = cuda
+      GPUVER = ${gpuVersion}
+      CXX = mpicxx
+      CXXFLAGS = -std=c++11 -fopenmp
+    ''}
+    ${lib.strings.optionalString (gpuBackend == "rocm") ''
+      GPUVER = ${gpuVersion}
+      OFFLOAD_CC = hipcc
+      OFFLOAD_FLAGS = -fopenmp -m64 -pthread -fPIC -D__GRID_HIP -O2 --offload-arch=${gpuArch} --rocm-path=${rocmPackages.rocm-core}
+      OFFLOAD_TARGET = hip
+      CXX = mpicxx
+      CXXFLAGS = -std=c++11 -fopenmp -D__HIP_PLATFORM_AMD__
+    ''}
+    DFLAGS     = -D__FFTW3 -D__LIBXC -D__LIBINT -D__parallel -D__SCALAPACK \
+                 -D__MPI_VERSION=3 -D__F2008 -D__LIBXSMM -D__SPGLIB \
+                 -D__MAX_CONTR=4 -D__LIBVORI ${lib.optionalString enableElpa "-D__ELPA"} \
+                 -D__PLUMED2 -D__HDF5 -D__GSL -D__SIRIUS -D__LIBVDWXC -D__SPFFT -D__SPLA \
+                 -D__DFTD4 \
+                 ${
+                   lib.strings.optionalString (
+                     gpuBackend == "cuda"
+                   ) "-D__OFFLOAD_CUDA -D__ACC -D__DBCSR_ACC -D__NO_OFFLOAD_PW"
+                 } \
+                 ${
+                   lib.strings.optionalString (gpuBackend == "rocm") "-D__OFFLOAD_HIP -D__DBCSR_ACC -D__NO_OFFLOAD_PW"
+                 }
+    CFLAGS    = -fopenmp
+    FCFLAGS    = \$(DFLAGS) -O2 -ffree-form -ffree-line-length-none \
+                 -ftree-vectorize -funroll-loops -msse2 \
+                 -std=f2008 \
+                 -fopenmp -ftree-vectorize -funroll-loops \
+                   ${lib.optionalString enableElpa "$(pkg-config --variable=fcflags elpa)"} \
+                 -I${lib.getDev libint}/include  \
+                 -I${lib.getDev sirius}/include/sirius \
+                 -I${lib.getDev libxc}/include \
+                 -I${lib.getDev dftd4}/include/dftd4 \
+                 -I${lib.getDev libxsmm}/include \
+                 -I${lib.getDev hdf5-fortran}/include \
+                 -fallow-argument-mismatch
+    LIBS       = -lfftw3 -lfftw3_threads \
+                 -lscalapack -lblas -llapack \
+                 -lxcf03 -lxc -lxsmmf -lxsmm -lsymspg \
+                 -lint2 -lstdc++ -lvori \
+                 -lgomp -lpthread -lm \
+                 -fopenmp ${lib.optionalString enableElpa "$(pkg-config --libs elpa)"} \
+                 -lz -ldl ${lib.optionalString (mpi.pname == "openmpi") "$(mpicxx --showme:link)"} \
+                 -lplumed -lhdf5_fortran -lhdf5_hl -lhdf5 -lgsl -lsirius -lspla -lspfft -lvdwxc \
+                 -ldftd4 -lmstore -lmulticharge -lmctc-lib \
+                 ${
+                   lib.strings.optionalString (gpuBackend == "cuda") ''
+                     -L${cudaPackages.cuda_cudart}/lib/stubs/ \
+                     -lcudart -lnvrtc -lcuda -lcublas
+                   ''
+                 } \
+                 ${
+                   lib.strings.optionalString (gpuBackend == "rocm") "-lamdhip64 -lhipfft -lhipblas -lrocblas"
+                 }
+    LDFLAGS    = \$(FCFLAGS) \$(LIBS)
+    include ${plumed}/lib/plumed/src/lib/Plumed.inc
+    EOF
+
+    runHook postConfigure
+  '';
+
+  nativeCheckInputs = [
+    mpiCheckPhaseHook
+    openssh
+  ];
+
+  checkPhase = ''
+    runHook preCheck
+
+    export CP2K_DATA_DIR=data
+    mpirun -np 2 exe/${arch}/libcp2k_unittest.${cp2kVersion}
+
+    runHook postCheck
+  '';
+
+  installPhase = ''
+    runHook preInstall
+
+    mkdir -p $out/bin $out/share/cp2k
+
+    cp exe/${arch}/* $out/bin
+    rm $out/bin/*_unittest.*
+
+    for i in cp2k cp2k_shell graph; do
+      wrapProgram $out/bin/$i.${cp2kVersion} \
+        --set-default CP2K_DATA_DIR $out/share/cp2k
+    done
+
+    wrapProgram $out/bin/cp2k.popt \
+      --set-default CP2K_DATA_DIR $out/share/cp2k \
+      --set OMP_NUM_THREADS 1
+
+    cp -r data/* $out/share/cp2k
+
+    runHook postInstall
+  '';
+
+  passthru = {
+    inherit mpi;
+  };
+
+  meta = {
+    description = "Quantum chemistry and solid state physics program";
+    homepage = "https://www.cp2k.org";
+    license = lib.licenses.gpl2Plus;
+    maintainers = [ lib.maintainers.sheepforce ];
+    platforms = [ "x86_64-linux" ];
+  };
+}
diff --git a/pkgs/by-name/cp/cp2k/remove-compiler-options.patch b/pkgs/by-name/cp/cp2k/remove-compiler-options.patch
new file mode 100644
index 0000000000000..e6cf81494aa33
--- /dev/null
+++ b/pkgs/by-name/cp/cp2k/remove-compiler-options.patch
@@ -0,0 +1,37 @@
+diff --git a/src/start/cp2k.F b/src/start/cp2k.F
+index f69146ea3..a195f0620 100644
+--- a/src/start/cp2k.F
++++ b/src/start/cp2k.F
+@@ -58,8 +58,7 @@ PROGRAM cp2k
+    USE input_cp2k,                      ONLY: create_cp2k_root_section
+    USE input_section_types,             ONLY: section_release,&
+                                               section_type
+-   USE iso_fortran_env,                 ONLY: compiler_options,&
+-                                              compiler_version
++   USE iso_fortran_env,                 ONLY: compiler_version
+    USE kinds,                           ONLY: default_path_length
+    USE machine,                         ONLY: default_output_unit
+ #include "../base/base_uses.f90"
+@@ -70,7 +69,6 @@ PROGRAM cp2k
+                                            arg_att, command
+    CHARACTER(LEN=default_path_length), &
+       DIMENSION(:, :), ALLOCATABLE      :: initial_variables, initial_variables_tmp
+-   CHARACTER(LEN=:), ALLOCATABLE        :: compiler_options_string
+    INTEGER                              :: output_unit, l, i, var_set_sep, inp_var_idx
+    INTEGER                              :: ierr, i_arg
+    LOGICAL                              :: check, usage, echo_input, command_line_error
+@@ -328,14 +326,6 @@ PROGRAM cp2k
+                WRITE (output_unit, "(T2,A)") cp2k_version, &
+                   "Source code revision "//TRIM(compile_revision), &
+                   TRIM(cp2k_flags())
+-               compiler_options_string = compiler_options()
+-               WRITE (output_unit, "(T2,A,A)") "compiler: ", compiler_version()
+-               WRITE (output_unit, "(T2,A)") "compiler options:"
+-               DO i = 0, (LEN(compiler_options_string) - 1)/68
+-                  WRITE (output_unit, "(T4,A)") &
+-                     compiler_options_string(i*68 + 1:MIN(LEN(compiler_options_string), (i + 1)*68))
+-               END DO
+-               DEALLOCATE (compiler_options_string)
+             END IF
+          END IF
+ 
diff --git a/pkgs/by-name/cp/cppcheck/package.nix b/pkgs/by-name/cp/cppcheck/package.nix
new file mode 100644
index 0000000000000..d7ed4fb99c476
--- /dev/null
+++ b/pkgs/by-name/cp/cppcheck/package.nix
@@ -0,0 +1,97 @@
+{
+  lib,
+  stdenv,
+  fetchFromGitHub,
+
+  docbook_xml_dtd_45,
+  docbook_xsl,
+  installShellFiles,
+  libxslt,
+  pcre,
+  pkg-config,
+  python3,
+  which,
+}:
+
+stdenv.mkDerivation (finalAttrs: {
+  pname = "cppcheck";
+  version = "2.15.0";
+
+  outputs = [
+    "out"
+    "man"
+  ];
+
+  src = fetchFromGitHub {
+    owner = "danmar";
+    repo = "cppcheck";
+    rev = finalAttrs.version;
+    hash = "sha256-6AI3sy4D+YhUOpy02UHJWyhelbqcoEW+Tw/ADCPEbuM=";
+  };
+
+  nativeBuildInputs = [
+    docbook_xml_dtd_45
+    docbook_xsl
+    installShellFiles
+    libxslt
+    pkg-config
+    python3
+    which
+  ];
+
+  buildInputs = [
+    pcre
+    (python3.withPackages (ps: [ ps.pygments ]))
+  ];
+
+  makeFlags = [
+    "PREFIX=$(out)"
+    "MATCHCOMPILER=yes"
+    "FILESDIR=$(out)/share/cppcheck"
+    "HAVE_RULES=yes"
+  ];
+
+  enableParallelBuilding = true;
+  strictDeps = true;
+
+  # test/testcondition.cpp:4949(TestCondition::alwaysTrueContainer): Assertion failed.
+  doCheck = !(stdenv.hostPlatform.isLinux && stdenv.hostPlatform.isAarch64);
+  doInstallCheck = true;
+
+  postPatch = ''
+    substituteInPlace Makefile \
+      --replace 'PCRE_CONFIG = $(shell which pcre-config)' 'PCRE_CONFIG = $(PKG_CONFIG) libpcre'
+  '';
+
+  postBuild = ''
+    make DB2MAN=${docbook_xsl}/xml/xsl/docbook/manpages/docbook.xsl man
+  '';
+
+  postInstall = ''
+    installManPage cppcheck.1
+  '';
+
+  installCheckPhase = ''
+    runHook preInstallCheck
+
+    echo 'int main() {}' > ./installcheck.cpp
+    $out/bin/cppcheck ./installcheck.cpp > /dev/null
+
+    runHook postInstallCheck
+  '';
+
+  meta = {
+    description = "Static analysis tool for C/C++ code";
+    longDescription = ''
+      Check C/C++ code for memory leaks, mismatching allocation-deallocation,
+      buffer overruns and more.
+    '';
+    homepage = "http://cppcheck.sourceforge.net";
+    license = lib.licenses.gpl3Plus;
+    maintainers = with lib.maintainers; [
+      joachifm
+      paveloom
+    ];
+    platforms = lib.platforms.unix;
+  };
+})
diff --git a/pkgs/by-name/cp/cppitertools/package.nix b/pkgs/by-name/cp/cppitertools/package.nix
new file mode 100644
index 0000000000000..e9ddcdb1b339b
--- /dev/null
+++ b/pkgs/by-name/cp/cppitertools/package.nix
@@ -0,0 +1,99 @@
+{
+  lib,
+  stdenv,
+  cmake,
+  boost,
+  catch2,
+  fetchFromGitHub,
+}:
+
+stdenv.mkDerivation (finalAttrs: {
+  pname = "cppitertools";
+  version = "2.1";
+
+  src = fetchFromGitHub {
+    owner = "ryanhaining";
+    repo = "cppitertools";
+    rev = "refs/tags/v${finalAttrs.version}";
+    hash = "sha256-mii4xjxF1YC3H/TuO/o4cEz8bx2ko6U0eufqNVw5LNA=";
+  };
+
+  __structuredAttrs = true;
+
+  # cppitertools has support files for three buildsystems in its repo:
+  # Scons, Bazel, and CMake. The first two only have definitions for running
+  # tests. The CMake system defines tests and install targets, including a
+  # cppitertools-config.cmake, which is really helpful for downstream consumers
+  # to detect this package since it has no pkg-config.
+  # However the CMake system also specifies the entire source repo as an install
+  # target, including support files, the build directory, etc.
+  # We can't simply take cppitertools-config.cmake for ourselves because before
+  # install it's placed in non-specific private CMake subdirectory of the build
+  # directory.
+  # Therefore, we instead simply patch CMakeLists.txt to make the target that
+  # installs the entire directory non-default, and then install the headers manually.
+
+  strictDeps = true;
+
+  doCheck = true;
+
+  nativeBuildInputs = [ cmake ];
+
+  buildInputs = [ boost ];
+
+  nativeCheckInputs = [ catch2 ];
+
+  # Required on case-sensitive filesystems to not conflict with the Bazel BUILD
+  # files that are also in that repo.
+  cmakeBuildDir = "cmake-build";
+
+  includeInstallDir = "${builtins.placeholder "out"}/include/cppitertools";
+  cmakeInstallDir = "${builtins.placeholder "out"}/share/cmake";
+
+  # This version of cppitertools considers itself as having used the default value,
+  # and issues warning, unless -Dcppitertools_INSTALL_CMAKE_DIR is present as an
+  # *environment* variable. It doesn't actually use the value from this environment
+  # variable at all though, so we still need to pass it in cmakeFlags.
+  env.cppitertools_INSTALL_CMAKE_DIR = finalAttrs.cmakeInstallDir;
+
+  cmakeFlags = [ "-Dcppitertools_INSTALL_CMAKE_DIR=${finalAttrs.cmakeInstallDir}" ];
+
+  prePatch =
+    ''
+      # Mark the `.` install target as non-default.
+      substituteInPlace CMakeLists.txt \
+        --replace-fail "  DIRECTORY ." "  DIRECTORY . EXCLUDE_FROM_ALL"
+    ''
+    + lib.optionalString finalAttrs.finalPackage.doCheck ''
+      # Required for tests.
+      cp ${lib.getDev catch2}/include/catch2/catch.hpp test/
+    '';
+
+  checkPhase = ''
+    runHook preCheck
+    cmake -B build-test -S ../test
+    cmake --build build-test -j$NIX_BUILD_CORES
+    runHook postCheck
+  '';
+
+  installPhase = ''
+    runHook preInstall
+    # Install the -config.cmake files.
+    cmake --install . "--prefix=$out"
+    # Install the headers.
+    mkdir -p "$includeInstallDir"
+    cp -r ../*.hpp ../internal "$includeInstallDir"
+    runHook postInstall
+  '';
+
+  meta = {
+    description = "Implementation of Python itertools and builtin iteration functions for C++17";
+    longDescription = ''
+      Range-based for loop add-ons inspired by the Python builtins and itertools library
+      for C++17, using lazy evaluation wherever possible.
+    '';
+    homepage = "https://github.com/ryanhaining/cppitertools";
+    maintainers = with lib.maintainers; [ qyriad ];
+    license = with lib.licenses; bsd2;
+  };
+})
diff --git a/pkgs/by-name/cp/cpu-energy-meter/package.nix b/pkgs/by-name/cp/cpu-energy-meter/package.nix
new file mode 100644
index 0000000000000..7ddbf8f6d283a
--- /dev/null
+++ b/pkgs/by-name/cp/cpu-energy-meter/package.nix
@@ -0,0 +1,40 @@
+{ lib
+, stdenv
+, fetchFromGitHub
+, libcap
+}:
+stdenv.mkDerivation rec {
+  pname = "cpu-energy-meter";
+  version = "1.2";
+
+  src = fetchFromGitHub {
+    owner = "sosy-lab";
+    repo = "cpu-energy-meter";
+    rev = version;
+    hash = "sha256-QW65Z8mRYLHcyLeOtNAHjwPNWAUP214wqIYclK+whFw=";
+  };
+
+  postPatch = ''
+    substituteInPlace Makefile \
+      --replace "DESTDIR :=" "DESTDIR := $out" \
+      --replace "PREFIX := /usr/local" "PREFIX :="
+  '';
+
+  buildInputs = [ libcap ];
+
+  env.NIX_CFLAGS_COMPILE = "-fcommon";
+
+  postInstall = ''
+    install -Dm444 -t $out/etc/udev/rules.d $src/debian/additional_files/59-msr.rules
+  '';
+
+  meta = with lib; {
+    description = "Tool for measuring energy consumption of Intel CPUs";
+    homepage = "https://github.com/sosy-lab/cpu-energy-meter";
+    changelog = "https://github.com/sosy-lab/cpu-energy-meter/blob/main/CHANGELOG.md";
+    maintainers = with maintainers; [ lorenzleutgeb ];
+    license = licenses.bsd3;
+    platforms = [ "x86_64-linux" ];
+    mainProgram = "cpu-energy-meter";
+  };
+}
diff --git a/pkgs/by-name/cp/cpu-x/package.nix b/pkgs/by-name/cp/cpu-x/package.nix
index 1f8df689b79a9..372ebbce2a504 100644
--- a/pkgs/by-name/cp/cpu-x/package.nix
+++ b/pkgs/by-name/cp/cpu-x/package.nix
@@ -1,12 +1,35 @@
-{ lib, stdenv, fetchFromGitHub, cmake, pkg-config, gtk3, ncurses
-, libcpuid, pciutils, procps, wrapGAppsHook3, nasm, makeWrapper
-, opencl-headers, ocl-icd
-, vulkan-headers, vulkan-loader, glfw
-, libXdmcp, pcre, util-linux
-, libselinux, libsepol
-, libthai, libdatrie, libxkbcommon, libepoxy
-, dbus, at-spi2-core
-, libXtst
+{
+  lib,
+  testers,
+  stdenv,
+  fetchFromGitHub,
+  cmake,
+  pkg-config,
+  gtk3,
+  ncurses,
+  libcpuid,
+  pciutils,
+  procps,
+  wrapGAppsHook3,
+  nasm,
+  opencl-headers,
+  ocl-icd,
+  vulkan-headers,
+  vulkan-loader,
+  glfw,
+  libXdmcp,
+  pcre,
+  util-linux,
+  libselinux,
+  libsepol,
+  libthai,
+  libdatrie,
+  libxkbcommon,
+  libepoxy,
+  dbus,
+  at-spi2-core,
+  libXtst,
+  gtkmm3,
 }:
 
 # Known issues:
@@ -14,41 +37,69 @@
 #   registered in /etc/shells. The nix's bash is not in there when running
 #   cpu-x from nixpkgs.
 
-stdenv.mkDerivation rec {
+stdenv.mkDerivation (finalAttrs: {
   pname = "cpu-x";
-  version = "5.0.3";
+  version = "5.0.4";
 
   src = fetchFromGitHub {
     owner = "X0rg";
     repo = "CPU-X";
-    rev = "v${version}";
-    sha256 = "sha256-iaqqBeoack41D07Bbr0Fo1JXfF2ksXbqS5V5Ymt6Qvg=";
+    rev = "refs/tags/v${finalAttrs.version}";
+    hash = "sha256-8jJP0gxH3B6qLrhKNa4P9ZfSjxaXTeBB1+UuadflLQo=";
   };
 
-  nativeBuildInputs = [ cmake pkg-config wrapGAppsHook3 nasm makeWrapper ];
+  nativeBuildInputs = [
+    cmake
+    pkg-config
+    wrapGAppsHook3
+    nasm
+  ];
+
   buildInputs = [
-    gtk3 ncurses libcpuid pciutils procps
-    vulkan-headers vulkan-loader glfw
-    opencl-headers ocl-icd
-    libXdmcp pcre util-linux
-    libselinux libsepol
-    libthai libdatrie libxkbcommon libepoxy
-    dbus at-spi2-core
+    gtk3
+    gtkmm3
+    ncurses
+    libcpuid
+    pciutils
+    procps
+    vulkan-headers
+    vulkan-loader
+    glfw
+    opencl-headers
+    ocl-icd
+    libXdmcp
+    pcre
+    util-linux
+    libselinux
+    libsepol
+    libthai
+    libdatrie
+    libxkbcommon
+    libepoxy
+    dbus
+    at-spi2-core
     libXtst
   ];
 
-  postInstall = ''
-    wrapProgram $out/bin/cpu-x \
-      --prefix PATH : ${lib.makeBinPath [ stdenv.cc ]} \
+  preFixup = ''
+    gappsWrapperArgs+=(
+      --prefix PATH : ${lib.makeBinPath [ stdenv.cc ]}
       --prefix LD_LIBRARY_PATH : ${vulkan-loader}/lib
+    )
   '';
 
-  meta = with lib; {
+  passthru = {
+    tests = {
+      version = testers.testVersion { package = finalAttrs.finalPackage; };
+    };
+  };
+
+  meta = {
     description = "Free software that gathers information on CPU, motherboard and more";
     mainProgram = "cpu-x";
     homepage = "https://thetumultuousunicornofdarkness.github.io/CPU-X";
-    license = licenses.gpl3Plus;
+    license = lib.licenses.gpl3Plus;
     platforms = [ "x86_64-linux" ];
-    maintainers = with maintainers; [ viraptor ];
+    maintainers = with lib.maintainers; [ viraptor ];
   };
-}
+})
diff --git a/pkgs/by-name/cp/cpuinfo/package.nix b/pkgs/by-name/cp/cpuinfo/package.nix
new file mode 100644
index 0000000000000..9eca8f7f70221
--- /dev/null
+++ b/pkgs/by-name/cp/cpuinfo/package.nix
@@ -0,0 +1,51 @@
+{
+  lib,
+  fetchFromGitHub,
+  cmake,
+  pkg-config,
+  stdenv,
+  gtest,
+  nix-update-script,
+  testers,
+}:
+stdenv.mkDerivation (finalAttrs: {
+  pname = "cpuinfo";
+  version = "0-unstable-2024-09-11";
+
+  src = fetchFromGitHub {
+    owner = "pytorch";
+    repo = "cpuinfo";
+    rev = "a5ff6df40ce528721cfc310c7ed43946d77404d5";
+    hash = "sha256-JbIEQ6jFprbMpeH8IBhuRo3VXxo8a32lmT4yfxSIEj0=";
+  };
+
+  passthru.updateScript = nix-update-script { extraArgs = [ "--version=branch" ]; };
+
+  passthru.tests.pkg-config = testers.testMetaPkgConfig finalAttrs.finalPackage;
+
+  nativeBuildInputs = [
+    cmake
+    pkg-config
+  ];
+
+  checkInputs = [ gtest ];
+
+  cmakeFlags = [
+    (lib.cmakeBool "CPUINFO_BUILD_UNIT_TESTS" finalAttrs.finalPackage.doCheck)
+    (lib.cmakeBool "CPUINFO_BUILD_MOCK_TESTS" finalAttrs.finalPackage.doCheck)
+    (lib.cmakeBool "CPUINFO_BUILD_BENCHMARKS" false)
+    (lib.cmakeBool "USE_SYSTEM_LIBS" true)
+  ];
+
+  doCheck = !(stdenv.hostPlatform.isLinux && stdenv.hostPlatform.isAarch64);
+
+  meta = {
+    description = "Tools and library to detect essential for performance optimization information about host CPU";
+    homepage = "https://github.com/pytorch/cpuinfo";
+    license = lib.licenses.bsd2;
+    mainProgram = "cpu-info";
+    maintainers = with lib.maintainers; [ pawelchcki ];
+    pkgConfigModules = [ "libcpuinfo" ];
+    platforms = lib.platforms.all;
+  };
+})