Merge pull request #233898 from figsoda/runme

This commit is contained in:
figsoda 2023-05-26 17:13:10 -04:00 committed by GitHub
commit 82a03c322c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 72 additions and 0 deletions

View file

@ -0,0 +1,70 @@
{ lib
, buildGoModule
, fetchFromGitHub
, installShellFiles
, runtimeShell
, stdenv
, testers
, runme
}:
buildGoModule rec {
pname = "runme";
version = "1.2.1";
src = fetchFromGitHub {
owner = "stateful";
repo = "runme";
rev = "v${version}";
hash = "sha256-Gk15sqGQRL5v7Fo+tIYM4GM1FihoEAs23HK0cQN9hy4=";
};
vendorHash = "sha256-el+gM3GRN5KU4RlSAx02rn+22xj28IZq3erZUzPbUUw=";
nativeBuildInputs = [
installShellFiles
];
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${src.rev}";
license = licenses.asl20;
maintainers = with maintainers; [ figsoda ];
};
}

View file

@ -12037,6 +12037,8 @@ with pkgs;
rund = callPackage ../development/tools/rund { };
runme = callPackage ../development/tools/misc/runme { };
runzip = callPackage ../tools/archivers/runzip { };
unzoo = callPackage ../tools/archivers/unzoo { };