From 74e4125f1805c9c420160e56ce20de3ffa41d085 Mon Sep 17 00:00:00 2001 From: emmabastas Date: Fri, 27 May 2022 00:02:41 +0200 Subject: [PATCH] spectre-cli: init at unstable-2021-02-05 Co-authored-by: FliegendeWurst <2012gdwu+github@posteo.de> Co-authored-by: SuperSandro2000 --- pkgs/tools/security/spectre-cli/default.nix | 73 +++++++++++++++++++++ pkgs/top-level/all-packages.nix | 2 + 2 files changed, 75 insertions(+) create mode 100644 pkgs/tools/security/spectre-cli/default.nix diff --git a/pkgs/tools/security/spectre-cli/default.nix b/pkgs/tools/security/spectre-cli/default.nix new file mode 100644 index 00000000000..f06365de90b --- /dev/null +++ b/pkgs/tools/security/spectre-cli/default.nix @@ -0,0 +1,73 @@ +{ lib +, stdenv +, fetchFromGitLab +, cmake +, libsodium +, json_c +, ncurses +, libxml2 +, jq +}: + +stdenv.mkDerivation rec { + pname = "spectre-cli"; + version = "unstable-2022-02-05"; + + src = fetchFromGitLab { + owner = "spectre.app"; + repo = "cli"; + rev = "a5e7aab28f44b90e5bd1204126339a81f64942d2"; + sha256 = "1hp4l1rhg7bzgx0hcai08rvcy6l9645sfngy2cr96l1bpypcld5i"; + fetchSubmodules = true; + }; + + nativeBuildInputs = [ + cmake + libxml2 + jq + ]; + + buildInputs = [ + libsodium + json_c + ncurses + ]; + + cmakeFlags = [ + "-DBUILD_SPECTRE_TESTS=ON" + ]; + + preConfigure = '' + echo "${version}" > VERSION + + # The default buildPhase wants to create a ´build´ dir so we rename the build script to stop conflicts. + mv build build.sh + ''; + + # Some tests are expected to fail on ARM64 + # See: https://gitlab.com/spectre.app/cli/-/issues/27#note_962950844 + doCheck = !(stdenv.isLinux && stdenv.isAarch64); + + checkPhase = '' + mv ../spectre-cli-tests ../spectre_tests.xml ./ + patchShebangs spectre-cli-tests + export HOME=$(mktemp -d) + + ./spectre-tests + ./spectre-cli-tests + ''; + + installPhase = '' + mkdir -p $out/bin + mv spectre $out/bin + ''; + + meta = with lib; { + description = "A stateless cryptographic identity algorithm"; + homepage = "https://spectre.app"; + license = licenses.gpl3Plus; + maintainers = with maintainers; [ emmabastas ]; + mainProgram = "spectre"; + platforms = platforms.all; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 187b6fedb47..3f130a9ff64 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -1179,6 +1179,8 @@ with pkgs; sdlookup = callPackage ../tools/security/sdlookup { }; + spectre-cli = callPackage ../tools/security/spectre-cli { }; + sx-go = callPackage ../tools/security/sx-go { }; systeroid = callPackage ../tools/system/systeroid { };