nixpkgs/pkgs/applications/misc/dasel/default.nix
0x4A6F a990f74cf8
treewide: sha256 -> hash (#262801)
* tumpa: sha256 -> hash

* qubes-core-vchan-xen: sha256 -> hash

* qdmr: sha256 -> hash

* w_scan2: sha256 -> hash

* libcdada: sha256 -> hash

* eidolon: sha256 -> hash

* freenukum: sha256 -> hash

* promscale: sha256 -> hash

* tacacsplus: sha256 -> hash

* blflash: sha256 -> hash

* silicon: sha256 -> hash

* nethoscope: sha256 -> hash

* pmacct: sha256 -> hash

* tayga: sha256 -> hash

* alejandra: sha256 -> hash

* igrep: sha256 -> hash

* cwm: sha256 -> hash

* dasel: sha256 -> hash
2023-10-23 00:38:33 +02:00

59 lines
1.7 KiB
Nix

{ lib
, buildGoModule
, fetchFromGitHub
, installShellFiles
}:
buildGoModule rec {
pname = "dasel";
version = "2.4.1";
src = fetchFromGitHub {
owner = "TomWright";
repo = "dasel";
rev = "v${version}";
hash = "sha256-zxTT/CkSbH40R7itXAx0zD+haHOoMep/W4KfalJQ/8w=";
};
vendorHash = "sha256-CbR0uHtha2OoHW9mcB1I2lGJbjerbZARVN/mTstv/Y0=";
ldflags = [
"-s" "-w" "-X github.com/tomwright/dasel/v2/internal.Version=${version}"
];
nativeBuildInputs = [ installShellFiles ];
postInstall = ''
installShellCompletion --cmd dasel \
--bash <($out/bin/dasel completion bash) \
--fish <($out/bin/dasel completion fish) \
--zsh <($out/bin/dasel completion zsh)
'';
doInstallCheck = true;
installCheckPhase = ''
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"
else
return 1
fi
runHook postInstallCheck
'';
meta = with lib; {
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";
changelog = "https://github.com/TomWright/dasel/blob/v${version}/CHANGELOG.md";
license = licenses.mit;
mainProgram = "dasel";
maintainers = with maintainers; [ _0x4A6F ];
};
}