firefox-mcp/flake.nix
2026-11-06 12:45:22 +01:00

56 lines
1.7 KiB
Nix

{
description = "Covert Firefox for the firefox-devtools MCP: navigator.webdriver always false";
inputs.nixpkgs.url = "nixpkgs";
outputs =
{ self, nixpkgs }:
let
systems = [
"x86_64-linux"
"aarch64-linux"
];
forAllSystems = nixpkgs.lib.genAttrs systems;
in
{
packages = forAllSystems (
system:
let
pkgs = nixpkgs.legacyPackages.${system};
in
rec {
# Firefox built from source with dom/base/Navigator.cpp patched so
# Navigator::Webdriver() never reports automation. Marionette and
# WebDriver BiDi keep working; only the JS-visible flag is false.
firefox-covert = pkgs.wrapFirefox (
pkgs.firefox-unwrapped.overrideAttrs (old: {
patches = (old.patches or [ ]) ++ [ ./navigator-webdriver-false.patch ];
})
) { };
default = firefox-covert;
}
);
devShells = forAllSystems (
system:
let
pkgs = nixpkgs.legacyPackages.${system};
in
{
# Shell where `firefox` is the patched build. The firefox-devtools
# MCP auto-detects its browser via PATH, so running it from here
# picks up the covert build with no extra flags:
# nix develop .#mcp --command npx -y @mozilla/firefox-devtools-mcp@latest --autoProfile
mcp = pkgs.mkShellNoCC {
packages = [
self.packages.${system}.firefox-covert
pkgs.nodejs
];
shellHook = ''
echo "firefox-devtools MCP devshell: firefox -> $(command -v firefox)"
'';
};
}
);
};
}