2023-07-15 17:15:38 +00:00
|
|
|
{ lib
|
2024-01-02 11:29:13 +00:00
|
|
|
, buildGoModule
|
2023-07-15 17:15:38 +00:00
|
|
|
, fetchFromGitHub
|
|
|
|
, installShellFiles
|
2023-08-04 22:07:22 +00:00
|
|
|
, nodejs
|
2023-10-19 13:55:26 +00:00
|
|
|
, python3
|
2023-07-15 17:15:38 +00:00
|
|
|
, runtimeShell
|
|
|
|
, stdenv
|
|
|
|
, testers
|
|
|
|
, runme
|
|
|
|
}:
|
|
|
|
|
2024-01-02 11:29:13 +00:00
|
|
|
buildGoModule rec {
|
2023-07-15 17:15:38 +00:00
|
|
|
pname = "runme";
|
2024-02-29 20:09:43 +00:00
|
|
|
version = "3.0.2";
|
2023-07-15 17:15:38 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "stateful";
|
|
|
|
repo = "runme";
|
|
|
|
rev = "v${version}";
|
2024-02-29 20:09:43 +00:00
|
|
|
hash = "sha256-a+7Gff3Z1V17uaywoUE+nLVeVprB50Gslarcle/NPB8=";
|
2023-07-15 17:15:38 +00:00
|
|
|
};
|
|
|
|
|
2024-02-29 20:09:43 +00:00
|
|
|
vendorHash = "sha256-QoZzEq1aC7cjY/RVp5Z5HhSuTFf2BSYQnfg0jSaeTJU=";
|
2023-07-15 17:15:38 +00:00
|
|
|
|
|
|
|
nativeBuildInputs = [
|
|
|
|
installShellFiles
|
|
|
|
];
|
|
|
|
|
2023-08-04 22:07:22 +00:00
|
|
|
nativeCheckInputs = [
|
|
|
|
nodejs
|
2023-10-19 13:55:26 +00:00
|
|
|
python3
|
2023-08-04 22:07:22 +00:00
|
|
|
];
|
|
|
|
|
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}"
|
|
|
|
];
|
|
|
|
|
2024-01-02 11:29:13 +00:00
|
|
|
# tests fail to access /etc/bashrc on darwin
|
|
|
|
doCheck = !stdenv.isDarwin;
|
|
|
|
|
2023-07-15 17:15:38 +00:00
|
|
|
postPatch = ''
|
2024-01-02 11:29:13 +00:00
|
|
|
substituteInPlace testdata/{categories/basic,runall/basic,script/basic}.txtar \
|
2023-07-15 17:15:38 +00:00
|
|
|
--replace /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";
|
2024-04-21 15:54:59 +00:00
|
|
|
mainProgram = "runme";
|
2023-07-15 17:15:38 +00:00
|
|
|
homepage = "https://runme.dev";
|
|
|
|
changelog = "https://github.com/stateful/runme/releases/tag/v${version}";
|
|
|
|
license = licenses.asl20;
|
|
|
|
maintainers = with maintainers; [ figsoda ];
|
|
|
|
};
|
|
|
|
}
|