2021-04-18 15:40:25 +02:00
|
|
|
{ lib, stdenv, fetchurl, lua, pkg-config, nixosTests
|
2023-01-01 12:00:51 +01:00
|
|
|
, tcl, which, ps, getconf
|
2021-11-04 09:41:13 +01:00
|
|
|
, withSystemd ? stdenv.isLinux && !stdenv.hostPlatform.isStatic, systemd
|
2021-09-22 17:37:09 +02:00
|
|
|
# dependency ordering is broken at the moment when building with openssl
|
|
|
|
, tlsSupport ? !stdenv.hostPlatform.isStatic, openssl
|
2020-12-29 04:01:42 +01:00
|
|
|
}:
|
2012-02-03 14:12:07 +01:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
2019-08-15 14:41:18 +02:00
|
|
|
pname = "redis";
|
2023-01-01 12:00:51 +01:00
|
|
|
version = "7.0.7";
|
2012-02-03 14:12:07 +01:00
|
|
|
|
|
|
|
src = fetchurl {
|
2021-02-23 05:20:00 +01:00
|
|
|
url = "https://download.redis.io/releases/${pname}-${version}.tar.gz";
|
2023-01-01 12:00:51 +01:00
|
|
|
hash = "sha256-jTJ9foh9G7MI/Deq9xegv3n1gSnjc5Bpqu6uiJVaxYY=";
|
2012-02-03 14:12:07 +01:00
|
|
|
};
|
|
|
|
|
2021-01-19 07:50:56 +01:00
|
|
|
nativeBuildInputs = [ pkg-config ];
|
2021-01-04 03:10:23 +01:00
|
|
|
|
|
|
|
buildInputs = [ lua ]
|
2021-04-18 15:40:25 +02:00
|
|
|
++ lib.optional withSystemd systemd
|
2021-01-15 08:07:56 +01:00
|
|
|
++ lib.optionals tlsSupport [ openssl ];
|
2019-08-29 16:12:06 +02:00
|
|
|
# More cross-compiling fixes.
|
|
|
|
# Note: this enables libc malloc as a temporary fix for cross-compiling.
|
|
|
|
# Due to hardcoded configure flags in jemalloc, we can't cross-compile vendored jemalloc properly, and so we're forced to use libc allocator.
|
|
|
|
# It's weird that the build isn't failing because of failure to compile dependencies, it's from failure to link them!
|
2022-09-22 19:00:54 +02:00
|
|
|
makeFlags = [ "PREFIX=${placeholder "out"}" ]
|
2021-01-15 08:07:56 +01:00
|
|
|
++ lib.optionals (stdenv.buildPlatform != stdenv.hostPlatform) [ "AR=${stdenv.cc.targetPrefix}ar" "RANLIB=${stdenv.cc.targetPrefix}ranlib" "MALLOC=libc" ]
|
2022-10-06 18:38:53 +02:00
|
|
|
++ lib.optionals withSystemd [ "USE_SYSTEMD=yes" ]
|
2021-01-15 08:07:56 +01:00
|
|
|
++ lib.optionals tlsSupport [ "BUILD_TLS=yes" ];
|
2012-02-03 14:12:07 +01:00
|
|
|
|
2013-01-22 00:27:34 +01:00
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
2021-05-23 20:36:52 +02:00
|
|
|
hardeningEnable = [ "pie" ];
|
|
|
|
|
2021-02-23 05:20:00 +01:00
|
|
|
NIX_CFLAGS_COMPILE = lib.optionals stdenv.cc.isClang [ "-std=c11" ];
|
|
|
|
|
2022-03-12 18:04:31 +01:00
|
|
|
# darwin currently lacks a pure `pgrep` which is extensively used here
|
|
|
|
doCheck = !stdenv.isDarwin;
|
2022-11-30 23:18:15 +01:00
|
|
|
checkInputs = [ which tcl ps ] ++ lib.optionals stdenv.hostPlatform.isStatic [ getconf ];
|
2022-03-12 18:04:31 +01:00
|
|
|
checkPhase = ''
|
|
|
|
runHook preCheck
|
|
|
|
|
|
|
|
# disable test "Connect multiple replicas at the same time": even
|
|
|
|
# upstream find this test too timing-sensitive
|
|
|
|
substituteInPlace tests/integration/replication.tcl \
|
|
|
|
--replace 'foreach mdl {no yes}' 'foreach mdl {}'
|
|
|
|
|
2022-04-30 06:20:00 +02:00
|
|
|
substituteInPlace tests/support/server.tcl \
|
|
|
|
--replace 'exec /usr/bin/env' 'exec env'
|
|
|
|
|
|
|
|
sed -i '/^proc wait_load_handlers_disconnected/{n ; s/wait_for_condition 50 100/wait_for_condition 50 500/; }' \
|
|
|
|
tests/support/util.tcl
|
|
|
|
|
2022-03-12 18:04:31 +01:00
|
|
|
./runtest \
|
|
|
|
--no-latency \
|
|
|
|
--timeout 2000 \
|
|
|
|
--clients $NIX_BUILD_CORES \
|
|
|
|
--tags -leaks \
|
|
|
|
--skipunit integration/failover # flaky and slow
|
|
|
|
|
|
|
|
runHook postCheck
|
|
|
|
'';
|
2018-08-08 23:30:19 +02:00
|
|
|
|
2019-11-29 13:25:42 +01:00
|
|
|
passthru.tests.redis = nixosTests.redis;
|
|
|
|
|
2021-01-11 08:54:33 +01:00
|
|
|
meta = with lib; {
|
2020-03-16 08:36:57 +01:00
|
|
|
homepage = "https://redis.io";
|
2012-02-03 14:12:07 +01:00
|
|
|
description = "An open source, advanced key-value store";
|
2018-10-21 16:51:26 +02:00
|
|
|
license = licenses.bsd3;
|
2021-02-23 05:20:00 +01:00
|
|
|
platforms = platforms.all;
|
|
|
|
changelog = "https://github.com/redis/redis/raw/${version}/00-RELEASENOTES";
|
2021-02-23 05:20:00 +01:00
|
|
|
maintainers = with maintainers; [ berdario globin marsam ];
|
2021-09-28 23:35:37 +02:00
|
|
|
mainProgram = "redis-cli";
|
2012-02-03 14:12:07 +01:00
|
|
|
};
|
|
|
|
}
|