Skip to content
TheChatArchiveThe Chat Archive
grok-3-mini-beta· xAIHugging Face LMArena Human Preference 140K

home-manager Firefox configuration with extensions, use the latest features of the…

From a Chatbot Arena battleThe same person sent this prompt to two anonymous models at once. Compare it with MiniMaxminimax-m1’s answer.
  1. User

    home-manager Firefox configuration with extensions, use the latest features of the unstable version

  2. Assistant

    Below is a complete example of a Home Manager configuration for Firefox that uses the unstable version of the package. This setup includes popular extensions and leverages the latest features from the unstable channel of Nixpkgs. By using the unstable Firefox package, you'll get access to the most recent updates, bug fixes, and experimental features.

    Key Points:

    • Unstable Version: We're importing the unstable Nixpkgs channel to use its Firefox package. This assumes you have the unstable channel set up (e.g., via nix-channel --add https://nixos.org/channels/nixpkgs-unstable). If not, you'll need to configure that first.
    • Extensions: I've included a few popular extensions (e.g., uBlock Origin for ad-blocking, Dark Reader for night mode). You can add or remove them as needed. Extensions are managed via Home Manager's Firefox module, which installs them as part of your profile.
    • Latest Features: Using the unstable package ensures you get the newest Firefox features. Home Manager will handle the configuration, including setting preferences.
    • How to Use: Add this to your home.nix file (or equivalent). Then, run home-manager switch to apply the changes.
    • Caveats:
      • Firefox extensions in Nixpkgs are pre-built and may not always be the absolute latest version. However, they are from the unstable channel here, so they'll be as up-to-date as possible.
      • Make sure your Nix environment has access to the unstable channel. If you're using a flake-based setup, you can adapt this accordingly.

    Configuration Code

    Here's the Nix configuration:

    { config, pkgs, ... }:
    
    let
      # Import the unstable Nixpkgs channel
      unstable = import <unstable> {};  # Assumes you have 'nixpkgs-unstable' channel added
    in
    {
      # Enable Home Manager's Firefox module
      programs.firefox = {
        enable = true;
    
        # Use the unstable version of Firefox
        package = unstable.firefox;
    
        profiles = {
          # Define a default profile
          default = {
            id = 0;  # Internal ID for the profile
            name = "default";  # Name of the profile
            isDefault = true;  # Set this as the default profile
    
            # Add extensions from the unstable channel
            extensions = with unstable.firefoxExtensions; [
              ublock-origin  # Ad blocker
              darkreader     # Dark mode for websites
              privacy-badger # Privacy protection
              # Add more extensions as needed, e.g., vimium for keyboard navigation
              # vimium
            ];
    
            # Configure Firefox settings (preferences)
            settings = {
              # General settings
              "browser.startup.homepage" = "https://www.example.com";  # Set homepage
              "browser.newtabpage.enabled" = false;  # Disable new tab page
              "browser.newtabpage.activity-stream.feeds.system.topstories" = false;  # Disable sponsored stories
    
              # Privacy and security settings
              "dom.security.https_only_mode" = true;  # Enforce HTTPS-only mode
              "privacy.trackingprotection.enabled" = true;  # Enable tracking protection
              "signon.rememberSignons" = false;  # Disable password saving
    
              # Performance and experimental features
              "browser.tabs.remote.autostart" = true;  # Enable multi-process tabs (E10S)
              "network.http.max-connections" = 1000;  # Increase max connections for better performance
              "media.ffmpeg.vaapi.enabled" = true;  # Enable VAAPI for hardware acceleration (if supported)
    
              # UI customizations
              "browser.ui.toolbarpins" = 0;  # Customize toolbar
              "layout.css.devPixelsPerPx" = "1.0";  # Set DPI scaling
            };
    
            # Optional: Search engines (add custom ones if needed)
            search = {
              default = "Google";  # Set default search engine
              force = true;  # Force the search engines to be set
              engines = {
                "NixOS Search" = {
                  urls = [{
                    template = "https://search.nixos.org/packages";
                    params = [
                      { name = "type"; value = "packages"; }
                      { name = "query"; value = "{searchTerms}"; }
                    ];
                  }];
                  icon = "${pkgs.nixos-icons}/share/icons/hicolor/scalable/apps/nix-snowflake.svg";
                  definedAliases = [ "@nix" ];
                };
                # You can add more engines here
              };
            };
    
            # Extra preferences (e.g., user scripts or other customizations)
            extraConfig = ''
              // Example: User script or additional JS config
              user_pref("example.preference", true);
            '';
          };
        };
      };
    }
    

    Explanation:

    1. Importing Unstable Nixpkgs:

      • The line unstable = import <unstable> {}; imports the unstable channel. This requires you to have added the channel via nix-channel add https://nixos.org/channels/nixpkgs-unstable unstable and run nix-channel update.
      • If you're using flakes, you could replace this with a flake input, e.g., unstable = import (fetchTarball "https://github.com/NixOS/nixpkgs/archive/nixpkgs-unstable.tar.gz") {};.
    2. Firefox Package:

      • package = unstable.firefox; ensures you're using the latest unstable build of Firefox, which includes new features like improved privacy controls, better performance, and experimental APIs.
    3. Profiles:

      • We're defining a single profile named "default". You can add more profiles if needed (e.g., for work vs. personal use).
      • extensions: This lists extensions from unstable.firefoxExtensions. Home Manager will install and enable them automatically.
    4. Settings:

      • The settings attribute allows you to configure Firefox preferences directly. These are based on Firefox's about:config settings.
      • I've included a mix of general, privacy, performance, and UI settings to demonstrate. You can customize these further based on your needs.
    5. Search Engines:

      • Added an example for a custom NixOS search engine. This shows how to integrate search providers.
    6. Applying the Configuration:

      • Save this in your Home Manager configuration file (e.g., ~/.config/home-manager/home.nix).
      • Run home-manager switch to build and activate the configuration.
      • If you encounter issues (e.g., channel not found), verify your channels with nix-channel --list.

    Tips for Customization:

    • More Extensions: Check available extensions in unstable.firefoxExtensions by running nix repl '<unstable>' and typing firefoxExtensions. Add them to the list, e.g., sponsorblock for skipping sponsored segments on YouTube.
    • Updating: To keep things fresh, regularly update your channels with nix-channel update and re-run home-manager switch.
    • Troubleshooting:
      • If extensions don't work, ensure they are compatible with your Firefox version.
      • For more advanced setups, consider using Home Manager's extraConfig for custom userChrome.js or userContent.js files.
      • If you're on a non-NixOS system, Home Manager still works, but you might need to install it via Nix.

    This configuration should give you a solid starting point for a feature-rich Firefox setup with the latest unstable features. If you need further adjustments, let me know!

Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.