@@ -0,0 +1,40 @@
1+{ stdenv, lib, fetchFromGitHub, python27Packages, nasm, libelf
2+, kernel ? null, withDriver ? false }:
3+python27Packages.buildPythonApplication rec {
4+ name = "chipsec-${version}";
5+ version = "1.3.7";
6+
7+ src = fetchFromGitHub {
8+ owner = "chipsec";
9+ repo = "chipsec";
10+ rev = version;
11+ sha256 = "00hwhi5f24y429zazhm77l1pp31q7fmx7ks3sfm6d16v89zbcp9a";
12+ };
13+
14+ nativeBuildInputs = [
15+ nasm libelf
16+ ];
17+
18+ setupPyBuildFlags = lib.optional (!withDriver) "--skip-driver";
19+
20+ checkPhase = "python setup.py build "
21+ + lib.optionalString (!withDriver) "--skip-driver "
22+ + "test";
23+
24+ KERNEL_SRC_DIR = lib.optionalString withDriver "${kernel.dev}/lib/modules/${kernel.modDirVersion}/build";
25+
26+ meta = with stdenv.lib; {
27+ description = "Platform Security Assessment Framework";
28+ longDescription = ''
29+ CHIPSEC is a framework for analyzing the security of PC platforms
30+ including hardware, system firmware (BIOS/UEFI), and platform components.
31+ It includes a security test suite, tools for accessing various low level
32+ interfaces, and forensic capabilities. It can be run on Windows, Linux,
33+ Mac OS X and UEFI shell.
34+ '';
35+ license = licenses.gpl2;
36+ homepage = https://github.com/chipsec/chipsec;
37+ maintainers = with maintainers; [ johnazoidberg ];
38+ platforms = if withDriver then [ "x86_64-linux" ] else platforms.all;
39+ };
40+}