Unverified Commit b213fede authored by Nick Cao's avatar Nick Cao Committed by GitHub
Browse files

Merge pull request #212827 from figsoda/hck

hck: 0.8.2 -> 0.9.1
parents ed0755b4 8b676310
Loading
Loading
Loading
Loading
+3 −18
Original line number Diff line number Diff line
@@ -2,38 +2,23 @@
, rustPlatform
, fetchFromGitHub
, cmake
, stdenv
, darwin
}:

rustPlatform.buildRustPackage rec {
  pname = "hck";
  version = "0.8.2";
  version = "0.9.1";

  src = fetchFromGitHub {
    owner = "sstadick";
    repo = pname;
    rev = "v${version}";
    sha256 = "sha256-66wunZuRAJ6QVWgBUy2+HGaow33F5+16LitGSQC4kCE=";
    sha256 = "sha256-wsuXEHwnTP+vl8Gn1mfH+cKoasDdZ+ILiAaJ7510lsI=";
  };

  cargoSha256 = "sha256-4CAj94wm9qxr9wejD2ffKSdRV1UeofMhxNxLi++At+I=";
  cargoSha256 = "sha256-qWat0QIMLmMrbK/QCr3dSyWP27wFFQ+IDQAzLngThQE=";

  nativeBuildInputs = [ cmake ];

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

  # link System as a dylib instead of a framework on macos
  postPatch = lib.optionalString stdenv.isDarwin ''
    core_affinity=../$(stripHash $cargoDeps)/core_affinity
    oldHash=$(sha256sum $core_affinity/src/lib.rs | cut -d " " -f 1)
    substituteInPlace $core_affinity/src/lib.rs --replace framework dylib
    substituteInPlace $core_affinity/.cargo-checksum.json \
      --replace $oldHash $(sha256sum $core_affinity/src/lib.rs | cut -d " " -f 1)
  '';

  meta = with lib; {
    description = "A close to drop in replacement for cut that can use a regex delimiter instead of a fixed string";
    homepage = "https://github.com/sstadick/hck";