nixpkgs/pkgs/by-name/ru/runme/package.nix

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

82 lines
1.9 KiB
Nix
Raw Normal View History

{
lib,
buildGoModule,
fetchFromGitHub,
installShellFiles,
nodejs,
python3,
runtimeShell,
stdenv,
testers,
runme,
}:
buildGoModule rec {
pname = "runme";
version = "3.8.3";
src = fetchFromGitHub {
owner = "stateful";
repo = "runme";
rev = "v${version}";
hash = "sha256-AnGh1Kg3CV4UkEwZ81QMeIf9whdeCglmCbfp8DC6N30=";
};
2024-09-15 21:40:43 +00:00
vendorHash = "sha256-qOM66jiSjAU5e6eGrM8kgJxWJzxwgHpLadx5pTjNFOs=";
nativeBuildInputs = [
installShellFiles
];
nativeCheckInputs = [
nodejs
python3
];
subPackages = [
"."
];
ldflags = [
"-s"
"-w"
2024-09-15 21:40:43 +00:00
"-X=github.com/stateful/runme/v3/internal/version.BuildDate=1970-01-01T00:00:00Z"
"-X=github.com/stateful/runme/v3/internal/version.BuildVersion=${version}"
"-X=github.com/stateful/runme/v3/internal/version.Commit=${src.rev}"
];
2024-09-15 21:40:43 +00:00
# checkFlags = [
# "-ldflags=-X=github.com/stateful/runme/v3/internal/version.BuildVersion=${version}"
# ];
# tests fail to access /etc/bashrc on darwin
doCheck = !stdenv.hostPlatform.isDarwin;
postPatch = ''
substituteInPlace testdata/{flags/fmt,prompts/basic,runall/basic,script/basic,tags/categories}.txtar \
2024-09-15 21:40:43 +00:00
--replace-fail /bin/bash "${runtimeShell}"
'';
postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
installShellCompletion --cmd runme \
--bash <($out/bin/runme completion bash) \
--fish <($out/bin/runme completion fish) \
--zsh <($out/bin/runme completion zsh)
'';
passthru.tests = {
version = testers.testVersion {
package = runme;
};
};
meta = with lib; {
description = "Execute commands inside your runbooks, docs, and READMEs";
mainProgram = "runme";
homepage = "https://runme.dev";
2023-07-05 20:18:28 +00:00
changelog = "https://github.com/stateful/runme/releases/tag/v${version}";
license = licenses.asl20;
maintainers = with maintainers; [ figsoda ];
};
}