about summary refs log tree commit diff
path: root/nixpkgs/pkgs/by-name/sc/scripthaus/package.nix
blob: be6b1e5f9b14d3ebc88704af2ea6fe62c7bb317c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
{ lib
, buildGoModule
, fetchFromGitHub
, nix-update-script
}:

buildGoModule rec {
  pname = "scripthaus";
  version = "0.5.1";

  src = fetchFromGitHub {
    owner = "scripthaus-dev";
    repo = "scripthaus";
    rev = "v${version}";
    hash = "sha256-ZWOSLkqjauONa+fKkagpUgWB4k+l1mzEEiC0RAMUmo0=";
  };

  vendorHash = "sha256-GUZNPLBgqN1zBzCcPl7TB9/4/Yk4e7K6I20nVaM6ank=";

  CGO_ENABLED = 1;

  ldflags = [ "-s" "-w" ];

  postInstall = ''
    mv $out/bin/cmd $out/bin/scripthaus
  '';

  passthru.updateScript = nix-update-script {
    extraArgs = [ "--version-regex" "^(v[0-9.]+)$" ];
  };

  meta = with lib; {
    description = "Run bash, Python, and JS snippets from your Markdown files directly from the command-line";
    homepage = "https://github.com/scripthaus-dev/scripthaus";
    license = licenses.mpl20;
    maintainers = with maintainers; [ raspher ];
    mainProgram = "scripthaus";
  };
}