Firefox developer tools do not work in home-manager installed firefox

Hi,

I don’t know why, but F12 (or any other method) opens a blank page instead of developer tools (see screenshot):

Here’s the code I use to configure firefox:

{ config
, ...
}:

{
  programs.firefox = {
    enable = true;

    policies = {
      DefaultDownloadDirectory = "${config.home.homeDirectory}/dlds";
      DisableTelemetry = true;
      DisableFirefoxStudies = true;
      DisableDeveloperTools = false;
      EnableTrackingProtection = {
        Value = true;
        Locked = true;
        Cryptomining = true;
        Fingerprinting = true;
      };
      DisablePocket = true;
      DisableFirefoxAccounts = true;
      DisableAccounts = false;
      DisableFirefoxScreenshots = true;
      OverrideFirstRunPage = "";
      OverridePostUpdatePage = "";
      DontCheckDefaultBrowser = true;
      DisplayBookmarksToolbar = "never"; # alternatives: "always" or "newtab"
      DisplayMenuBar = "default-off"; # alternatives: "always", "never" or "default-on"
      SearchBar = "unified"; # alternative: "separate"
    };

    profiles.default = {
      isDefault = true;
      id = 0;
      name = "default";

      containersForce = true;
      containers = {
        default = {
          color = "green";
          icon = "fruit";
          id = 1;
        };

        work = {
          color = "red";
          icon = "briefcase";
          id = 2;
        };

        etc = {
          color = "blue";
          icon = "gift";
          id = 3;
        };
      };

      extensions = let
        addons = config.nur.repos.rycee.firefox-addons;
      in [
        # some addons.foo like
        addons.ublock-origin
      ];

      search.default = "DuckDuckGo";

      # Whether to force replace the existing search
      # configuration. This is recommended since Firefox will
      # replace the symlink for the search configuration on every
      # launch, but note that you'll lose any existing
      # configuration by enabling this.
      search.force = true;

      settings = let
        lock-false = {
          Value = false;
          Status = "locked";
        };
        lock-true = {
          Value = true;
          Status = "locked";
        };
      in {
        "browser.newtabpage.pinned" = [
          # Some { url = "..."; title = "..."; }
        ];

        "browser.tabs.closeWindowWithLastTab" = lock-false;
        "browser.tabs.warnOnClose" = lock-true;
        "browser.contentblocking.category" = { Value = "strict"; Status = "locked"; };
        "extensions.autoDisableScopes" = 0; # automatically enable plugins
        "extensions.pocket.enabled" = lock-false;
        "extensions.screenshots.disabled" = lock-true;
        "browser.topsites.contile.enabled" = lock-false;
        "browser.formfill.enable" = lock-false;
        "browser.search.suggest.enabled" = lock-true;
        "browser.search.suggest.enabled.private" = lock-false;
        "browser.urlbar.suggest.searches" = lock-true;
        "browser.urlbar.showSearchSuggestionsFirst" = lock-false;
        "browser.newtabpage.activity-stream.topSitesRows" = 4;
        "browser.newtabpage.activity-stream.feeds.section.topstories" = lock-false;
        "browser.newtabpage.activity-stream.feeds.snippets" = lock-false;
        "browser.newtabpage.activity-stream.section.highlights.includePocket" = lock-false;
        "browser.newtabpage.activity-stream.section.highlights.includeBookmarks" = lock-false;
        "browser.newtabpage.activity-stream.section.highlights.includeDownloads" = lock-false;
        "browser.newtabpage.activity-stream.section.highlights.includeVisited" = lock-false;
        "browser.newtabpage.activity-stream.showSponsored" = lock-false;
        "browser.newtabpage.activity-stream.system.showSponsored" = lock-false;
        "browser.newtabpage.activity-stream.showSponsoredTopSites" = lock-false;
        "services.sync.prefs.sync.browser.newtabpage.activity-stream.showSponsored" = lock-false;
        "services.sync.prefs.sync.browser.newtabpage.activity-stream.showSponsoredTopSites" = lock-false;
        "browser.urlbar.sponsoredTopSites" = lock-false;
        "browser.urlbar.suggest.quicksuggest.nonsponsored" = lock-false;
        "browser.urlbar.suggest.quicksuggest.sponsored" = lock-false;
      };
    };
  };
}

Does anyone have any idea?

Given the lack of other context aside from home-manager, is it possible a hotkey got rebound?

I don’t think so, because F12 does open something, the developer tools seem just not to load from what I can see?

Thats new, and weird. Weird question, you notice a spike in video memory usage or a spike in GPU clock speed when you open dev tools? It might be tryn hardware rendering.

Nope, I don’t see anything suspicious (in nvtop). :frowning_face:

Are there any error messages in journalctl or dmesg?

None in dmesg, journalctl --user -fe app-firefox-...scope or sudo journalctl -fe. :cry:

Well thats really annoying. Hmm.
Which version of firefox? The default off the shelf version or the dev version?

I assume that the home-manager module installs from the global nixpkgs, as I have useGlobalPkgs = true; useUserPackages = true;.

I am still on 24.05, so this is firefox version 132.0.1 here.

I did some digging and this is what i was able to find that match your scenario, take a look: Firefox devtools broken with custom home-manager configuration - #3 by petafloppa this post also seems to have a temp solution thats somewhat effective by closing FF and deleting the sqlite db underneath.

Theres also some talk on reddit about it being correlated with the number of open tabs on FF at the time, Reddit - Dive into anything

A bug was also reported to nix github* as well around the same time by another guy with the same scenario, home-manager, FF refusing to show dev tools when prompted : bug: firefox: places.sqlite in profile getting corrupted · Issue #6083 · nix-community/home-manager · GitHub

1 Like

After some more reading, i dont think theres a clearly defined reason why. Its not a hardware or nixos issue at least, since we dont see anything reported in dmesg or journalctl.

It must be the way home-manager interacts with FF’s local data, data thats typically stored inside your home folder. DB’s historically dont really like being edited or open with more than one client at a time.
My guess would be the db is getting borked when home manager interacts with it at the same time FF is trying to.
I dont use home-manager, but if theres a way to exclude folders from being touched in home-manager, or to move the folder containing the db out of HM’s reach, that would be the first thing i would try. Perhaps it might be worth trying to configure FF in the config instead of HM.

Please let me know if this helped at all. Im now genuinely curious as to whats causing such a specific bug.

1 Like