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.css
anduserContent.css
files 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
Ctrl
key, 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.
To use this module in your own configuration, add it to your flake.nix
inputs:
## flake.nix
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
home-manager.url = "github:nix-community/home-manager";
firefox-nixCfg.url = "github:DivitMittal/firefox-nixCfg";
};
outputs = { self, nixpkgs, home-manager, firefox-nixCfg, ... }: {
homeConfigurations.your-user = home-manager.lib.homeManagerConfiguration {
pkgs = nixpkgs.legacyPackages.x86_64-linux; # Or your system
modules = [
## Import the module
firefox-nixCfg.homeManagerModules.default
## Your other modules
./home.nix
];
};
};
}
Then, enable it in your home.nix
:
## home.nix
{
programs.firefox-nixCfg = {
enable = true;
## Optionally enable Tridactyl support
enableTridactyl = true;
## Optionally specify a custom Firefox package
package = pkgs.firefox-bin;
};
}
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.