Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

redis: refactor #346927

Merged
merged 1 commit into from
Mar 19, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 24 additions & 24 deletions pkgs/by-name/re/redis/package.nix
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{
lib,
stdenv,
fetchurl,
fetchFromGitHub,
fetchpatch2,
lua,
jemalloc,
pkg-config,
@@ -10,12 +11,12 @@
which,
ps,
getconf,
withSystemd ? lib.meta.availableOn stdenv.hostPlatform systemd,
systemd,
# dependency ordering is broken at the moment when building with openssl
tlsSupport ? !stdenv.hostPlatform.isStatic,
openssl,
python3,

withSystemd ? lib.meta.availableOn stdenv.hostPlatform systemd,
tlsSupport ? true,
# Using system jemalloc fixes cross-compilation and various setups.
# However the experimental 'active defragmentation' feature of redis requires
# their custom patched version of jemalloc.
@@ -26,30 +27,29 @@ stdenv.mkDerivation (finalAttrs: {
pname = "redis";
version = "7.2.7";

src = fetchurl {
url = "https://download.redis.io/releases/redis-${finalAttrs.version}.tar.gz";
hash = "sha256-csCB47jPrnFEJz0m12c28IMZAAr0bAFRXK1dKXZc6tU=";
src = fetchFromGitHub {
owner = "redis";
repo = "redis";
rev = finalAttrs.version;
hash = "sha256-WZ89BUm3zz6n0dZKyODHCyMGExbqaPJJ1qxLvJKUSDI=";
};

patches = lib.optionals useSystemJemalloc [
# use system jemalloc
(fetchurl {
url = "https://gitlab.archlinux.org/archlinux/packaging/packages/redis/-/raw/102cc861713c796756abd541bf341a4512eb06e6/redis-5.0-use-system-jemalloc.patch";
hash = "sha256-VPRfoSnctkkkzLrXEWQX3Lh5HmZaCXoJafyOG007KzM=";
})
];
patches = lib.optional useSystemJemalloc (fetchpatch2 {
url = "https://gitlab.archlinux.org/archlinux/packaging/packages/redis/-/raw/102cc861713c796756abd541bf341a4512eb06e6/redis-5.0-use-system-jemalloc.patch";
hash = "sha256-A9qp+PWQRuNy/xmv9KLM7/XAyL7Tzkyn0scpVCGngcc=";
});

nativeBuildInputs = [ pkg-config ];
nativeBuildInputs = [
pkg-config
which
python3
];

buildInputs =
[ lua ]
++ lib.optional useSystemJemalloc jemalloc
++ lib.optional withSystemd systemd
++ lib.optionals tlsSupport [ openssl ];

preBuild = lib.optionalString stdenv.hostPlatform.isDarwin ''
substituteInPlace src/Makefile --replace "-flto" ""
'';
++ lib.optional tlsSupport openssl;

# More cross-compiling fixes.
makeFlags =
@@ -101,13 +101,13 @@ stdenv.mkDerivation (finalAttrs: {
passthru.tests.redis = nixosTests.redis;
passthru.serverBin = "redis-server";

meta = with lib; {
meta = {
homepage = "https://redis.io";
description = "Open source, advanced key-value store";
license = licenses.bsd3;
platforms = platforms.all;
license = lib.licenses.bsd3;
platforms = lib.platforms.all;
changelog = "https://github.com/redis/redis/raw/${finalAttrs.version}/00-RELEASENOTES";
maintainers = with maintainers; [
maintainers = with lib.maintainers; [
berdario
globin
];