depot/third_party/nixpkgs/pkgs/development/tools/misc/runme/default.nix
Default email 504525a148 Project import generated by Copybara.
GitOrigin-RevId: bd645e8668ec6612439a9ee7e71f7eac4099d4f6
2024-01-02 12:29:13 +01:00

75 lines
1.7 KiB
Nix

{ lib
, buildGoModule
, fetchFromGitHub
, installShellFiles
, nodejs
, python3
, runtimeShell
, stdenv
, testers
, runme
}:
buildGoModule rec {
pname = "runme";
version = "2.0.5";
src = fetchFromGitHub {
owner = "stateful";
repo = "runme";
rev = "v${version}";
hash = "sha256-l1ZTCLy9T+VrmFPzkjXCgIAFkotZ18BA8EYfM0HCCOA=";
};
vendorHash = "sha256-vYSheywz9ZyQ0aNWFpUEn/hrrktKAhV+VLYv74k+/nM=";
nativeBuildInputs = [
installShellFiles
];
nativeCheckInputs = [
nodejs
python3
];
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}"
];
# tests fail to access /etc/bashrc on darwin
doCheck = !stdenv.isDarwin;
postPatch = ''
substituteInPlace testdata/{categories/basic,runall/basic,script/basic}.txtar \
--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";
homepage = "https://runme.dev";
changelog = "https://github.com/stateful/runme/releases/tag/v${version}";
license = licenses.asl20;
maintainers = with maintainers; [ figsoda ];
};
}