nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 fetchpatch,
6 bash,
7 capnproto,
8 cmake,
9 gdb,
10 libpfm,
11 makeWrapper,
12 nix-update-script,
13 pkg-config,
14 procps,
15 python3,
16 which,
17 zlib,
18 zstd,
19}:
20
21stdenv.mkDerivation (finalAttrs: {
22 version = "5.9.0";
23 pname = "rr";
24
25 src = fetchFromGitHub {
26 owner = "rr-debugger";
27 repo = "rr";
28 rev = finalAttrs.version;
29 hash = "sha256-o+HXrgGXdsvjlNh70qsXRtp2yXOiZIT30ejfs1KEaqE=";
30 };
31
32 patches = [
33 # fix build w/ glibc-2.42
34 (fetchpatch {
35 url = "https://github.com/rr-debugger/rr/commit/6251648873b9e1ed23536beebbaa5d6fead3d5be.patch";
36 hash = "sha256-k+jeGUJyybYq3GF2zIhpDF8NT66Buq6nztUbh28qVD8=";
37 })
38 ];
39
40 postPatch = ''
41 substituteInPlace src/Command.cc --replace '_BSD_SOURCE' '_DEFAULT_SOURCE'
42 patchShebangs src
43 '';
44
45 # With LTO enabled, linking fails with the following message:
46 #
47 # src/AddressSpace.cc:1666: undefined reference to `rr_syscall_addr'
48 # ld.bfd: bin/rr: hidden symbol `rr_syscall_addr' isn't defined
49 # ld.bfd: final link failed: bad value
50 # collect2: error: ld returned 1 exit status
51 #
52 # See also https://github.com/NixOS/nixpkgs/pull/110846
53 preConfigure = ''
54 substituteInPlace CMakeLists.txt --replace "-flto" ""
55 '';
56
57 strictDeps = true;
58
59 nativeBuildInputs = [
60 capnproto
61 cmake
62 makeWrapper
63 pkg-config
64 python3.pythonOnBuildForHost
65 which
66 ];
67
68 buildInputs = [
69 bash
70 capnproto
71 gdb
72 libpfm
73 procps
74 python3
75 zlib
76 zstd
77 ];
78
79 cmakeFlags = [
80 (lib.cmakeBool "disable32bit" true)
81 (lib.cmakeBool "BUILD_TESTS" finalAttrs.finalPackage.doCheck)
82 ];
83
84 # we turn on additional warnings due to hardening
85 env.NIX_CFLAGS_COMPILE = "-Wno-error";
86
87 hardeningDisable = [ "fortify" ];
88
89 # FIXME
90 doCheck = false;
91
92 preCheck = "export HOME=$TMPDIR";
93
94 # needs GDB to replay programs at runtime
95 preFixup = ''
96 wrapProgram "$out/bin/rr" \
97 --prefix PATH ":" "${lib.makeBinPath [ gdb ]}";
98 '';
99
100 passthru.updateScript = nix-update-script { };
101
102 meta = {
103 homepage = "https://rr-project.org/";
104 description = "Records nondeterministic executions and debugs them deterministically";
105 longDescription = ''
106 rr aspires to be your primary debugging tool, replacing -- well,
107 enhancing -- gdb. You record a failure once, then debug the
108 recording, deterministically, as many times as you want. Every
109 time the same execution is replayed.
110 '';
111
112 license = with lib.licenses; [
113 mit
114 bsd2
115 ];
116 maintainers = with lib.maintainers; [
117 pierron
118 thoughtpolice
119 lf-
120 ];
121 platforms = [
122 "aarch64-linux"
123 "i686-linux"
124 "x86_64-linux"
125 ];
126 };
127})