diff --git a/pkgs/development/tools/misc/runme/default.nix b/pkgs/development/tools/misc/runme/default.nix new file mode 100644 index 000000000000..d90ff72e12dc --- /dev/null +++ b/pkgs/development/tools/misc/runme/default.nix @@ -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 ]; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index d54dd0a911f3..373e4f383ed3 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -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 { };