diff --git a/pkgs/servers/filtron/default.nix b/pkgs/servers/filtron/default.nix index fccc1ba0016b..f50e3b19583c 100644 --- a/pkgs/servers/filtron/default.nix +++ b/pkgs/servers/filtron/default.nix @@ -1,22 +1,32 @@ -{ lib, buildGoPackage, fetchFromGitHub }: +{ lib, buildGoModule, fetchFromGitHub, fetchpatch }: -buildGoPackage rec { +buildGoModule rec { pname = "filtron"; version = "0.2.0"; - goPackagePath = "github.com/asciimoo/filtron"; - src = fetchFromGitHub { owner = "asciimoo"; repo = "filtron"; rev = "v${version}"; - sha256 = "18d3h0i2sfqbc0bjx26jm2n9f37zwp8z9z4wd17sw7nvkfa72a26"; + hash = "sha256-RihxlJvbHq5PaJz89NHl/wyXrKjSiC4XYAs7LSKAo6E="; }; - goDeps = ./deps.nix; + vendorHash = "sha256-1DRR16WiBGvhOpq12L5njJJRRCIA7ajs1Py9j/3cWPE="; - # The upstream test checks are obsolete/unmaintained. - doCheck = false; + patches = [ + # Update golang version in go.mod + (fetchpatch { + url = "https://github.com/asciimoo/filtron/commit/365a0131074b3b12aaa65194bfb542182a63413c.patch"; + hash = "sha256-QGR6YetEzA/b6tC4uD94LBkWv0+9PG7RD72Tpkn2gQU="; + }) + # Add missing go.sum file + (fetchpatch { + url = "https://github.com/asciimoo/filtron/commit/077769282b4e392e96a194c8ae71ff9f693560ea.patch"; + hash = "sha256-BhHbXDKiRjSzC6NKhKUiH6rjt/EgJcEprHMMJ1x/wiQ="; + }) + ]; + + ldflags = [ "-s" "-w" ]; meta = with lib; { description = "Reverse HTTP proxy to filter requests by different rules."; diff --git a/pkgs/servers/filtron/deps.nix b/pkgs/servers/filtron/deps.nix deleted file mode 100644 index 61320f868d05..000000000000 --- a/pkgs/servers/filtron/deps.nix +++ /dev/null @@ -1,41 +0,0 @@ -[ - { - goPackagePath = "github.com/valyala/fasthttp"; - fetch = { - type = "git"; - url = "https://github.com/valyala/fasthttp"; - rev = "v1.41.0"; - sha256 = "sha256-lV9FP7GjnQk/kJACE9l5CZ/8kzORdNpYS5lPokEYrZM="; - }; - } - - { - goPackagePath = "github.com/klauspost/compress"; - fetch = { - type = "git"; - url = "https://github.com/klauspost/compress"; - rev = "v1.15.12"; - sha256 = "sha256-D41sCSbaqX9tXIRcTU9TYyjPyZpuKLDeQMXETE2ulbM="; - }; - } - - { - goPackagePath = "github.com/valyala/bytebufferpool"; - fetch = { - type = "git"; - url = "https://github.com/valyala/bytebufferpool"; - rev = "v1.0.0"; - sha256 = "sha256-I9FPZ3kCNRB+o0dpMwBnwZ35Fj9+ThvITn8a3Jr8mAY="; - }; - } - - { - goPackagePath = "github.com/andybalholm/brotli"; - fetch = { - type = "git"; - url = "https://github.com/andybalholm/brotli"; - rev = "v1.0.4"; - sha256 = "sha256-gAnPRdGP4yna4hiRIEDyBtDOVJqd7RU27wlPu96Rdf8="; - }; - } -]