diff --git a/pkgs/by-name/hu/hunk/package.nix b/pkgs/by-name/hu/hunk/package.nix index 2562fa3b9cca..37b679ceed69 100644 --- a/pkgs/by-name/hu/hunk/package.nix +++ b/pkgs/by-name/hu/hunk/package.nix @@ -12,13 +12,13 @@ let pname = "hunk"; - version = "0.21.1"; + version = "0.22.0"; src = fetchFromGitHub { owner = "modem-dev"; repo = "hunk"; tag = "v${version}"; - hash = "sha256-8faDOqDXSdp5j8WP07rTW0L44keCPpv9mWoXGKXgvpY="; + hash = "sha256-dc4/xLAyQe7mL/KMcpjsjgHzgf0tRomQAemVABwUWFY="; }; node_modules = stdenv.mkDerivation { @@ -58,7 +58,7 @@ let dontFixup = true; - outputHash = "sha256-r3LXoIx7fHWyTTs19N4CU9mIWYsQxP0QVpstlvAu3D0="; + outputHash = "sha256-hWfG2T3Tfa69nX50OFW5XNRQxMc5lideDEUPw6G26qA="; outputHashMode = "recursive"; }; in @@ -75,16 +75,6 @@ stdenv.mkDerivation { writableTmpDirAsHomeHook ]; - # Teach `hunk skill path` to find the FHS layout under share/skills/$pname - # (https://github.com/NixOS/nixpkgs/issues/547426) instead of $out/skills. - postPatch = '' - substituteInPlace src/core/run/paths.ts \ - --replace-fail \ - 'join("node_modules", "hunkdiff", skillRelativePath),' \ - 'join("node_modules", "hunkdiff", skillRelativePath), - join("share", "skills", "hunk", name, "SKILL.md"),' - ''; - configurePhase = '' runHook preConfigure @@ -98,13 +88,15 @@ stdenv.mkDerivation { buildPhase = '' runHook preBuild + # Entry points mirror upstream's scripts/build/build-bin.ts. mkdir -p .bun-tmp .bun-install BUN_TMPDIR=$PWD/.bun-tmp \ BUN_INSTALL=$PWD/.bun-install \ bun build --compile \ --no-compile-autoload-bunfig \ --no-compile-autoload-dotenv \ - src/main.tsx \ + packages/hunk/src/main.tsx \ + packages/hunk/src/highlightWorkerEntry.ts \ --outfile hunk runHook postBuild @@ -115,8 +107,12 @@ stdenv.mkDerivation { runHook preInstall installBin hunk - installSkill skills/hunk-extensions hunk - installSkill skills/hunk-review hunk + for skill in packages/hunk/skills/*; do + installSkill "$skill" + done + + # `hunk skill path` looks for skills//SKILL.md above the executable. + ln -s share/skills/${pname} $out/skills runHook postInstall ''; @@ -134,9 +130,8 @@ stdenv.mkDerivation { installCheckPhase = '' runHook preInstallCheck - $out/bin/hunk --version | grep -F ${version} - test -f "$($out/bin/hunk skill path)" - test -f "$($out/bin/hunk skill path hunk-extensions)" + cmp "$out/share/skills/${pname}/hunk-review/SKILL.md" "$($out/bin/hunk skill path)" + cmp "$out/share/skills/${pname}/hunk-extensions/SKILL.md" "$($out/bin/hunk skill path hunk-extensions)" runHook postInstallCheck '';