2021-09-19 16:38:41 +01:00
|
|
|
{ lib
|
2021-09-03 03:05:16 +01:00
|
|
|
, rustPlatform
|
2021-09-19 16:38:41 +01:00
|
|
|
, fetchFromGitHub
|
|
|
|
, cmake
|
2021-09-03 03:05:16 +01:00
|
|
|
, stdenv
|
|
|
|
, CoreFoundation
|
|
|
|
, Security
|
|
|
|
}:
|
2021-08-17 20:27:02 +01:00
|
|
|
|
|
|
|
rustPlatform.buildRustPackage rec {
|
|
|
|
pname = "hck";
|
2021-11-28 19:03:33 +00:00
|
|
|
version = "0.7.1";
|
2021-08-17 20:27:02 +01:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "sstadick";
|
|
|
|
repo = pname;
|
|
|
|
rev = "v${version}";
|
2021-11-28 19:03:33 +00:00
|
|
|
sha256 = "sha256-6PXhFOXWplj7yEyn7hOQSPS2YDGc1nxTs6wRseRvEVk=";
|
2021-08-17 20:27:02 +01:00
|
|
|
};
|
|
|
|
|
2021-11-28 19:03:33 +00:00
|
|
|
cargoSha256 = "sha256-VAtvc8K4282twB1MRY72+dCky3JmrTRjOPx1Ft7Oqt8=";
|
2021-09-03 03:05:16 +01:00
|
|
|
|
|
|
|
nativeBuildInputs = [ cmake ];
|
|
|
|
|
2021-11-15 17:26:09 +00:00
|
|
|
buildInputs = lib.optionals stdenv.isDarwin [ CoreFoundation Security ];
|
2021-08-17 20:27:02 +01:00
|
|
|
|
2021-11-22 00:28:13 +00:00
|
|
|
# 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)
|
|
|
|
'';
|
|
|
|
|
2021-08-17 20:27:02 +01:00
|
|
|
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";
|
|
|
|
changelog = "https://github.com/sstadick/hck/blob/v${version}/CHANGELOG.md";
|
|
|
|
license = with licenses; [ mit /* or */ unlicense ];
|
|
|
|
maintainers = with maintainers; [ figsoda ];
|
|
|
|
};
|
|
|
|
}
|