hledger-fmt: init at 0.3.1 (#448953)

This commit is contained in:
Sandro
2025-10-11 17:06:15 +00:00
committed by GitHub
+53
View File
@@ -0,0 +1,53 @@
{
fetchFromGitHub,
installShellFiles,
lib,
nix-update-script,
rustPlatform,
stdenv,
}:
rustPlatform.buildRustPackage (finalAttrs: {
pname = "hledger-fmt";
version = "0.3.1";
src = fetchFromGitHub {
owner = "mondeja";
repo = "hledger-fmt";
tag = "v${finalAttrs.version}";
hash = "sha256-5dPKSUJLxQ5WXZefuwr3wLhr3MNzy+dzpJkgKFU0/SE=";
};
nativeBuildInputs = [
installShellFiles
];
cargoHash = "sha256-yErH9AyfBZF0PByqViVhXHB/FAc0awz4bOyAHtcHe0s=";
# Tests try to invoke the binary from "target/debug/hledger-fmt"
# https://github.com/mondeja/hledger-fmt/blob/783abdb32eefb20195c7e9562858552935bb9c8e/src/cli/tests.rs#L5
postPatch = ''
substituteInPlace src/cli/tests.rs --replace-fail \
'target/debug' "target/${stdenv.hostPlatform.rust.rustcTargetSpec}/$cargoCheckType"
'';
buildFeatures = [
"manpages"
];
postInstall = ''
installManPage --name hledger-fmt.1 \
"target/${stdenv.hostPlatform.rust.rustcTargetSpec}/assets/example.1"
'';
passthru.updateScript = nix-update-script { };
meta = {
description = "Opinionated hledger's journal files formatter";
homepage = "https://github.com/mondeja/hledger-fmt";
changelog = "https://github.com/mondeja/hledger-fmt/blob/${finalAttrs.src.rev}/CHANGELOG.md";
license = lib.licenses.mit;
maintainers = with lib.maintainers; [ dwoffinden ];
mainProgram = "hledger-fmt";
};
})