2024-06-05 15:53:02 +00:00
|
|
|
{
|
|
|
|
stdenv,
|
|
|
|
lib,
|
|
|
|
fetchFromSourcehut,
|
|
|
|
hare,
|
|
|
|
scdoc,
|
|
|
|
nix-update-script,
|
|
|
|
makeWrapper,
|
|
|
|
bash,
|
|
|
|
substituteAll,
|
2024-01-02 11:29:13 +00:00
|
|
|
}:
|
2024-06-05 15:53:02 +00:00
|
|
|
let
|
|
|
|
arch = stdenv.hostPlatform.uname.processor;
|
|
|
|
in
|
2024-01-02 11:29:13 +00:00
|
|
|
stdenv.mkDerivation (finalAttrs: {
|
|
|
|
pname = "haredo";
|
|
|
|
version = "1.0.5";
|
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
outputs = [
|
|
|
|
"out"
|
|
|
|
"man"
|
|
|
|
];
|
2024-01-02 11:29:13 +00:00
|
|
|
|
|
|
|
src = fetchFromSourcehut {
|
|
|
|
owner = "~autumnull";
|
|
|
|
repo = "haredo";
|
|
|
|
rev = finalAttrs.version;
|
|
|
|
hash = "sha256-gpui5FVRw3NKyx0AB/4kqdolrl5vkDudPOgjHc/IE4U=";
|
|
|
|
};
|
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
patches = [
|
|
|
|
# Use nix store's bash instead of sh. `@bash@/bin/sh` is used, since haredo expects a posix shell.
|
|
|
|
(substituteAll {
|
|
|
|
src = ./001-use-nix-store-sh.patch;
|
|
|
|
inherit bash;
|
|
|
|
})
|
|
|
|
];
|
|
|
|
|
2024-01-02 11:29:13 +00:00
|
|
|
nativeBuildInputs = [
|
|
|
|
hare
|
2024-01-25 14:12:00 +00:00
|
|
|
makeWrapper
|
2024-01-02 11:29:13 +00:00
|
|
|
scdoc
|
|
|
|
];
|
|
|
|
|
2024-01-25 14:12:00 +00:00
|
|
|
enableParallelChecking = true;
|
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
doCheck = stdenv.buildPlatform.canExecute stdenv.hostPlatform;
|
2024-01-25 14:12:00 +00:00
|
|
|
|
|
|
|
dontConfigure = true;
|
|
|
|
|
2024-01-02 11:29:13 +00:00
|
|
|
preBuild = ''
|
2024-06-05 15:53:02 +00:00
|
|
|
HARECACHE="$(mktemp -d)"
|
2024-01-02 11:29:13 +00:00
|
|
|
export HARECACHE
|
|
|
|
export PREFIX=${builtins.placeholder "out"}
|
|
|
|
'';
|
|
|
|
|
|
|
|
buildPhase = ''
|
|
|
|
runHook preBuild
|
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
hare build -o bin/haredo -qRa${arch} ./src
|
|
|
|
scdoc <doc/haredo.1.scd >doc/haredo.1
|
2024-01-02 11:29:13 +00:00
|
|
|
|
|
|
|
runHook postBuild
|
|
|
|
'';
|
|
|
|
|
|
|
|
checkPhase = ''
|
|
|
|
runHook preCheck
|
|
|
|
|
2024-01-25 14:12:00 +00:00
|
|
|
./bin/haredo ''${enableParallelChecking:+-j$NIX_BUILD_CORES} test
|
2024-01-02 11:29:13 +00:00
|
|
|
|
|
|
|
runHook postCheck
|
|
|
|
'';
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
runHook preInstall
|
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
mkdir -p $out/bin
|
|
|
|
mkdir -p $out/share/man/man1
|
|
|
|
cp ./bin/haredo $out/bin
|
|
|
|
cp ./doc/haredo.1 $out/share/man/man1
|
2024-01-02 11:29:13 +00:00
|
|
|
|
|
|
|
runHook postInstall
|
|
|
|
'';
|
|
|
|
|
|
|
|
setupHook = ./setup-hook.sh;
|
|
|
|
|
|
|
|
passthru.updateScript = nix-update-script { };
|
|
|
|
|
|
|
|
meta = {
|
|
|
|
description = "A simple and unix-idiomatic build automator";
|
|
|
|
homepage = "https://sr.ht/~autumnull/haredo/";
|
|
|
|
license = lib.licenses.wtfpl;
|
|
|
|
maintainers = with lib.maintainers; [ onemoresuza ];
|
|
|
|
mainProgram = "haredo";
|
|
|
|
inherit (hare.meta) platforms badPlatforms;
|
|
|
|
};
|
|
|
|
})
|