nixpkgs-suyu/pkgs/applications/misc/dasel/default.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

59 lines
1.7 KiB
Nix
Raw Normal View History

{ lib
2020-11-04 21:21:54 +01:00
, buildGoModule
, fetchFromGitHub
2023-07-02 17:14:44 +02:00
, installShellFiles
2020-11-04 21:21:54 +01:00
}:
buildGoModule rec {
pname = "dasel";
2023-11-29 19:56:47 +01:00
version = "2.5.0";
2020-11-04 21:21:54 +01:00
src = fetchFromGitHub {
owner = "TomWright";
2021-11-10 22:26:25 +01:00
repo = "dasel";
2020-11-04 21:21:54 +01:00
rev = "v${version}";
2023-11-29 19:56:47 +01:00
hash = "sha256-frd4jNn5uruz9oX40ly/AR5I/uKRIfQ8IjOlIvlsOlY=";
2020-11-04 21:21:54 +01:00
};
2023-11-29 19:56:47 +01:00
vendorHash = "sha256-B3d+pbk0smBXqcJnac5he0TZPLiT1cLtz02OAGfqhC0=";
2020-11-04 21:21:54 +01:00
ldflags = [
2023-01-20 01:10:24 +01:00
"-s" "-w" "-X github.com/tomwright/dasel/v2/internal.Version=${version}"
];
2020-12-04 07:22:07 +01:00
2023-07-02 17:14:44 +02:00
nativeBuildInputs = [ installShellFiles ];
postInstall = ''
installShellCompletion --cmd dasel \
--bash <($out/bin/dasel completion bash) \
--fish <($out/bin/dasel completion fish) \
--zsh <($out/bin/dasel completion zsh)
'';
2020-12-20 20:41:51 +01:00
doInstallCheck = true;
installCheckPhase = ''
2022-12-07 02:22:46 +01:00
runHook preInstallCheck
if [[ $($out/bin/dasel --version) == "dasel version ${version}" ]]; then
echo '{ "my": { "favourites": { "colour": "blue" } } }' \
| $out/bin/dasel put -t json -r json -t string -v "red" "my.favourites.colour" \
| grep "red"
2020-12-20 20:41:51 +01:00
else
return 1
fi
2022-12-07 02:22:46 +01:00
runHook postInstallCheck
2020-12-20 20:41:51 +01:00
'';
meta = with lib; {
2020-11-04 21:21:54 +01:00
description = "Query and update data structures from the command line";
longDescription = ''
Dasel (short for data-selector) allows you to query and modify data structures using selector strings.
Comparable to jq / yq, but supports JSON, YAML, TOML and XML with zero runtime dependencies.
'';
homepage = "https://github.com/TomWright/dasel";
2021-11-10 22:26:25 +01:00
changelog = "https://github.com/TomWright/dasel/blob/v${version}/CHANGELOG.md";
2020-11-04 21:21:54 +01:00
license = licenses.mit;
2023-08-14 17:12:56 +02:00
mainProgram = "dasel";
2020-11-04 21:21:54 +01:00
maintainers = with maintainers; [ _0x4A6F ];
};
}