1 { lib, stdenv, fetchFromGitHub, openmp ? null }:
3 stdenv.mkDerivation (finalAttrs: {
7 src = fetchFromGitHub {
10 rev = finalAttrs.version;
11 sha256 = "sha256-6BVl3Rh+CRPQq3QxcUlk5ArvjIj/IcPCA2/Ok0Zu7UI=";
14 # Use the generic C implementation rather than the SSE optimised version on non-x86 platforms
15 postPatch = lib.optionalString (!stdenv.hostPlatform.isx86) ''
16 substituteInPlace makefile \
17 --replace "#FILES=b2sum.c ../ref/" "FILES=b2sum.c ../ref/" \
18 --replace "FILES=b2sum.c ../sse/" "#FILES=b2sum.c ../sse/"
21 sourceRoot = "${finalAttrs.src.name}/b2sum";
23 buildInputs = [ openmp ];
25 buildFlags = [ (lib.optional (openmp == null) "NO_OPENMP=1") ];
27 # clang builds require at least C99 or the build fails with:
28 # error: unknown type name 'inline'
29 env.NIX_CFLAGS_COMPILE = "-std=c99";
31 installFlags = [ "PREFIX=$(out)" ];
34 description = "B2sum utility is similar to the md5sum or shasum utilities but for BLAKE2";
35 mainProgram = "b2sum";
36 homepage = "https://blake2.net";
37 license = with licenses; [ asl20 cc0 openssl ];
38 maintainers = with maintainers; [ kirelagin ];
39 platforms = platforms.unix;