Unverified Commit 8162e5c1 authored by Michael Daniels's avatar Michael Daniels Committed by GitHub
Browse files

to-html: add runtime dependencies (#479085)

parents 4f6c377e eefad8f0
Loading
Loading
Loading
Loading
+19 −5
Original line number Diff line number Diff line
@@ -2,17 +2,20 @@
  lib,
  fetchFromGitHub,
  installShellFiles,
  makeWrapper,
  rustPlatform,
  unixtools,
  which,
}:

rustPlatform.buildRustPackage rec {
rustPlatform.buildRustPackage (finalAttrs: {
  version = "0.1.6";
  pname = "to-html";

  src = fetchFromGitHub {
    owner = "Aloso";
    repo = "to-html";
    rev = "v${version}";
    rev = "v${finalAttrs.version}";
    hash = "sha256-eNFt9/yK4oHOspNM8PMTewhx8APaHzmgNdrWqrUuQSU=";
  };

@@ -21,21 +24,32 @@ rustPlatform.buildRustPackage rec {
  # Requires external resources
  doCheck = false;

  nativeBuildInputs = [ installShellFiles ];
  nativeBuildInputs = [
    installShellFiles
    makeWrapper
  ];

  postInstall = ''
    installShellCompletion \
      $releaseDir/build/to-html-*/out/to-html.{bash,fish} \
      --zsh $releaseDir/build/to-html-*/out/_to-html

    wrapProgram $out/bin/to-html \
      --suffix PATH : ${
        lib.makeBinPath [
          unixtools.script
          which
        ]
      }
  '';

  meta = {
    description = "Terminal wrapper for rendering a terminal on a website by converting ANSI escape sequences to HTML";
    mainProgram = "to-html";
    homepage = "https://github.com/Aloso/to-html";
    changelog = "https://github.com/Aloso/to-html/blob/${src.rev}/CHANGELOG.md";
    changelog = "https://github.com/Aloso/to-html/blob/${finalAttrs.src.rev}/CHANGELOG.md";
    license = lib.licenses.mit;
    platforms = lib.platforms.all;
    maintainers = with lib.maintainers; [ icewind1991 ];
  };
}
})