lol
1{
2 lib,
3 buildGoModule,
4 fetchFromGitHub,
5 installShellFiles,
6 nodejs,
7 python3,
8 runtimeShell,
9 stdenv,
10 testers,
11 runme,
12}:
13
14buildGoModule rec {
15 pname = "runme";
16 version = "3.15.2";
17
18 src = fetchFromGitHub {
19 owner = "runmedev";
20 repo = "runme";
21 rev = "v${version}";
22 hash = "sha256-NtFKzObi0mIdzhRiu7CCZ3e4yIhI2gHMtVsdf5TEb/s=";
23 };
24
25 vendorHash = "sha256-Uw5igaQpKKI4y7EoznFdmyTXfex350Pps6nt3lvKeAM=";
26
27 nativeBuildInputs = [
28 installShellFiles
29 ];
30
31 nativeCheckInputs = [
32 nodejs
33 python3
34 ];
35
36 subPackages = [
37 "."
38 ];
39
40 ldflags = [
41 "-s"
42 "-w"
43 "-X=github.com/runmedev/runme/v3/internal/version.BuildDate=1970-01-01T00:00:00Z"
44 "-X=github.com/runmedev/runme/v3/internal/version.BuildVersion=${version}"
45 "-X=github.com/runmedev/runme/v3/internal/version.Commit=${src.rev}"
46 ];
47
48 # checkFlags = [
49 # "-ldflags=-X=github.com/runmedev/runme/v3/internal/version.BuildVersion=${version}"
50 # ];
51
52 # tests fail to access /etc/bashrc on darwin
53 doCheck = !stdenv.hostPlatform.isDarwin;
54
55 postPatch = ''
56 substituteInPlace testdata/{flags/fmt,prompts/basic,runall/basic,script/basic,tags/categories}.txtar \
57 --replace-fail /bin/bash "${runtimeShell}"
58 '';
59
60 postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
61 installShellCompletion --cmd runme \
62 --bash <($out/bin/runme completion bash) \
63 --fish <($out/bin/runme completion fish) \
64 --zsh <($out/bin/runme completion zsh)
65 '';
66
67 passthru.tests = {
68 version = testers.testVersion {
69 package = runme;
70 };
71 };
72
73 meta = {
74 description = "Execute commands inside your runbooks, docs, and READMEs";
75 mainProgram = "runme";
76 homepage = "https://runme.dev";
77 changelog = "https://github.com/runmedev/runme/releases/tag/v${version}";
78 license = lib.licenses.asl20;
79 maintainers = with lib.maintainers; [ figsoda ];
80 };
81}