nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 buildGoModule,
4 fetchFromGitHub,
5 testers,
6 toxiproxy,
7}:
8
9buildGoModule rec {
10 pname = "toxiproxy";
11 version = "2.12.0";
12
13 src = fetchFromGitHub {
14 owner = "Shopify";
15 repo = "toxiproxy";
16 rev = "v${version}";
17 sha256 = "sha256-CqJr3h2n+fzN6Ves38H7fYXd5vlpDVfF3kg4Tr8ThPc=";
18 };
19
20 vendorHash = "sha256-4nKWTjB9aV5ILgHVceV76Ip0byBxlEY5TTAQwNLvL2s=";
21
22 excludedPackages = [ "test/e2e" ];
23
24 ldflags = [
25 "-s"
26 "-w"
27 "-X github.com/Shopify/toxiproxy/v2.Version=${version}"
28 ];
29
30 # Fixes tests on Darwin
31 __darwinAllowLocalNetworking = true;
32
33 checkFlags = [
34 "-short"
35 "-skip=TestVersionEndpointReturnsVersion|TestFullstreamLatencyBiasDown"
36 ];
37
38 postInstall = ''
39 mv $out/bin/cli $out/bin/toxiproxy-cli
40 mv $out/bin/server $out/bin/toxiproxy-server
41 '';
42
43 passthru.tests = {
44 cliVersion = testers.testVersion {
45 inherit version;
46 package = toxiproxy;
47 command = "${toxiproxy}/bin/toxiproxy-cli -version";
48 };
49 serverVersion = testers.testVersion {
50 inherit version;
51 package = toxiproxy;
52 command = "${toxiproxy}/bin/toxiproxy-server -version";
53 };
54 };
55
56 meta = {
57 changelog = "https://github.com/Shopify/toxiproxy/releases/tag/v${version}";
58 description = "Proxy for for simulating network conditions";
59 homepage = "https://github.com/Shopify/toxiproxy";
60 maintainers = with lib.maintainers; [ avnik ];
61 license = lib.licenses.mit;
62 };
63}