btrbk: add mainProgram
[NixPkgs.git] / pkgs / by-name / sp / spectre-cli / package.nix
blobba63b823e73993848927f4bb81c37879b841b71a
1 { lib
2 , stdenv
3 , fetchFromGitLab
4 , cmake
5 , libsodium
6 , json_c
7 , ncurses
8 , libxml2
9 , jq
12 stdenv.mkDerivation rec {
13   pname = "spectre-cli";
14   version = "unstable-2022-02-05";
16   src = fetchFromGitLab {
17     owner = "spectre.app";
18     repo = "cli";
19     rev = "a5e7aab28f44b90e5bd1204126339a81f64942d2";
20     sha256 = "1hp4l1rhg7bzgx0hcai08rvcy6l9645sfngy2cr96l1bpypcld5i";
21     fetchSubmodules = true;
22   };
24   nativeBuildInputs = [
25     cmake
26     libxml2
27     jq
28   ];
30   buildInputs = [
31     libsodium
32     json_c
33     ncurses
34   ];
36   cmakeFlags = [
37     "-DBUILD_SPECTRE_TESTS=ON"
38   ];
40   preConfigure = ''
41    echo "${version}" > VERSION
43     # The default buildPhase wants to create a ´build´ dir so we rename the build script to stop conflicts.
44     mv build build.sh
45   '';
47   # Some tests are expected to fail on ARM64
48   # See: https://gitlab.com/spectre.app/cli/-/issues/27#note_962950844
49   doCheck = !(stdenv.hostPlatform.isLinux && stdenv.hostPlatform.isAarch64);
51   checkPhase = ''
52     mv ../spectre-cli-tests ../spectre_tests.xml ./
53     patchShebangs spectre-cli-tests
54     export HOME=$(mktemp -d)
56     ./spectre-tests
57     ./spectre-cli-tests
58   '';
60   installPhase = ''
61     mkdir -p $out/bin
62     mv spectre $out/bin
63   '';
65   meta = with lib; {
66     description = "Stateless cryptographic identity algorithm";
67     homepage = "https://spectre.app";
68     license = licenses.gpl3Plus;
69     maintainers = with maintainers; [ emmabastas ];
70     mainProgram = "spectre";
71     platforms = platforms.all;
72   };