1
- { lib , stdenv , fetchurl , fetchpatch , lua , jemalloc , pkg-config , nixosTests
2
- , tcl , which , ps , getconf
3
- , withSystemd ? lib . meta . availableOn stdenv . hostPlatform systemd , systemd
4
- # dependency ordering is broken at the moment when building with openssl
5
- , tlsSupport ? ! stdenv . hostPlatform . isStatic , openssl
6
-
7
- # Using system jemalloc fixes cross-compilation and various setups.
8
- # However the experimental 'active defragmentation' feature of redis requires
9
- # their custom patched version of jemalloc.
10
- , useSystemJemalloc ? true
1
+ {
2
+ lib ,
3
+ stdenv ,
4
+ fetchFromGitHub ,
5
+ fetchpatch2 ,
6
+ lua ,
7
+ jemalloc ,
8
+ pkg-config ,
9
+ nixosTests ,
10
+ tcl ,
11
+ which ,
12
+ ps ,
13
+ getconf ,
14
+ systemd ,
15
+ openssl ,
16
+ python3 ,
17
+
18
+ withSystemd ? lib . meta . availableOn stdenv . hostPlatform systemd ,
19
+ tlsSupport ? true ,
20
+ # Using system jemalloc fixes cross-compilation and various setups.
21
+ # However the experimental 'active defragmentation' feature of redis requires
22
+ # their custom patched version of jemalloc.
23
+ useSystemJemalloc ? true ,
11
24
} :
12
25
13
26
stdenv . mkDerivation ( finalAttrs : {
14
27
pname = "redis" ;
15
28
version = "7.2.5" ;
16
29
17
- src = fetchurl {
18
- url = "https://download.redis.io/releases/redis-${ finalAttrs . version } .tar.gz" ;
19
- hash = "sha256-WYEXlwb4OR8DvpHZUayvrtqRr3+sVr7/snAZYxA+Qj0=" ;
30
+ src = fetchFromGitHub {
31
+ owner = "redis" ;
32
+ repo = "redis" ;
33
+ rev = finalAttrs . version ;
34
+ hash = "sha256-CHtCtyy/dzyXwwLKVqOCV9SPTybYGbSTWHTaiPGAVIQ=" ;
20
35
} ;
21
36
22
- patches = [
23
- # fixes: make test [exception]: Executing test client: permission denied
24
- # https://github.com/redis/redis/issues/12792
25
- ( fetchpatch {
26
- url = "https://github.com/redis/redis/pull/12887.diff" ;
27
- hash = "sha256-VZEMShW7Ckn5hLJHffQvE94Uly41WZW1bwvxny+Y3W8= " ;
28
- } )
29
- ] ++ lib . optionals useSystemJemalloc [
30
- # use system jemalloc
31
- ( fetchurl {
37
+ patches =
38
+ [
39
+ # fixes: make test [exception]: Executing test client: permission denied
40
+ # https://github.com/redis/redis/issues/12792
41
+ ( fetchpatch2 {
42
+ url = "https://github.com/redis/redis/pull/12887.diff " ;
43
+ hash = "sha256-cv+EcVTz8j93E4ON0NpxwQiEPmt6/cWrmAsonvvYVfQ=" ;
44
+ } )
45
+ ]
46
+ ++ lib . optional useSystemJemalloc ( fetchpatch2 {
32
47
url = "https://gitlab.archlinux.org/archlinux/packaging/packages/redis/-/raw/102cc861713c796756abd541bf341a4512eb06e6/redis-5.0-use-system-jemalloc.patch" ;
33
- hash = "sha256-VPRfoSnctkkkzLrXEWQX3Lh5HmZaCXoJafyOG007KzM=" ;
34
- } )
35
- ] ;
48
+ hash = "sha256-A9qp+PWQRuNy/xmv9KLM7/XAyL7Tzkyn0scpVCGngcc=" ;
49
+ } ) ;
36
50
37
- nativeBuildInputs = [ pkg-config ] ;
51
+ nativeBuildInputs = [
52
+ pkg-config
53
+ which
54
+ python3
55
+ ] ;
38
56
39
- buildInputs = [ lua ]
57
+ buildInputs =
58
+ [ lua ]
40
59
++ lib . optional useSystemJemalloc jemalloc
41
60
++ lib . optional withSystemd systemd
42
- ++ lib . optionals tlsSupport [ openssl ] ;
43
-
44
- preBuild = lib . optionalString stdenv . hostPlatform . isDarwin ''
45
- substituteInPlace src/Makefile --replace "-flto" ""
46
- '' ;
61
+ ++ lib . optional tlsSupport openssl ;
47
62
48
63
# More cross-compiling fixes.
49
- makeFlags = [ "PREFIX=${ placeholder "out" } " ]
50
- ++ lib . optionals ( stdenv . buildPlatform != stdenv . hostPlatform ) [ "AR=${ stdenv . cc . targetPrefix } ar" "RANLIB=${ stdenv . cc . targetPrefix } ranlib" ]
64
+ makeFlags =
65
+ [ "PREFIX=${ placeholder "out" } " ]
66
+ ++ lib . optionals ( stdenv . buildPlatform != stdenv . hostPlatform ) [
67
+ "AR=${ stdenv . cc . targetPrefix } ar"
68
+ "RANLIB=${ stdenv . cc . targetPrefix } ranlib"
69
+ ]
51
70
++ lib . optionals withSystemd [ "USE_SYSTEMD=yes" ]
52
71
++ lib . optionals tlsSupport [ "BUILD_TLS=yes" ] ;
53
72
@@ -59,7 +78,11 @@ stdenv.mkDerivation (finalAttrs: {
59
78
60
79
# darwin currently lacks a pure `pgrep` which is extensively used here
61
80
doCheck = ! stdenv . hostPlatform . isDarwin ;
62
- nativeCheckInputs = [ which tcl ps ] ++ lib . optionals stdenv . hostPlatform . isStatic [ getconf ] ;
81
+ nativeCheckInputs = [
82
+ which
83
+ tcl
84
+ ps
85
+ ] ++ lib . optionals stdenv . hostPlatform . isStatic [ getconf ] ;
63
86
checkPhase = ''
64
87
runHook preCheck
65
88
@@ -87,13 +110,16 @@ stdenv.mkDerivation (finalAttrs: {
87
110
passthru . tests . redis = nixosTests . redis ;
88
111
passthru . serverBin = "redis-server" ;
89
112
90
- meta = with lib ; {
113
+ meta = {
91
114
homepage = "https://redis.io" ;
92
115
description = "Open source, advanced key-value store" ;
93
- license = licenses . bsd3 ;
94
- platforms = platforms . all ;
116
+ license = lib . licenses . bsd3 ;
117
+ platforms = lib . platforms . all ;
95
118
changelog = "https://github.com/redis/redis/raw/${ finalAttrs . version } /00-RELEASENOTES" ;
96
- maintainers = with maintainers ; [ berdario globin ] ;
119
+ maintainers = with lib . maintainers ; [
120
+ berdario
121
+ globin
122
+ ] ;
97
123
mainProgram = "redis-cli" ;
98
124
} ;
99
125
} )
0 commit comments