From 474274d474860abbe60e398b5e52d219b35228f9 Mon Sep 17 00:00:00 2001 From: TomaSajt <62384384+TomaSajt@users.noreply.github.com> Date: Sun, 17 May 2026 20:22:00 +0200 Subject: [PATCH 1/2] httptoolkit-server: 1.24.2 -> 1.26.1 --- .../by-name/ht/httptoolkit-server/package.nix | 41 ++++++++++--------- 1 file changed, 22 insertions(+), 19 deletions(-) diff --git a/pkgs/by-name/ht/httptoolkit-server/package.nix b/pkgs/by-name/ht/httptoolkit-server/package.nix index b1960919d465..9aa19b960d09 100644 --- a/pkgs/by-name/ht/httptoolkit-server/package.nix +++ b/pkgs/by-name/ht/httptoolkit-server/package.nix @@ -1,30 +1,33 @@ { lib, - nodejs_22, + buildNpmPackage, fetchFromGitHub, writeShellScriptBin, - nss, + cmake, + nodejs_24, + nss, pkg-config, - openssl, + libdatachannel, + openssl, plog, }: let - nodejs = nodejs_22; + nodejs = nodejs_24; buildNpmPackage' = buildNpmPackage.override { inherit nodejs; }; # update together with httptoolkit # nixpkgs-update: no auto update - version = "1.24.2"; + version = "1.26.1"; src = fetchFromGitHub { owner = "httptoolkit"; repo = "httptoolkit-server"; tag = "v${version}"; - hash = "sha256-tcUQe4YIUpQ9I5nq66K7LO84mLFo8YAdHY/c2HROSpk="; + hash = "sha256-pCEz5bgpzEjGeBoOp3fb/WBW+loCzjvCckJTEwK0o7U="; }; overridesNodeModules = buildNpmPackage' { @@ -32,7 +35,7 @@ let inherit version src; sourceRoot = "${src.name}/overrides/js"; - npmDepsHash = "sha256-8cNGJdT8ndXa72ETttU2PjA8nfn+MTWesVVlA8GA1qQ="; + npmDepsHash = "sha256-B/W6kD6x10bfsuehRb9oObi+Gf3Hovm0jMNLcbuigeo="; dontBuild = true; @@ -65,8 +68,8 @@ let ]; buildInputs = [ - openssl libdatachannel + openssl plog ]; @@ -79,14 +82,14 @@ let # don't use static libs and don't use FetchContent # don't try to link plog (it's headers-only) substituteInPlace CMakeLists.txt \ - --replace-fail 'OPENSSL_USE_STATIC_LIBS TRUE' 'OPENSSL_USE_STATIC_LIBS FALSE' \ - --replace-fail 'if(NOT libdatachannel)' 'if(false)' \ - --replace-fail 'datachannel-static' 'datachannel' \ - --replace-fail 'plog::plog' "" + --replace-fail 'OPENSSL_USE_STATIC_LIBS TRUE' 'OPENSSL_USE_STATIC_LIBS FALSE' \ + --replace-fail 'if(NOT libdatachannel)' 'if(false)' \ + --replace-fail 'datachannel-static' 'datachannel' \ + --replace-fail 'plog::plog' "" # don't fetch node headers substituteInPlace node_modules/cmake-js/lib/dist.js \ - --replace-fail '!this.downloaded' 'false' + --replace-fail '!this.downloaded' 'false' ''; installPhase = '' @@ -102,7 +105,7 @@ buildNpmPackage' { patches = [ ./only-build-for-one-platform.patch ]; - npmDepsHash = "sha256-vhTe7EccEX57h7LDtNaaLaNR8xHSOlbnLtGrs7qT7pY="; + npmDepsHash = "sha256-OO1QI2KNbZo/2Bl6xC6oORVfDtBqjr2tuQmk6s70znM="; npmFlags = [ "--ignore-scripts" ]; @@ -117,8 +120,8 @@ buildNpmPackage' { postConfigure = '' # make sure `oclif-dev' doesn't fetch `node` binary to bundle with the app substituteInPlace node_modules/@oclif/dev-cli/lib/tarballs/node.js --replace-fail \ - 'async function fetchNodeBinary({ nodeVersion, output, platform, arch, tmp }) {' \ - 'async function fetchNodeBinary({ nodeVersion, output, platform, arch, tmp }) { return;' + 'async function fetchNodeBinary({ nodeVersion, output, platform, arch, tmp }) {' \ + 'async function fetchNodeBinary({ nodeVersion, output, platform, arch, tmp }) { return;' # manually place our prebuilt `node-datachannel` binary into its place, since we used '--ignore-scripts' ln -s ${nodeDatachannel}/build node_modules/node-datachannel/build @@ -152,12 +155,12 @@ buildNpmPackage' { # disable updating functionality substituteInPlace $out/share/httptoolkit-server/node_modules/@oclif/plugin-update/lib/commands/update.js \ - --replace-fail "await this.skipUpdate()" "'cannot update nix based package'" + --replace-fail "await this.skipUpdate()" "'cannot update nix based package'" # the app determines if it's in production by checking if HTTPTOOLKIT_SERVER_BINPATH is set to anything makeWrapper $out/share/httptoolkit-server/bin/run $out/bin/httptoolkit-server \ - --set HTTPTOOLKIT_SERVER_BINPATH dummy \ - --prefix PATH : ${lib.makeBinPath [ nss.tools ]} + --set HTTPTOOLKIT_SERVER_BINPATH dummy \ + --prefix PATH : ${lib.makeBinPath [ nss.tools ]} runHook postInstall ''; From 083d96b112b2ec21ebcbc9def9eabaf3db697398 Mon Sep 17 00:00:00 2001 From: TomaSajt <62384384+TomaSajt@users.noreply.github.com> Date: Sun, 17 May 2026 20:22:16 +0200 Subject: [PATCH 2/2] httptoolkit: 1.24.4 -> 1.26.0 --- pkgs/by-name/ht/httptoolkit/fix-paths.patch | 60 +++++++++++++++ pkgs/by-name/ht/httptoolkit/package.nix | 84 +++++++++++---------- 2 files changed, 106 insertions(+), 38 deletions(-) create mode 100644 pkgs/by-name/ht/httptoolkit/fix-paths.patch diff --git a/pkgs/by-name/ht/httptoolkit/fix-paths.patch b/pkgs/by-name/ht/httptoolkit/fix-paths.patch new file mode 100644 index 000000000000..7daa244be10e --- /dev/null +++ b/pkgs/by-name/ht/httptoolkit/fix-paths.patch @@ -0,0 +1,60 @@ +diff --git a/httptoolkit-ctl b/httptoolkit-ctl +index 0878247..d299b71 100644 +--- a/httptoolkit-ctl ++++ b/httptoolkit-ctl +@@ -1,10 +1,5 @@ + #!/bin/sh + SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" +-APP_DIR="$(dirname "$SCRIPT_DIR")" + export HTK_DESKTOP_RESOURCES="$SCRIPT_DIR" +-if [ "$(uname)" = "Darwin" ]; then +- export HTK_DESKTOP_EXE="$APP_DIR/MacOS/HTTP Toolkit" +-else +- export HTK_DESKTOP_EXE="$APP_DIR/httptoolkit" +-fi ++export HTK_DESKTOP_EXE="@out@/bin/httptoolkit" + exec "$SCRIPT_DIR/httptoolkit-server/bin/httptoolkit-server" ctl "$@" +diff --git a/httptoolkit-mcp b/httptoolkit-mcp +index c27b25a..c7b3f07 100644 +--- a/httptoolkit-mcp ++++ b/httptoolkit-mcp +@@ -1,10 +1,5 @@ + #!/bin/sh + SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" +-APP_DIR="$(dirname "$SCRIPT_DIR")" + export HTK_DESKTOP_RESOURCES="$SCRIPT_DIR" +-if [ "$(uname)" = "Darwin" ]; then +- export HTK_DESKTOP_EXE="$APP_DIR/MacOS/HTTP Toolkit" +-else +- export HTK_DESKTOP_EXE="$APP_DIR/httptoolkit" +-fi ++export HTK_DESKTOP_EXE="@out@/bin/httptoolkit" + exec "$SCRIPT_DIR/httptoolkit-server/bin/httptoolkit-server" mcp "$@" +diff --git a/package.json b/package.json +index e6a9ef4..f8d7ec1 100644 +--- a/package.json ++++ b/package.json +@@ -58,8 +58,8 @@ + ], + "extraResources": [ + "httptoolkit-server/**/*", +- "httptoolkit-ctl{,.*}", +- "httptoolkit-mcp{,.*}" ++ "httptoolkit-ctl", ++ "httptoolkit-mcp" + ], + "artifactName": "HttpToolkit-${version}-${arch}.${ext}", + "mac": { +diff --git a/src/index.ts b/src/index.ts +index 8a63c58..0511575 100644 +--- a/src/index.ts ++++ b/src/index.ts +@@ -392,7 +392,7 @@ if (!amMainInstance) { + ...process.env, + + HTK_SERVER_TOKEN: AUTH_TOKEN, +- HTK_DESKTOP_EXE: app.getPath('exe'), ++ HTK_DESKTOP_EXE: '@out@/bin/httptoolkit', + HTK_DESKTOP_RESOURCES: RESOURCES_PATH, + NODE_SKIP_PLATFORM_CHECK: '1', + OPENSSL_CONF: undefined, // Not relevant to us, and if set this can crash Node.js diff --git a/pkgs/by-name/ht/httptoolkit/package.nix b/pkgs/by-name/ht/httptoolkit/package.nix index 0c759847c9cb..8194b6a66a7d 100644 --- a/pkgs/by-name/ht/httptoolkit/package.nix +++ b/pkgs/by-name/ht/httptoolkit/package.nix @@ -1,89 +1,97 @@ { lib, stdenv, + buildNpmPackage, fetchFromGitHub, - makeWrapper, makeDesktopItem, + copyDesktopItems, - electron_39, + makeWrapper, + xcbuild, + + electron_41, httptoolkit-server, }: let - electron = electron_39; + electron = electron_41; in buildNpmPackage rec { pname = "httptoolkit"; # update together with httptoolkit-server # nixpkgs-update: no auto update - version = "1.24.4"; + version = "1.26.0"; src = fetchFromGitHub { owner = "httptoolkit"; repo = "httptoolkit-desktop"; tag = "v${version}"; - hash = "sha256-b1u+DFhxU/ED4GgMHFaF51zNfC+0vIg6ujyA8jIy8AQ="; + hash = "sha256-WEl0DGYdq1qa5zNEVO6L8TW6lgNTI0NdL0YXeR3Z0BI="; }; - npmDepsHash = "sha256-FX8sClJL66zvWEaaw0lmoat7cM396RA8Rq9NgRVh0Vw="; + patches = [ + ./fix-paths.patch + ]; + + postPatch = '' + substituteInPlace httptoolkit-{mcp,ctl} src/index.ts \ + --replace-fail "@out@" "$out" + ''; + + npmDepsHash = "sha256-fGVxHhJU/1ZsRyX3AnP6jM/jkY0PZHKDA1tb2z06lLs="; makeCacheWritable = true; - env = { - ELECTRON_SKIP_BINARY_DOWNLOAD = "1"; - # disable code signing on Darwin - CSC_IDENTITY_AUTO_DISCOVERY = "false"; - }; + env.ELECTRON_SKIP_BINARY_DOWNLOAD = "1"; nativeBuildInputs = [ makeWrapper ] - ++ lib.optionals stdenv.hostPlatform.isLinux [ copyDesktopItems ]; + ++ lib.optionals stdenv.hostPlatform.isLinux [ copyDesktopItems ] + ++ lib.optionals stdenv.hostPlatform.isDarwin [ xcbuild ]; npmBuildScript = "build:src"; postBuild = '' - substituteInPlace package.json --replace-fail \ - '"forceCodeSigning": true' \ - '"forceCodeSigning": false' - cp -rL ${electron.dist} electron-dist chmod -R u+w electron-dist npm exec electron-builder -- \ - --dir \ - -c.electronDist=electron-dist \ - -c.electronVersion=${electron.version} + --dir \ + -c.electronDist=electron-dist \ + -c.electronVersion=${electron.version} \ + -c.mac.forceCodeSigning=false \ + -c.mac.identity=null + # ^ this disables codesigning on Darwin ''; installPhase = '' runHook preInstall + '' + + lib.optionalString stdenv.hostPlatform.isLinux '' + mkdir -p $out/share/httptoolkit + cp -r dist/*-unpacked/{locales,resources{,.pak}} $out/share/httptoolkit - ${lib.optionalString stdenv.hostPlatform.isLinux '' - mkdir -p $out/share/httptoolkit - cp -r dist/*-unpacked/{locales,resources{,.pak}} $out/share/httptoolkit + ln -s ${httptoolkit-server} $out/share/httptoolkit/resources/httptoolkit-server - ln -s ${httptoolkit-server} $out/share/httptoolkit/resources/httptoolkit-server + install -Dm644 src/icons/icon.svg $out/share/icons/hicolor/scalable/apps/httptoolkit.svg - install -Dm644 src/icons/icon.svg $out/share/icons/hicolor/scalable/apps/httptoolkit.svg + makeWrapper ${lib.getExe electron} $out/bin/httptoolkit \ + --add-flags $out/share/httptoolkit/resources/app.asar \ + --add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--ozone-platform-hint=auto --enable-features=WaylandWindowDecorations --enable-wayland-ime=true}}" \ + --inherit-argv0 + '' + + lib.optionalString stdenv.hostPlatform.isDarwin '' + mkdir -p $out/Applications + cp -r dist/mac*/"HTTP Toolkit.app" $out/Applications - makeWrapper ${lib.getExe electron} $out/bin/httptoolkit \ - --add-flags $out/share/httptoolkit/resources/app.asar \ - --add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--ozone-platform-hint=auto --enable-features=WaylandWindowDecorations --enable-wayland-ime=true}}" \ - --inherit-argv0 - ''} - - ${lib.optionalString stdenv.hostPlatform.isDarwin '' - mkdir -p $out/Applications - cp -r dist/mac*/"HTTP Toolkit.app" $out/Applications - - ln -s ${httptoolkit-server} "$out/Applications/HTTP Toolkit.app/Contents/Resources/httptoolkit-server" - - makeWrapper "$out/Applications/HTTP Toolkit.app/Contents/MacOS/HTTP Toolkit" $out/bin/httptoolkit - ''} + ln -s ${httptoolkit-server} "$out/Applications/HTTP Toolkit.app/Contents/Resources/httptoolkit-server" + makeWrapper "$out/Applications/HTTP Toolkit.app/Contents/MacOS/HTTP Toolkit" $out/bin/httptoolkit + '' + + '' runHook postInstall '';