-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdefault.nix
More file actions
31 lines (26 loc) · 1 KB
/
default.nix
File metadata and controls
31 lines (26 loc) · 1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
{ writeShellApplication, runCommandNoCC, buildEnv, python311 }:
let
python = python311;
mitmproxy-remote-interceptions = python.pkgs.buildPythonPackage {
pname = "mitmproxy-remote-interceptions";
version = "0.1.0";
format = "pyproject";
src = ./.;
propagatedBuildInputs = with python.pkgs; [ mitmproxy websockets ];
};
launchers = let
tools = [ "dump" "proxy" "web" ];
launcher = writeShellApplication {
name = "mitmri";
runtimeInputs = [ (python.withPackages (ps: [ mitmproxy-remote-interceptions ])) ];
text = ''
mitmricommand="$(basename "$0")"
''${mitmricommand/mitmri/mitm} "$@" -s "$(python -c 'import importlib.util; print(importlib.util.find_spec("mitmproxy_remote_interceptions").origin)')"
'';
};
in runCommandNoCC "mitmproxy-remote-interceptions-launchers" { } ''
mkdir -p $out/bin
${builtins.concatStringsSep "\n"
(map (tool: "ln -s ${launcher}/bin/${launcher.name} $out/bin/mitmri${tool}") tools)}
'';
in launchers