lol
1{ lib, stdenv, buildGoModule, fetchFromGitHub }:
2
3buildGoModule rec {
4 pname = "reproxy";
5 version = "1.0.0";
6
7 src = fetchFromGitHub {
8 owner = "umputun";
9 repo = pname;
10 rev = "v${version}";
11 hash = "sha256-ac4fOOMht2WGlrXLN95NEIA8ivqghhVuxHnBumvajx0=";
12 };
13
14 postPatch = ''
15 # Requires network access
16 substituteInPlace app/main_test.go \
17 --replace "Test_Main" "Skip_Main"
18 substituteInPlace app/proxy/proxy_test.go \
19 --replace "TestHttp_matchHandler" "SkipHttp_matchHandler"
20 '' + lib.optionalString stdenv.isDarwin ''
21 # Fails on Darwin.
22 # https://github.com/umputun/reproxy/issues/77
23 substituteInPlace app/discovery/provider/file_test.go \
24 --replace "TestFile_Events" "SkipFile_Events" \
25 --replace "TestFile_Events_BusyListener" "SkipFile_Events_BusyListener"
26 '';
27
28 vendorHash = null;
29
30 ldflags = [
31 "-s" "-w" "-X main.revision=${version}"
32 ];
33
34 installPhase = ''
35 install -Dm755 $GOPATH/bin/app $out/bin/reproxy
36 '';
37
38 meta = with lib; {
39 description = "Simple edge server / reverse proxy";
40 homepage = "https://reproxy.io/";
41 license = licenses.mit;
42 maintainers = with maintainers; [ sikmir ];
43 };
44}