diff options
Diffstat (limited to 'pkgs/by-name/ha/haredo')
-rw-r--r-- | pkgs/by-name/ha/haredo/001-use-nix-store-sh.patch | 20 | ||||
-rw-r--r-- | pkgs/by-name/ha/haredo/package.nix | 60 |
2 files changed, 54 insertions, 26 deletions
diff --git a/pkgs/by-name/ha/haredo/001-use-nix-store-sh.patch b/pkgs/by-name/ha/haredo/001-use-nix-store-sh.patch new file mode 100644 index 0000000000000..4bd6507d7ea45 --- /dev/null +++ b/pkgs/by-name/ha/haredo/001-use-nix-store-sh.patch @@ -0,0 +1,20 @@ +diff --git a/src/haredo.ha b/src/haredo.ha +index c2e56e6..304c9ad 100644 +--- a/src/haredo.ha ++++ b/src/haredo.ha +@@ -280,12 +280,12 @@ fn try_do( + const tmpfilepath = strings::concat(ctx.tmpdir, "/", tmpfilename); + + const cmd = if (ctx.verbose) { +- fmt::errorln("* sh -ev", dopaths.do, dopaths.target, ++ fmt::errorln("* @bash@/bin/sh -ev", dopaths.do, dopaths.target, + dopaths.basename, tmpfilepath)?; +- yield exec::cmd("sh", "-ev", dopaths.do, dopaths.target, ++ yield exec::cmd("@bash@/bin/sh", "-ev", dopaths.do, dopaths.target, + dopaths.basename, tmpfilepath)?; + } else { +- yield exec::cmd("sh", "-e", dopaths.do, dopaths.target, ++ yield exec::cmd("@bash@/bin/sh", "-e", dopaths.do, dopaths.target, + dopaths.basename, tmpfilepath)?; + }; + diff --git a/pkgs/by-name/ha/haredo/package.nix b/pkgs/by-name/ha/haredo/package.nix index e31ae96c7832d..a6ef926c85b99 100644 --- a/pkgs/by-name/ha/haredo/package.nix +++ b/pkgs/by-name/ha/haredo/package.nix @@ -1,17 +1,22 @@ -{ stdenv -, lib -, fetchFromSourcehut -, hare -, scdoc -, nix-update-script -, makeWrapper -, bash +{ + stdenv, + lib, + fetchFromSourcehut, + hareHook, + scdoc, + nix-update-script, + makeWrapper, + bash, + substituteAll, }: stdenv.mkDerivation (finalAttrs: { pname = "haredo"; version = "1.0.5"; - outputs = [ "out" "man" ]; + outputs = [ + "out" + "man" + ]; src = fetchFromSourcehut { owner = "~autumnull"; @@ -20,28 +25,33 @@ 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 + hareHook makeWrapper scdoc ]; enableParallelChecking = true; - doCheck = true; + env.PREFIX = builtins.placeholder "out"; - dontConfigure = true; + doCheck = stdenv.buildPlatform.canExecute stdenv.hostPlatform; - preBuild = '' - HARECACHE="$(mktemp -d --tmpdir harecache.XXXXXXXX)" - export HARECACHE - export PREFIX=${builtins.placeholder "out"} - ''; + dontConfigure = true; buildPhase = '' runHook preBuild - ./bootstrap.sh + hare build -o bin/haredo ./src + scdoc <doc/haredo.1.scd >doc/haredo.1 runHook postBuild ''; @@ -57,26 +67,24 @@ 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 { }; meta = { - description = "A simple and unix-idiomatic build automator"; + description = "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; + inherit (hareHook.meta) platforms badPlatforms; }; }) |