2023-07-15 17:15:38 +00:00
|
|
|
{ lib
|
|
|
|
, buildGoModule
|
|
|
|
, fetchFromGitHub
|
|
|
|
, installShellFiles
|
2023-08-04 22:07:22 +00:00
|
|
|
, nodejs
|
2023-07-15 17:15:38 +00:00
|
|
|
, runtimeShell
|
|
|
|
, stdenv
|
|
|
|
, testers
|
|
|
|
, runme
|
|
|
|
}:
|
|
|
|
|
|
|
|
buildGoModule rec {
|
|
|
|
pname = "runme";
|
2023-08-22 20:05:09 +00:00
|
|
|
version = "1.7.2";
|
2023-07-15 17:15:38 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "stateful";
|
|
|
|
repo = "runme";
|
|
|
|
rev = "v${version}";
|
2023-08-22 20:05:09 +00:00
|
|
|
hash = "sha256-BoPNIaYxK4VyafNWAVDonwTfpqF1N3Ggq5GF6A7DhF0=";
|
2023-07-15 17:15:38 +00:00
|
|
|
};
|
|
|
|
|
2023-08-22 20:05:09 +00:00
|
|
|
vendorHash = "sha256-sGk2K0I9onGFpDwboRugNHjFictisY4Q0NTNnOT3BW4=";
|
2023-07-15 17:15:38 +00:00
|
|
|
|
|
|
|
nativeBuildInputs = [
|
|
|
|
installShellFiles
|
|
|
|
];
|
|
|
|
|
2023-08-04 22:07:22 +00:00
|
|
|
nativeCheckInputs = [
|
|
|
|
nodejs
|
|
|
|
];
|
|
|
|
|
2023-07-15 17:15:38 +00:00
|
|
|
subPackages = [
|
|
|
|
"."
|
|
|
|
];
|
|
|
|
|
|
|
|
ldflags = [
|
|
|
|
"-s"
|
|
|
|
"-w"
|
|
|
|
"-X=github.com/stateful/runme/internal/version.BuildDate=1970-01-01T00:00:00Z"
|
|
|
|
"-X=github.com/stateful/runme/internal/version.BuildVersion=${version}"
|
|
|
|
"-X=github.com/stateful/runme/internal/version.Commit=${src.rev}"
|
|
|
|
];
|
|
|
|
|
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace testdata/script/basic.txtar \
|
|
|
|
--replace /bin/bash "${runtimeShell}"
|
|
|
|
'';
|
|
|
|
|
|
|
|
# version test assumes `ldflags` is unspecified
|
|
|
|
preCheck = ''
|
|
|
|
unset ldflags
|
|
|
|
'';
|
|
|
|
|
|
|
|
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";
|
|
|
|
homepage = "https://runme.dev";
|
|
|
|
changelog = "https://github.com/stateful/runme/releases/tag/v${version}";
|
|
|
|
license = licenses.asl20;
|
|
|
|
maintainers = with maintainers; [ figsoda ];
|
|
|
|
};
|
|
|
|
}
|