Files
nixpkgs/pkgs/by-name/cp/cpuinfo/package.nix
Dark Steveneq 646b892680
Some checks failed
Periodic Merges (6h) / master → staging-nixos (push) Failing after 12m50s
Periodic Merges (6h) / master → staging-next (push) Failing after 12m54s
Periodic Merges (24h) / merge-base(master,staging) → haskell-updates (push) Failing after 11m54s
Periodic Merges (6h) / staging-next → staging (push) Failing after 12m13s
Periodic Merges (24h) / staging-next-25.05 → staging-25.05 (push) Failing after 13m24s
Periodic Merges (24h) / release-25.05 → staging-next-25.05 (push) Failing after 14m28s
push sheeet
2025-10-09 14:15:47 +02:00

57 lines
1.8 KiB
Nix

{
lib,
fetchFromGitHub,
cmake,
pkg-config,
stdenv,
gtest,
nix-update-script,
testers,
}:
stdenv.mkDerivation (finalAttrs: {
pname = "cpuinfo";
version = "0-unstable-2025-07-24";
src = fetchFromGitHub {
owner = "pytorch";
repo = "cpuinfo";
rev = "33ed0be77d7767d0e2010e2c3cf972ef36c7c307";
hash = "sha256-0rZzbZkOo6DAt1YnH4rtx0FvmCuYH8M6X3DNJ0gURpU=";
};
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)
];
# The tests check what CPU the host has and makes sure it can query information.
# not all build environments may have this information available. And, cpuinfo may
# not understand all CPUs (causing test failures such as https://github.com/pytorch/cpuinfo/issues/132)
# Instead, allow building in any environment.
doCheck = false;
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" ];
# https://github.com/pytorch/cpuinfo/blob/877328f188a3c7d1fa855871a278eb48d530c4c0/CMakeLists.txt#L98
platforms = lib.platforms.x86 ++ lib.platforms.aarch ++ lib.platforms.riscv;
};
})