haredo: wrap program with a shell

The program relies on the presence of a shell, specifically `sh`, on its
PATH[1].

Also set `enableParallelChecking` to true, which can speed up the build
proccess significantly, specially when using emulated native compilation
through `binfmt`.

[1]: 34136cfca3/item/src/haredo.ha (L282)
This commit is contained in:
Gustavo Coutinho de Souza 2024-01-14 22:51:05 -03:00
parent 87b9bf8ea4
commit ea74836d9a
No known key found for this signature in database
GPG key ID: 59081FCB8F9AABB5

View file

@ -4,6 +4,8 @@
, hare
, scdoc
, nix-update-script
, makeWrapper
, bash
}:
stdenv.mkDerivation (finalAttrs: {
pname = "haredo";
@ -20,9 +22,16 @@ stdenv.mkDerivation (finalAttrs: {
nativeBuildInputs = [
hare
makeWrapper
scdoc
];
enableParallelChecking = true;
doCheck = true;
dontConfigure = true;
preBuild = ''
HARECACHE="$(mktemp -d --tmpdir harecache.XXXXXXXX)"
export HARECACHE
@ -40,7 +49,7 @@ stdenv.mkDerivation (finalAttrs: {
checkPhase = ''
runHook preCheck
./bin/haredo test
./bin/haredo ''${enableParallelChecking:+-j$NIX_BUILD_CORES} test
runHook postCheck
'';
@ -53,8 +62,10 @@ stdenv.mkDerivation (finalAttrs: {
runHook postInstall
'';
dontConfigure = true;
doCheck = true;
postFixup = ''
wrapProgram $out/bin/haredo \
--prefix PATH : "${lib.makeBinPath [bash]}"
'';
setupHook = ./setup-hook.sh;