Files
nixpkgs/pkgs/development/python-modules/mitmproxy-rs/default.nix
T
Dmitry Ivankov 0dd2238ac7 mitmproxy: fix macos build
https://hydra.nixos.org/build/240114924/nixlog/1
```
error: linking with `/nix/store/sa6hywsm1mqfyd1xakyzv4ljjsb3hawh-clang-wrapper-11.1.0/bin/cc` failed: exit status: 1
  |
...
  = note: ld: library not found for -liconv
          clang-11: error: linker command failed with exit code 1 (use -v to see invocation)
```

after adding libiconv it starts to fail with
```
  File "/nix/store/ncs3h7zqjl3cl2cwflka40rrirb6qg1m-python3.11-mitmproxy-rs-0.3.11/lib/python3.11/site-packages/mitmproxy_rs/__init__.py", line 1, in <module>
    from .mitmproxy_rs import *
ModuleNotFoundError: No module named 'mitmproxy_macos'
```
so it needs extra module
https://github.com/mitmproxy/mitmproxy_rs/tree/main/mitmproxy-macos

So the fixes are
- add `libiconv` dependency to mitmproxy-rs
- add `mitmproxy-macos` python package and add it to dependencies of
  `mitmproxy-rs` and `mitmproxy` itself (otherwise import fails,
  looks like the import is sneaky because it is platform-conditional)
2023-11-18 17:04:59 +01:00

54 lines
1.2 KiB
Nix

{ lib
, stdenv
, buildPythonPackage
, fetchFromGitHub
, rustPlatform
, darwin
, libiconv
, mitmproxy-macos
}:
buildPythonPackage rec {
pname = "mitmproxy-rs";
version = "0.3.11";
pyproject = true;
src = fetchFromGitHub {
owner = "mitmproxy";
repo = "mitmproxy_rs";
rev = version;
hash = "sha256-V6LUr1jJiTo0+53jipkTyzG5JSw6uHaS6ziyBaFbETw=";
};
cargoDeps = rustPlatform.importCargoLock {
lockFile = ./Cargo.lock;
outputHashes = {
"internet-packet-0.1.0" = "sha256-VtEuCE1sulBIFVymh7YW7VHCuIBjtb6tHoPz2tjxX+Q=";
};
};
buildAndTestSubdir = "mitmproxy-rs";
nativeBuildInputs = [
rustPlatform.cargoSetupHook
rustPlatform.maturinBuildHook
];
buildInputs = lib.optionals stdenv.isDarwin [
darwin.apple_sdk.frameworks.Security
libiconv
mitmproxy-macos
];
pythonImportsCheck = [ "mitmproxy_rs" ];
meta = with lib; {
description = "The Rust bits in mitmproxy";
homepage = "https://github.com/mitmproxy/mitmproxy_rs";
changelog = "https://github.com/mitmproxy/mitmproxy_rs/blob/${src.rev}/CHANGELOG.md";
license = licenses.mit;
maintainers = with maintainers; [ fab ];
platforms = platforms.all;
};
}