about summary refs log tree commit diff
diff options
context:
space:
mode:
authorGuillaume Chérel <guillaume.cherel@iscpif.fr>2020-08-07 19:12:22 +0200
committergithub-actions[bot] <github-actions[bot]@users.noreply.github.com>2021-05-31 01:01:48 +0000
commit7f016e24c7e91091acdaa6a1bacf44aa8f50bab4 (patch)
tree8ab342da2c4234d972a67ac4c4063190f85982ec
parentfc924fc34e5daf7f5b00800bd2728867fe8be06c (diff)
Wrap mcom to add dependencies to PATH.
(cherry picked from commit 6dde14306092e81b58fc9b2b9082d138ab311cd8)
-rw-r--r--pkgs/applications/networking/mailreaders/mblaze/default.nix25
1 files changed, 23 insertions, 2 deletions
diff --git a/pkgs/applications/networking/mailreaders/mblaze/default.nix b/pkgs/applications/networking/mailreaders/mblaze/default.nix
index 278561e0e5f44..3cc9b12c99506 100644
--- a/pkgs/applications/networking/mailreaders/mblaze/default.nix
+++ b/pkgs/applications/networking/mailreaders/mblaze/default.nix
@@ -1,10 +1,12 @@
-{ stdenv, lib, fetchFromGitHub, installShellFiles, libiconv, ruby ? null }:
+{ coreutils, fetchFromGitHub, fetchpatch, file, gawk, gnugrep, gnused
+, installShellFiles, less, lib, libiconv, makeWrapper, nano, stdenv, ruby ? null
+}:
 
 stdenv.mkDerivation rec {
   pname = "mblaze";
   version = "1.1";
 
-  nativeBuildInputs = [ installShellFiles ];
+  nativeBuildInputs = [ installShellFiles makeWrapper ];
   buildInputs = [ ruby ] ++ lib.optionals stdenv.isDarwin [ libiconv ];
 
   src = fetchFromGitHub {
@@ -22,6 +24,25 @@ stdenv.mkDerivation rec {
     installShellCompletion contrib/_mblaze
   '' + lib.optionalString (ruby != null) ''
     install -Dt $out/bin contrib/msuck contrib/mblow
+
+    # The following wrappings are used to preserve the executable
+    # names (the value of $0 in a script). The script mcom is
+    # designed to be run directly or via symlinks such as mrep. Using
+    # symlinks changes the value of $0 in the script, and makes it
+    # behave differently. When using the wrapProgram tool, the resulting
+    # wrapper breaks this behaviour. The following wrappers preserve it.
+
+    mkdir -p $out/wrapped
+    for x in mcom mbnc mfwd mrep
+    do
+      mv $out/bin/$x $out/wrapped
+      makeWrapper $out/wrapped/$x $out/bin/$x \
+        --argv0 $out/bin/$x \
+        --prefix PATH : $out/bin \
+        --prefix PATH : ${lib.makeBinPath [
+          coreutils file gawk gnugrep gnused
+        ]}
+    done
   '';
 
   meta = with lib; {