11 python3.pkgs.buildPythonApplication rec {
15 disabled = !stdenv.hostPlatform.isLinux;
17 src = fetchFromGitHub {
21 hash = "sha256-+pbFG1SmSO/cnt1e+kel7ereC0I1OCJKKsS0KaJDWdc=";
24 patches = lib.optionals withDriver [ ./ko-path.diff ./compile-ko.diff ];
27 substituteInPlace tests/software/util.py \
28 --replace-fail "assertRegexpMatches" "assertRegex"
31 KSRC = lib.optionalString withDriver "${kernel.dev}/lib/modules/${kernel.modDirVersion}/build";
35 ] ++ lib.optionals (lib.meta.availableOn stdenv.buildPlatform elfutils) [
37 ] ++ lib.optionals withDriver kernel.moduleBuildDependencies;
39 nativeCheckInputs = with python3.pkgs; [
44 preBuild = lib.optionalString withDriver ''
45 export CHIPSEC_BUILD_LIB=$(mktemp -d)
46 mkdir -p $CHIPSEC_BUILD_LIB/chipsec/helper/linux
49 env.NIX_CFLAGS_COMPILE = toString [
51 "-Wno-error=dangling-pointer"
54 preInstall = lib.optionalString withDriver ''
55 mkdir -p $out/${python3.pkgs.python.sitePackages}/drivers/linux
56 mv $CHIPSEC_BUILD_LIB/chipsec/helper/linux/chipsec.ko \
57 $out/${python3.pkgs.python.sitePackages}/drivers/linux/chipsec.ko
61 "--build-lib=$CHIPSEC_BUILD_LIB"
62 ] ++ lib.optionals (!withDriver) [
66 pythonImportsCheck = [
71 description = "Platform Security Assessment Framework";
73 CHIPSEC is a framework for analyzing the security of PC platforms
74 including hardware, system firmware (BIOS/UEFI), and platform components.
75 It includes a security test suite, tools for accessing various low level
76 interfaces, and forensic capabilities. It can be run on Windows, Linux,
77 Mac OS X and UEFI shell.
79 license = licenses.gpl2Only;
80 homepage = "https://github.com/chipsec/chipsec";
81 maintainers = with maintainers; [ johnazoidberg erdnaxe ];
82 platforms = [ "x86_64-linux" ] ++ lib.optional (!withDriver) "x86_64-darwin";
83 # https://github.com/chipsec/chipsec/issues/1793
84 broken = withDriver && kernel.kernelOlder "5.4" && kernel.isHardened;