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