mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-02-19 02:24:30 +00:00

In preparation for the deprecation of `stdenv.isX`. These shorthands are not conducive to cross-compilation because they hide the platforms. Darwin might get cross-compilation for which the continued usage of `stdenv.isDarwin` will get in the way One example of why this is bad and especially affects compiler packages https://www.github.com/NixOS/nixpkgs/pull/343059 There are too many files to go through manually but a treewide should get users thinking when they see a `hostPlatform.isX` in a place where it doesn't make sense. ``` fd --type f "\.nix" | xargs sd --fixed-strings "stdenv.is" "stdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "stdenv'.is" "stdenv'.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "clangStdenv.is" "clangStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "gccStdenv.is" "gccStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "stdenvNoCC.is" "stdenvNoCC.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "inherit (stdenv) is" "inherit (stdenv.hostPlatform) is" fd --type f "\.nix" | xargs sd --fixed-strings "buildStdenv.is" "buildStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "effectiveStdenv.is" "effectiveStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "originalStdenv.is" "originalStdenv.hostPlatform.is" ```
74 lines
1.5 KiB
Nix
74 lines
1.5 KiB
Nix
{ 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.hostPlatform.isLinux && stdenv.hostPlatform.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 = "Stateless cryptographic identity algorithm";
|
||
homepage = "https://spectre.app";
|
||
license = licenses.gpl3Plus;
|
||
maintainers = with maintainers; [ emmabastas ];
|
||
mainProgram = "spectre";
|
||
platforms = platforms.all;
|
||
};
|
||
}
|