A declarative Firefox configuration using Nix home-manager, designed for enhanced performance, a streamlined UI, and powerful automation.
This Nix flake-based configuration provides a highly customized and declarative Firefox configuration, managed through a home-manager module. It focuses on delivering a superior browsing experience by integrating performance enhancements, UI/UX improvements, and automation scripts.
The configuration incorporates hardened user preferences from Betterfox, deployed via betterfox-nix. This generates a comprehensive user.js file within the Firefox profile, responsible for enhancing performance, removing distracting UI elements, and strengthening security and privacy.
The user interface is heavily customized to be minimal, clean, & efficient, largely based on styles from MrOtherGuy/firefox-csshacks.
- Minimalist Design: The tab bar is hidden, and the URL bar is streamlined for a distraction-free look.
- Custom Styles: Additional CSS tweaks are applied to refine margins and element spacing for a polished feel.
- Declarative Theming: All
userChrome.cssanduserContent.cssfiles are managed directly by Nix.
This module leverages MrOtherGuy/fx-autoconfig to automatically load custom user scripts (*.uc.js) and CSS at startup. While fx-autoconfig normally requires a manual, procedural setup, this module packages it into a declarative, Nix-based configuration, simplifying management and ensuring reproducibility.
Advanced functionality is added via JavaScript user scripts (*.uc.js), enabling powerful UI automation for the Sidebery extension.
- Collapsible Sidebar: The sidebar can be automatically collapsed and expanded on hover or by holding the
Ctrlkey, maximizing screen real estate without sacrificing functionality.
For keyboard-driven power users, the configuration includes a custom theme and setup for the Tridactyl extension, providing a seamless Vim-like browsing experience.
Add the flake input and import homeManagerConfigurations.default directly into your home-manager modules list. The module is automatically imported — no extra wiring needed:
## flake.nix
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
home-manager.url = "github:nix-community/home-manager";
firefox-nixCfg.url = "github:DivitMittal/firefox-nixCfg";
};
outputs = { nixpkgs, home-manager, firefox-nixCfg, ... }: {
homeConfigurations.your-user = home-manager.lib.homeManagerConfiguration {
pkgs = nixpkgs.legacyPackages.x86_64-linux;
modules = [
firefox-nixCfg.homeManagerConfigurations.default
./home.nix
];
};
};
}Then configure the available options in your home.nix:
## home.nix
{
programs.firefox-nixCfg = {
enableTridactyl = true; # optional — enables Tridactyl vim keybindings
package = pkgs.firefox-bin; # optional — override the Firefox package
};
}macOS Support: For macOS, this module defaults to using a pre-built Firefox binary from the nixpkgs-firefox-darwin overlay, ensuring a native and optimized experience.
- DivitMittal/OS-nixCfg: Infrastructure NixOS/nix-darwin configurations repository
Context files (AGENTS.md, CLAUDE.md) are generated — not committed. Run apm compile before exploring the repo to get directory-level guidance.


