about summary refs log tree commit diff
path: root/pkgs/development/tools/analysis
diff options
context:
space:
mode:
authorKira Bruneau <kira.bruneau@pm.me>2023-04-26 12:16:04 -0400
committerKira Bruneau <kira.bruneau@pm.me>2023-04-26 12:44:34 -0400
commite8e53c5c8c8d344899a40bbde09dbb31836c4938 (patch)
tree841c0e9aca697a742a06900d82accdec1551e5c2 /pkgs/development/tools/analysis
parent79ff5b7f95104761bb3cae4411700028c38ef6dd (diff)
rr: encode gdb dep with wrapProgram instead of propagatedBuildInputs
Except in special wrapper environments like `python3.withPackages`,
where all "build" dependencies are also runtime dependencies,
`propagatedBuildInputs` doesn't actually encode runtime dependencies.

It's meant to propagate build dependencies to dependants, so the
dependants don't have to explicitly add them to their `buildInputs`.

With `wrapProgram`, you can now run rr without having gdb
installed (eg. `nix run nixpkgs#rr replay`).
Diffstat (limited to 'pkgs/development/tools/analysis')
-rw-r--r--pkgs/development/tools/analysis/rr/default.nix15
1 files changed, 12 insertions, 3 deletions
diff --git a/pkgs/development/tools/analysis/rr/default.nix b/pkgs/development/tools/analysis/rr/default.nix
index da180f0d4b7aa..94e1d704b275b 100644
--- a/pkgs/development/tools/analysis/rr/default.nix
+++ b/pkgs/development/tools/analysis/rr/default.nix
@@ -1,5 +1,6 @@
 { lib, stdenv, fetchFromGitHub, fetchpatch
-, cmake, libpfm, zlib, pkg-config, python3Packages, which, procps, gdb, capnproto
+, cmake, pkg-config, which, makeWrapper
+, libpfm, zlib, python3Packages, procps, gdb, capnproto
 }:
 
 stdenv.mkDerivation rec {
@@ -38,11 +39,11 @@ stdenv.mkDerivation rec {
   # See also https://github.com/NixOS/nixpkgs/pull/110846
   preConfigure = ''substituteInPlace CMakeLists.txt --replace "-flto" ""'';
 
-  nativeBuildInputs = [ cmake pkg-config which ];
+  nativeBuildInputs = [ cmake pkg-config which makeWrapper ];
   buildInputs = [
     libpfm zlib python3Packages.python python3Packages.pexpect procps gdb capnproto
+    libpfm zlib python3Packages.python python3Packages.pexpect procps capnproto
   ];
-  propagatedBuildInputs = [ gdb ]; # needs GDB to replay programs at runtime
   cmakeFlags = [
     "-Ddisable32bit=ON"
   ];
@@ -57,6 +58,14 @@ stdenv.mkDerivation rec {
 
   preCheck = "export HOME=$TMPDIR";
 
+  # needs GDB to replay programs at runtime
+  preFixup = ''
+    wrapProgram "$out/bin/rr" \
+      --prefix PATH ":" "${lib.makeBinPath [
+        gdb
+      ]}";
+  '';
+
   meta = {
     homepage = "https://rr-project.org/";
     description = "Records nondeterministic executions and debugs them deterministically";