about summary refs log tree commit diff
path: root/pkgs
diff options
context:
space:
mode:
authorSandro <sandro.jaeckel@gmail.com>2024-05-18 15:52:30 +0200
committerGitHub <noreply@github.com>2024-05-18 15:52:30 +0200
commitc21d10ba30f90d5554f0e16fb73af52600f1f8f4 (patch)
treee7f22b24a44939ece33f6853f8000e0aaf0b8837 /pkgs
parentc7829cdc44581b1a589f6d84c125b2501fd158c5 (diff)
parent9f2f6359bb22bddf828ccd6cd4f5abcceffad39e (diff)
Merge pull request #263375 from lorenzleutgeb/benchexec
benchexec: init at 3.21
Diffstat (limited to 'pkgs')
-rw-r--r--pkgs/by-name/be/benchexec/package.nix62
-rw-r--r--pkgs/by-name/cp/cpu-energy-meter/package.nix40
-rw-r--r--pkgs/by-name/pq/pqos-wrapper/package.nix28
3 files changed, 130 insertions, 0 deletions
diff --git a/pkgs/by-name/be/benchexec/package.nix b/pkgs/by-name/be/benchexec/package.nix
new file mode 100644
index 0000000000000..abc04b97cb8de
--- /dev/null
+++ b/pkgs/by-name/be/benchexec/package.nix
@@ -0,0 +1,62 @@
+{ lib
+, fetchFromGitHub
+, python3
+, libseccomp
+, nixosTests
+, testers
+, benchexec
+}:
+python3.pkgs.buildPythonApplication rec {
+  pname = "benchexec";
+  version = "3.21";
+
+  src = fetchFromGitHub {
+    owner = "sosy-lab";
+    repo = "benchexec";
+    rev = version;
+    hash = "sha256-bE3brmmLHZQakDKvd47I1hm9Dcsu6DrSeJyjWWtEZWI=";
+  };
+
+  pyproject = true;
+
+  nativeBuildInputs = with python3.pkgs; [ setuptools ];
+
+  # NOTE: CPU Energy Meter is not added,
+  # because BenchExec should call the wrapper configured
+  # via `security.wrappers.cpu-energy-meter`
+  # in `programs.cpu-energy-meter`, which will have the required
+  # capabilities to access MSR.
+  # If we add `cpu-energy-meter` here, BenchExec will instead call an executable
+  # without `CAP_SYS_RAWIO` and fail.
+  propagatedBuildInputs = with python3.pkgs; [
+    coloredlogs
+    lxml
+    pystemd
+    pyyaml
+  ];
+
+  makeWrapperArgs = [ "--set-default LIBSECCOMP ${lib.getLib libseccomp}/lib/libseccomp.so" ];
+
+  passthru.tests =
+    let
+      testVersion = result: testers.testVersion {
+        command = "${result} --version";
+        package = benchexec;
+      };
+    in
+    {
+      nixos = nixosTests.benchexec;
+      benchexec-version = testVersion "benchexec";
+      runexec-version = testVersion "runexec";
+      table-generator-version = testVersion "table-generator";
+      containerexec-version = testVersion "containerexec";
+    };
+
+  meta = with lib; {
+    description = "A Framework for Reliable Benchmarking and Resource Measurement.";
+    homepage = "https://github.com/sosy-lab/benchexec";
+    maintainers = with maintainers; [ lorenzleutgeb ];
+    license = licenses.asl20;
+    mainProgram = "benchexec";
+  };
+}
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..6d31da594645c
--- /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 = "A 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/pq/pqos-wrapper/package.nix b/pkgs/by-name/pq/pqos-wrapper/package.nix
new file mode 100644
index 0000000000000..d0235fedc3a71
--- /dev/null
+++ b/pkgs/by-name/pq/pqos-wrapper/package.nix
@@ -0,0 +1,28 @@
+{ lib
+, intel-cmt-cat
+, fetchFromGitLab
+, python3
+}:
+python3.pkgs.buildPythonApplication rec {
+  pname = "pqos-wrapper";
+  version = "unstable-2022-01-31";
+
+  src = fetchFromGitLab {
+    group = "sosy-lab";
+    owner = "software";
+    repo = pname;
+    rev = "ce816497a07dcb4b931652b98359e4601a292b15";
+    hash = "sha256-SaYr6lVucpJjVtGgxRbDGYbOoBwdfEDVKtvD+M1L0o4=";
+  };
+
+  makeWrapperArgs = [ "--prefix LD_LIBRARY_PATH : ${lib.makeLibraryPath [ intel-cmt-cat ]}" ];
+
+  meta = with lib; {
+    description = "Wrapper for Intel PQoS for the purpose of using it in BenchExec";
+    homepage = "https://gitlab.com/sosy-lab/software/pqos-wrapper";
+    maintainers = with maintainers; [ lorenzleutgeb ];
+    license = licenses.asl20;
+    platforms = [ "x86_64-linux" ];
+    mainProgram = "pqos_wrapper";
+  };
+}