about summary refs log tree commit diff
path: root/pkgs/by-name/st/static-server/package.nix
blob: 3be8eec4b80df57b029eb2de60582138c447027c (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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
{ lib
, buildGoModule
, fetchFromGitHub
, curl
, stdenv
, testers
, static-server
, substituteAll
}:

buildGoModule rec {
  pname = "static-server";
  version = "1.2.1";

  src = fetchFromGitHub {
    owner = "eliben";
    repo = "static-server";
    rev = "v${version}";
    hash = "sha256-AZcNh/kF6IdAceA7qe+nhRlwU4yGh19av/S1Zt7iKIs=";
  };

  vendorHash = "sha256-1p3dCLLo+MTPxf/Y3zjxTagUi+tq7nZSj4ZB/aakJGY=";

  patches = [
    # patch out debug.ReadBuidlInfo since version information is not available with buildGoModule
    (substituteAll {
      src = ./version.patch;
      inherit version;
    })
  ];

  nativeCheckInputs = [
    curl
  ];

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

  # tests sometimes fail with SIGQUIT on darwin
  doCheck = !stdenv.hostPlatform.isDarwin;

  passthru.tests = {
    version = testers.testVersion {
      package = static-server;
    };
  };

  __darwinAllowLocalNetworking = true;

  meta = with lib; {
    description = "Simple, zero-configuration HTTP server CLI for serving static files";
    homepage = "https://github.com/eliben/static-server";
    license = licenses.unlicense;
    maintainers = with maintainers; [ figsoda ];
    mainProgram = "static-server";
  };
}