about summary refs log tree commit diff
path: root/pkgs/by-name/ha/haredo/package.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/by-name/ha/haredo/package.nix')
-rw-r--r--pkgs/by-name/ha/haredo/package.nix51
1 files changed, 33 insertions, 18 deletions
diff --git a/pkgs/by-name/ha/haredo/package.nix b/pkgs/by-name/ha/haredo/package.nix
index e31ae96c7832d..e722d11eafd55 100644
--- a/pkgs/by-name/ha/haredo/package.nix
+++ b/pkgs/by-name/ha/haredo/package.nix
@@ -1,17 +1,25 @@
-{ stdenv
-, lib
-, fetchFromSourcehut
-, hare
-, scdoc
-, nix-update-script
-, makeWrapper
-, bash
+{
+  stdenv,
+  lib,
+  fetchFromSourcehut,
+  hare,
+  scdoc,
+  nix-update-script,
+  makeWrapper,
+  bash,
+  substituteAll,
 }:
+let
+  arch = stdenv.hostPlatform.uname.processor;
+in
 stdenv.mkDerivation (finalAttrs: {
   pname = "haredo";
   version = "1.0.5";
 
-  outputs = [ "out" "man" ];
+  outputs = [
+    "out"
+    "man"
+  ];
 
   src = fetchFromSourcehut {
     owner = "~autumnull";
@@ -20,6 +28,14 @@ stdenv.mkDerivation (finalAttrs: {
     hash = "sha256-gpui5FVRw3NKyx0AB/4kqdolrl5vkDudPOgjHc/IE4U=";
   };
 
+  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;
+    })
+  ];
+
   nativeBuildInputs = [
     hare
     makeWrapper
@@ -28,12 +44,12 @@ stdenv.mkDerivation (finalAttrs: {
 
   enableParallelChecking = true;
 
-  doCheck = true;
+  doCheck = stdenv.buildPlatform.canExecute stdenv.hostPlatform;
 
   dontConfigure = true;
 
   preBuild = ''
-    HARECACHE="$(mktemp -d --tmpdir harecache.XXXXXXXX)"
+    HARECACHE="$(mktemp -d)"
     export HARECACHE
     export PREFIX=${builtins.placeholder "out"}
   '';
@@ -41,7 +57,8 @@ stdenv.mkDerivation (finalAttrs: {
   buildPhase = ''
     runHook preBuild
 
-    ./bootstrap.sh
+    hare build -o bin/haredo -qRa${arch} ./src
+    scdoc <doc/haredo.1.scd >doc/haredo.1
 
     runHook postBuild
   '';
@@ -57,16 +74,14 @@ stdenv.mkDerivation (finalAttrs: {
   installPhase = ''
     runHook preInstall
 
-    ./bootstrap.sh install
+    mkdir -p $out/bin
+    mkdir -p $out/share/man/man1
+    cp ./bin/haredo $out/bin
+    cp ./doc/haredo.1 $out/share/man/man1
 
     runHook postInstall
   '';
 
-  postFixup = ''
-    wrapProgram $out/bin/haredo \
-      --prefix PATH : "${lib.makeBinPath [bash]}"
-  '';
-
   setupHook = ./setup-hook.sh;
 
   passthru.updateScript = nix-update-script { };