2021-02-05 17:12:51 +00:00
|
|
|
{ lib
|
2023-08-22 20:05:09 +00:00
|
|
|
, stdenv
|
|
|
|
, buildPackages
|
2020-04-24 23:36:52 +00:00
|
|
|
, buildPythonPackage
|
2020-05-15 21:57:56 +00:00
|
|
|
, fetchFromGitHub
|
2023-08-22 20:05:09 +00:00
|
|
|
, installShellFiles
|
2021-12-06 16:07:01 +00:00
|
|
|
, ruamel-yaml
|
2020-04-24 23:36:52 +00:00
|
|
|
, xmltodict
|
2020-05-15 21:57:56 +00:00
|
|
|
, pygments
|
2021-01-09 10:05:03 +00:00
|
|
|
, pytestCheckHook
|
2021-08-05 21:33:18 +00:00
|
|
|
, pythonOlder
|
2020-04-24 23:36:52 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "jc";
|
2024-04-21 15:54:59 +00:00
|
|
|
version = "1.25.2";
|
2024-01-02 11:29:13 +00:00
|
|
|
format = "setuptools";
|
2021-08-05 21:33:18 +00:00
|
|
|
disabled = pythonOlder "3.6";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2020-05-15 21:57:56 +00:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "kellyjonbrazil";
|
2021-08-05 21:33:18 +00:00
|
|
|
repo = pname;
|
2022-09-30 11:47:45 +00:00
|
|
|
rev = "refs/tags/v${version}";
|
2024-04-21 15:54:59 +00:00
|
|
|
hash = "sha256-SDZ92m4TVH5/ldGkVZspzIrR0G1vHOv1OvAOSaWYkZ0=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2021-12-06 16:07:01 +00:00
|
|
|
propagatedBuildInputs = [ ruamel-yaml xmltodict pygments ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2023-08-22 20:05:09 +00:00
|
|
|
nativeBuildInputs = [ installShellFiles ];
|
|
|
|
|
|
|
|
postInstall = let emulator = stdenv.hostPlatform.emulator buildPackages; in ''
|
|
|
|
installShellCompletion --cmd jc \
|
|
|
|
--bash <(${emulator} $out/bin/jc --bash-comp) \
|
|
|
|
--zsh <(${emulator} $out/bin/jc --zsh-comp)
|
|
|
|
'';
|
|
|
|
|
2023-02-02 18:25:31 +00:00
|
|
|
nativeCheckInputs = [ pytestCheckHook ];
|
2021-01-09 10:05:03 +00:00
|
|
|
|
2021-08-05 21:33:18 +00:00
|
|
|
pythonImportsCheck = [ "jc" ];
|
|
|
|
|
|
|
|
# tests require timezone to set America/Los_Angeles
|
|
|
|
doCheck = false;
|
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2020-10-19 00:13:06 +00:00
|
|
|
description = "This tool serializes the output of popular command line tools and filetypes to structured JSON output";
|
2020-04-24 23:36:52 +00:00
|
|
|
homepage = "https://github.com/kellyjonbrazil/jc";
|
|
|
|
license = licenses.mit;
|
|
|
|
maintainers = with maintainers; [ atemu ];
|
2022-11-21 17:40:18 +00:00
|
|
|
changelog = "https://github.com/kellyjonbrazil/jc/blob/v${version}/CHANGELOG";
|
2023-08-10 07:59:29 +00:00
|
|
|
mainProgram = "jc";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|