5e7c2d6cef
GitOrigin-RevId: f99e5f03cc0aa231ab5950a15ed02afec45ed51a
75 lines
1.7 KiB
Nix
75 lines
1.7 KiB
Nix
{ lib
|
|
, buildGo121Module
|
|
, fetchFromGitHub
|
|
, installShellFiles
|
|
, nodejs
|
|
, runtimeShell
|
|
, stdenv
|
|
, testers
|
|
, runme
|
|
}:
|
|
|
|
buildGo121Module rec {
|
|
pname = "runme";
|
|
version = "1.7.6";
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "stateful";
|
|
repo = "runme";
|
|
rev = "v${version}";
|
|
hash = "sha256-gYaC1ROvW4wFrOKt1Wjl/ExhWX0ZQXHW6n6N70tXa+E=";
|
|
};
|
|
|
|
vendorHash = "sha256-/eofPpXmfpc7Vjz97hjKXH/Fl/EAk0zrnI279iit7MI=";
|
|
|
|
nativeBuildInputs = [
|
|
installShellFiles
|
|
];
|
|
|
|
nativeCheckInputs = [
|
|
nodejs
|
|
];
|
|
|
|
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 ];
|
|
};
|
|
}
|