12 # Make a custom wrapper. If `wrapProgram` is used, arcanist thinks .arc-wrapped is being
13 # invoked and complains about it being an unknown toolset. We could use `makeWrapper`, but
14 # then we’d need to still craft a script that does the `php libexec/arcanist/bin/...` dance
15 # anyway... So just do everything at once.
16 let makeArcWrapper = toolset: ''
17 cat << WRAPPER > $out/bin/${toolset}
19 export PATH='${php}/bin:${which}/bin'\''${PATH:+':'}\$PATH
20 exec ${php}/bin/php $out/libexec/arcanist/bin/${toolset} "\$@"
22 chmod +x $out/bin/${toolset}
30 src = fetchFromGitHub {
33 rev = "e50d1bc4eabac9c37e3220e9f3fb8e37ae20b957";
34 hash = "sha256-u+HRsaCuAAyLrEihrZtLrdZ6NTVjPshieJATK3t5Fo4=";
38 ./dont-require-python3-in-path.patch
39 ./shellcomplete-strlen-null.patch
42 buildInputs = [ php python3 ];
44 nativeBuildInputs = [ bison flex installShellFiles ];
46 postPatch = lib.optionalString stdenv.isAarch64 ''
47 substituteInPlace support/xhpast/Makefile \
48 --replace "-minline-all-stringops" ""
53 make cleanall -C support/xhpast $makeFlags "''${makeFlagsArray[@]}" -j $NIX_BUILD_CORES
54 make xhpast -C support/xhpast $makeFlags "''${makeFlagsArray[@]}" -j $NIX_BUILD_CORES
60 mkdir -p $out/bin $out/libexec
61 make install -C support/xhpast $makeFlags "''${makeFlagsArray[@]}" -j $NIX_BUILD_CORES
62 make cleanall -C support/xhpast $makeFlags "''${makeFlagsArray[@]}" -j $NIX_BUILD_CORES
63 cp -R . $out/libexec/arcanist
64 ln -sf ${cacert}/etc/ssl/certs/ca-bundle.crt $out/libexec/arcanist/resources/ssl/default.pem
66 ${makeArcWrapper "arc"}
67 ${makeArcWrapper "phage"}
69 $out/bin/arc shell-complete --generate --
70 installShellCompletion --cmd arc --bash $out/libexec/arcanist/support/shell/rules/bash-rules.sh
71 installShellCompletion --cmd phage --bash $out/libexec/arcanist/support/shell/rules/bash-rules.sh
75 doInstallCheck = true;
76 installCheckPhase = ''
77 $out/bin/arc help diff -- > /dev/null
78 $out/bin/phage help alias -- > /dev/null
82 description = "Command line interface to Phabricator";
83 homepage = "https://www.phacility.com/";
84 license = lib.licenses.asl20;
85 platforms = lib.platforms.unix;
86 maintainers = [ lib.maintainers.thoughtpolice ];