summaryrefslogtreecommitdiff
path: root/pkgs/by-name/ra/ran/package.nix
blob: 4f1a747b733dc809b6998d9c367522112a0625ea (about) (plain)
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
{
  buildGoModule,
  fetchFromGitHub,
  lib,
  runCommand,
  ran,
  curl,
}:

buildGoModule rec {
  pname = "ran";
  version = "0.1.6";
  src = fetchFromGitHub {
    owner = "m3ng9i";
    repo = "ran";
    rev = "v${version}";
    hash = "sha256-iMvUvzr/jaTNdgHQFuoJNJnnkx2XHIUUlrPWyTlreEw=";
  };

  vendorHash = "sha256-ObroruWWNilHIclqNvbEaa7vwk+1zMzDKbjlVs7Fito=";

  env.CGO_ENABLED = 0;

  ldflags = [
    "-X"
    "main._version_=v${version}"
    "-X"
    "main._branch_=master"
  ];

  passthru.tests = {
    simple = runCommand "ran-test" { } ''
      echo hello world > index.html
      ${ran}/bin/ran &
      # Allow ran to fully initialize
      sleep 1
      [ "$(${curl}/bin/curl 127.0.0.1:8080)" == "hello world" ]
      kill %1
      ${ran}/bin/ran --version > $out
    '';
  };

  meta = with lib; {
    homepage = "https://github.com/m3ng9i/ran";
    description = "Simple web server for serving static files";
    mainProgram = "ran";
    license = licenses.mit;
    maintainers = with maintainers; [ tomberek ];
  };
}