61 lines
1.6 KiB
Nix
61 lines
1.6 KiB
Nix
{
|
|
lib,
|
|
stdenv,
|
|
buildGoModule,
|
|
fetchFromGitHub,
|
|
installShellFiles,
|
|
buildPackages,
|
|
versionCheckHook,
|
|
nix-update-script,
|
|
}:
|
|
buildGoModule (finalAttrs: {
|
|
pname = "guesswidth";
|
|
version = "0.5.0";
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "noborus";
|
|
repo = "guesswidth";
|
|
tag = "v${finalAttrs.version}";
|
|
hash = "sha256-MbQBfwXdmcSU6F7M+Y70lGwBwhhJvRgtevco+UPt0Po=";
|
|
};
|
|
|
|
vendorHash = "sha256-/R/KUKQq52CnukJoQybSA4OkcHq/v8ICxxUqSc4ynEQ=";
|
|
|
|
ldflags = [
|
|
"-X github.com/noborus/guesswidth.version=v${finalAttrs.version}"
|
|
"-X github.com/noborus/guesswidth.revision=${finalAttrs.src.rev}"
|
|
];
|
|
|
|
nativeBuildInputs = [
|
|
installShellFiles
|
|
];
|
|
|
|
postInstall = lib.optionalString (stdenv.hostPlatform.emulatorAvailable buildPackages) (
|
|
let
|
|
emulator = stdenv.hostPlatform.emulator buildPackages;
|
|
in
|
|
''
|
|
installShellCompletion --cmd guesswidth \
|
|
--bash <(${emulator} $out/bin/guesswidth completion bash) \
|
|
--fish <(${emulator} $out/bin/guesswidth completion fish) \
|
|
--zsh <(${emulator} $out/bin/guesswidth completion zsh)
|
|
''
|
|
);
|
|
|
|
nativeInstallCheckInputs = [
|
|
versionCheckHook
|
|
];
|
|
doInstallCheck = true;
|
|
|
|
passthru.updateScript = nix-update-script { };
|
|
|
|
meta = {
|
|
description = "Guess the width (fwf) output without delimiters in commands that output to the terminal";
|
|
homepage = "https://github.com/noborus/guesswidth";
|
|
changelog = "https://github.com/noborus/guesswidth/releases/tag/v${finalAttrs.version}";
|
|
license = lib.licenses.mit;
|
|
maintainers = with lib.maintainers; [ xiaoxiangmoe ];
|
|
mainProgram = "guesswidth";
|
|
};
|
|
})
|