1{
2 buildGoModule,
3 fetchFromGitHub,
4 lib,
5 runCommand,
6 ran,
7 curl,
8}:
9
10buildGoModule rec {
11 pname = "ran";
12 version = "0.1.6";
13 src = fetchFromGitHub {
14 owner = "m3ng9i";
15 repo = "ran";
16 rev = "v${version}";
17 hash = "sha256-iMvUvzr/jaTNdgHQFuoJNJnnkx2XHIUUlrPWyTlreEw=";
18 };
19
20 vendorHash = "sha256-ObroruWWNilHIclqNvbEaa7vwk+1zMzDKbjlVs7Fito=";
21
22 env.CGO_ENABLED = 0;
23
24 ldflags = [
25 "-X"
26 "main._version_=v${version}"
27 "-X"
28 "main._branch_=master"
29 ];
30
31 passthru.tests = {
32 simple = runCommand "ran-test" { } ''
33 echo hello world > index.html
34 ${ran}/bin/ran &
35 # Allow ran to fully initialize
36 sleep 1
37 [ "$(${curl}/bin/curl 127.0.0.1:8080)" == "hello world" ]
38 kill %1
39 ${ran}/bin/ran --version > $out
40 '';
41 };
42
43 meta = with lib; {
44 homepage = "https://github.com/m3ng9i/ran";
45 description = "Ran is a simple web server for serving static files";
46 mainProgram = "ran";
47 license = licenses.mit;
48 maintainers = with maintainers; [ tomberek ];
49 };
50}