summary refs log tree commit diff
path: root/pkgs/development/tools/misc/arcanist/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/tools/misc/arcanist/default.nix')
-rw-r--r--pkgs/development/tools/misc/arcanist/default.nix73
1 files changed, 37 insertions, 36 deletions
diff --git a/pkgs/development/tools/misc/arcanist/default.nix b/pkgs/development/tools/misc/arcanist/default.nix
index a6265ba89d0..fcddf1d0cac 100644
--- a/pkgs/development/tools/misc/arcanist/default.nix
+++ b/pkgs/development/tools/misc/arcanist/default.nix
@@ -1,53 +1,54 @@
-{ stdenv, fetchFromGitHub, php, flex, makeWrapper }:
+{ stdenv, fetchFromGitHub, php, flex }:
+
+# Make a custom wrapper. If `wrapProgram` is used, arcanist thinks .arc-wrapped is being
+# invoked and complains about it being an unknown toolset. We could use `makeWrapper`, but
+# then we’d need to still craft a script that does the `php libexec/arcanist/bin/...` dance
+# anyway... So just do everything at once.
+let makeArcWrapper = toolset: ''
+    cat << WRAPPER > $out/bin/${toolset}
+    #!$shell -e
+    export PATH='${php}/bin/'\''${PATH:+':'}\$PATH
+    exec ${php}/bin/php $out/libexec/arcanist/bin/${toolset} "\$@"
+    WRAPPER
+    chmod +x $out/bin/${toolset}
+'';
 
-let
-  libphutil = fetchFromGitHub {
-    owner = "phacility";
-    repo = "libphutil";
-    rev = "cc2a3dbf590389400da55563cb6993f321ec6d73";
-    sha256 = "1k7sr3racwz845i7r5kdwvgqrz8gldz07pxj3yw77s58rqbix3ad";
-  };
-  arcanist = fetchFromGitHub {
-    owner = "phacility";
-    repo = "arcanist";
-    rev = "21a1828ea06cf031e93082db8664d73efc88290a";
-    sha256 = "05rq9l9z7446ks270viay57r5ibx702b5bnlf4ck529zc4abympx";
-  };
 in
+
 stdenv.mkDerivation {
   pname = "arcanist";
-  version = "20200127";
-
-  src = [ arcanist libphutil ];
-  buildInputs = [ php makeWrapper flex ];
+  version = "20200711";
 
-  unpackPhase = ''
-    cp -aR ${libphutil} libphutil
-    cp -aR ${arcanist} arcanist
-    chmod +w -R libphutil arcanist
-  '';
+  src = fetchFromGitHub {
+    owner = "phacility";
+    repo = "arcanist";
+    rev = "2565cc7b4d1dbce6bc7a5b3c4e72ae94be4712fe";
+    sha256 = "0jiv4aj4m5750dqw9r8hizjkwiyxk4cg4grkr63sllsa2dpiibxw";
+  };
+  buildInputs = [ php flex ];
 
   postPatch = stdenv.lib.optionalString stdenv.isAarch64 ''
-    substituteInPlace libphutil/support/xhpast/Makefile \
+    substituteInPlace support/xhpast/Makefile \
       --replace "-minline-all-stringops" ""
   '';
 
   buildPhase = ''
-    (
-      cd libphutil/support/xhpast
-      make clean all install
-    )
+    make xhpast -C support/xhpast
   '';
+
   installPhase = ''
     mkdir -p $out/bin $out/libexec
-    cp -R libphutil $out/libexec/libphutil
-    cp -R arcanist  $out/libexec/arcanist
-    ${if stdenv.isDarwin then ''
-        echo "#! $shell -e" > $out/bin/arc
-        echo "exec ${php}/bin/php $out/libexec/arcanist/scripts/arcanist.php "'"$@"' >> $out/bin/arc
-        chmod +x $out/bin/arc''
-      else ''
-        ln -s $out/libexec/arcanist/scripts/arcanist.php $out/bin/arc''}
+    make install -C support/xhpast
+    cp -R $src $out/libexec/arcanist
+
+    ${makeArcWrapper "arc"}
+    ${makeArcWrapper "phage"}
+  '';
+
+  doInstallCheck = true;
+  installCheckPhase = ''
+    $out/bin/arc help diff -- > /dev/null
+    $out/bin/phage help alias -- > /dev/null
   '';
 
   meta = {