2024-10-06 05:05:08 +00:00
|
|
|
{
|
|
|
|
lib,
|
|
|
|
buildGoModule,
|
|
|
|
fetchFromGitHub,
|
|
|
|
installShellFiles,
|
|
|
|
nodejs,
|
|
|
|
python3,
|
|
|
|
runtimeShell,
|
|
|
|
stdenv,
|
|
|
|
testers,
|
|
|
|
runme,
|
2023-05-25 00:14:38 +00:00
|
|
|
}:
|
|
|
|
|
2023-11-29 01:47:48 +00:00
|
|
|
buildGoModule rec {
|
2023-05-25 00:14:38 +00:00
|
|
|
pname = "runme";
|
2024-10-06 05:05:52 +00:00
|
|
|
version = "3.8.3";
|
2023-05-25 00:14:38 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "stateful";
|
|
|
|
repo = "runme";
|
|
|
|
rev = "v${version}";
|
2024-10-06 05:05:52 +00:00
|
|
|
hash = "sha256-AnGh1Kg3CV4UkEwZ81QMeIf9whdeCglmCbfp8DC6N30=";
|
2023-05-25 00:14:38 +00:00
|
|
|
};
|
|
|
|
|
2024-09-15 21:40:43 +00:00
|
|
|
vendorHash = "sha256-qOM66jiSjAU5e6eGrM8kgJxWJzxwgHpLadx5pTjNFOs=";
|
2023-05-25 00:14:38 +00:00
|
|
|
|
|
|
|
nativeBuildInputs = [
|
|
|
|
installShellFiles
|
|
|
|
];
|
|
|
|
|
2023-07-24 23:36:22 +00:00
|
|
|
nativeCheckInputs = [
|
|
|
|
nodejs
|
2023-10-18 21:09:24 +00:00
|
|
|
python3
|
2023-07-24 23:36:22 +00:00
|
|
|
];
|
|
|
|
|
2023-05-25 00:14:38 +00:00
|
|
|
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}"
|
2023-05-25 00:14:38 +00:00
|
|
|
];
|
|
|
|
|
2024-09-15 21:40:43 +00:00
|
|
|
# checkFlags = [
|
|
|
|
# "-ldflags=-X=github.com/stateful/runme/v3/internal/version.BuildVersion=${version}"
|
|
|
|
# ];
|
|
|
|
|
2023-11-29 01:47:48 +00:00
|
|
|
# tests fail to access /etc/bashrc on darwin
|
|
|
|
doCheck = !stdenv.hostPlatform.isDarwin;
|
|
|
|
|
2023-05-25 00:14:38 +00:00
|
|
|
postPatch = ''
|
2024-10-06 05:05:52 +00:00
|
|
|
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}"
|
2023-05-25 00:14:38 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
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";
|
2024-03-19 02:14:51 +00:00
|
|
|
mainProgram = "runme";
|
2023-05-25 00:14:38 +00:00
|
|
|
homepage = "https://runme.dev";
|
2023-07-05 20:18:28 +00:00
|
|
|
changelog = "https://github.com/stateful/runme/releases/tag/v${version}";
|
2023-05-25 00:14:38 +00:00
|
|
|
license = licenses.asl20;
|
|
|
|
maintainers = with maintainers; [ figsoda ];
|
|
|
|
};
|
|
|
|
}
|