|
| 1 | +{ |
| 2 | + lib, |
| 3 | + rustPlatform, |
| 4 | + fetchFromGitHub, |
| 5 | + yq, |
| 6 | + pkg-config, |
| 7 | + cmake, |
| 8 | + openssl, |
| 9 | + zstd, |
| 10 | + versionCheckHook, |
| 11 | + nix-update-script, |
| 12 | +}: |
| 13 | + |
| 14 | +rustPlatform.buildRustPackage (finalAttrs: { |
| 15 | + pname = "proksi"; |
| 16 | + version = "0.5.3"; |
| 17 | + |
| 18 | + src = fetchFromGitHub { |
| 19 | + owner = "luizfonseca"; |
| 20 | + repo = "proksi"; |
| 21 | + tag = "proksi-v${finalAttrs.version}"; |
| 22 | + hash = "sha256-zwLF6yL/EqyBtZ+hHXLJRe2UaZyhSzotEFYlpoLXKZ4="; |
| 23 | + }; |
| 24 | + |
| 25 | + postPatch = '' |
| 26 | + tomlq -ti 'del(.bench)' crates/proksi/Cargo.toml |
| 27 | + ''; |
| 28 | + |
| 29 | + useFetchCargoVendor = true; |
| 30 | + cargoHash = "sha256-vFZUcHh/gI4fdlM6LcN+6kjweLUnPNYNq6Y+XxWoSl8="; |
| 31 | + |
| 32 | + nativeBuildInputs = [ |
| 33 | + pkg-config |
| 34 | + cmake # required for libz-ng-sys |
| 35 | + yq # for `tomlq` |
| 36 | + ]; |
| 37 | + |
| 38 | + buildInputs = [ |
| 39 | + openssl |
| 40 | + zstd |
| 41 | + ]; |
| 42 | + |
| 43 | + cargoBuildFlags = [ "--package=proksi" ]; |
| 44 | + cargoTestFlags = finalAttrs.cargoBuildFlags; |
| 45 | + |
| 46 | + checkFlags = [ |
| 47 | + # requires network access |
| 48 | + "--skip=services::discovery::test::test_domain_addr" |
| 49 | + |
| 50 | + # these tests don't fail themselves, however they invoke clap which tries to parse configuration |
| 51 | + # from the command line, which would normally be empty, but here it includes the `--skip` flags |
| 52 | + # above which clap doesn't recognize and thus rejects |
| 53 | + "--skip=config::tests::" |
| 54 | + ]; |
| 55 | + |
| 56 | + env = { |
| 57 | + OPENSSL_NO_VENDOR = true; |
| 58 | + ZSTD_SYS_USE_PKG_CONFIG = true; |
| 59 | + }; |
| 60 | + |
| 61 | + nativeInstallCheckInputs = [ versionCheckHook ]; |
| 62 | + versionCheckProgramArg = "--version"; |
| 63 | + doInstallCheck = true; |
| 64 | + |
| 65 | + passthru.updateScript = nix-update-script { |
| 66 | + extraArgs = [ |
| 67 | + "--version-regex" |
| 68 | + "proksi-v(.*)" |
| 69 | + ]; |
| 70 | + }; |
| 71 | + |
| 72 | + meta = { |
| 73 | + description = "Batteries-included CDN, reverse proxy and Load Balancer using Cloudflare Pingora"; |
| 74 | + homepage = "https://github.com/luizfonseca/proksi"; |
| 75 | + changelog = "https://github.com/luizfonseca/proksi/blob/proksi-v${finalAttrs.version}/CHANGELOG.md"; |
| 76 | + license = with lib.licenses; [ |
| 77 | + mit |
| 78 | + asl20 |
| 79 | + ]; |
| 80 | + maintainers = with lib.maintainers; [ defelo ]; |
| 81 | + mainProgram = "proksi"; |
| 82 | + }; |
| 83 | +}) |
0 commit comments