Commit 9d8d1301 authored by figsoda's avatar figsoda
Browse files

termbook: fix build

parent b753135b
Loading
Loading
Loading
Loading
+2900 −0

File added.

Preview size limit exceeded, changes collapsed.

+27 −3
Original line number Diff line number Diff line
{ lib, rustPlatform, fetchFromGitHub, stdenv, darwin }:
{ lib
, rustPlatform
, fetchFromGitHub
, pkg-config
, oniguruma
, stdenv
, darwin
}:

rustPlatform.buildRustPackage rec {
  pname = "termbook-cli";
@@ -11,12 +18,29 @@ rustPlatform.buildRustPackage rec {
    sha256 = "Bo3DI0cMXIfP7ZVr8MAW/Tmv+4mEJBIQyLvRfVBDG8c=";
  };

  cargoSha256 = "sha256-9fFvJJlDzBmbI7hes/wfjAk1Cl2H55T5n8HLnUmDw/c=";
  cargoLock = {
    lockFile = ./Cargo.lock;
  };

  nativeBuildInputs = [
    pkg-config
  ];

  buildInputs = lib.optionals stdenv.isDarwin [
  buildInputs = [
    oniguruma
  ] ++ lib.optionals stdenv.isDarwin [
    darwin.apple_sdk.frameworks.Security
  ];

  env = {
    RUSTONIG_SYSTEM_LIBONIG = true;
  };

  # update dependencies to fix build failure caused by unaligned packed structs
  postPatch = ''
    ln -sf ${./Cargo.lock} Cargo.lock
  '';

  meta = with lib; {
    description = "A runner for `mdbooks` to keep your documentation tested";
    homepage = "https://github.com/Byron/termbook/";