Anyone using `firefox-gnome-theme` successfully with NixOS / home-manager?

Now that GNOME 42’s out and Firefox is looking even more out of place on GNOME, I’m keen to try out this theme:

Just curious whether anyone else has already got an example of getting this working with the nixpkgs firefox package declaratively?

I don’t use GNOME anymore (Wayfire FTW :)), but when I was, I also used that theme for Firefox (managed by home-manager). This was a couple of years ago, but the relevant section in my home.nix was:

# Add Firefox GNOME theme directory
home.file."firefox-gnome-theme" = {
      target = ".mozilla/firefox/default/chrome/firefox-gnome-theme";
      source = (fetchTarball "https://github.com/rafaelmardojai/firefox-gnome-theme/archive/master.tar.gz");
};

programs.firefox = {
      enable = true;
      profiles.default = {
         name = "Default";
         settings = {
            "extensions.activeThemeID" = "firefox-compact-dark@mozilla.org";

            # For Firefox GNOME theme:
            "toolkit.legacyUserProfileCustomizations.stylesheets" = true;
            "browser.tabs.drawInTitlebar" = true;
            "svg.context-properties.content.enabled" = true;
         };
         userChrome = ''
            @import "firefox-gnome-theme/userChrome.css";
            @import "firefox-gnome-theme/theme/colors/dark.css"; 
         '';
      };
   };

Nice one, this looks like what I’m after, thanks for sharing!

I’m using flakes these days, so rather than using fetchTarball I might fetch the theme src as a flake input so I can lock it and update it that way.

@mindtree Could you please share your flake setup once you got it working?

1 Like

Here’s my config :wink:
(better late than never)

flake.nix

inputs = {
  firefox-gnome-theme = { url = "github:rafaelmardojai/firefox-gnome-theme"; flake = false; };
};

browsers.nix (some file imported by home-manager)

home.file.".mozilla/firefox/nix-user-profile/chrome/firefox-gnome-theme".source = inputs.firefox-gnome-theme;

programs.firefox.profiles.nix-user-profile = {
  userChrome = ''
    @import "firefox-gnome-theme/userChrome.css";
  '';
  userContent = ''
    @import "firefox-gnome-theme/userContent.css";
  '';
  settings = {
    ## Firefox gnome theme ## - https://github.com/rafaelmardojai/firefox-gnome-theme/blob/7cba78f5216403c4d2babb278ff9cc58bcb3ea66/configuration/user.js
    # (copied into here because home-manager already writes to user.js)
    "toolkit.legacyUserProfileCustomizations.stylesheets" = true; # Enable customChrome.cs
    "browser.uidensity" = 0; # Set UI density to normal
    "svg.context-properties.content.enabled" = true; # Enable SVG context-propertes
    "browser.theme.dark-private-windows" = false; # Disable private window dark theme
  };
};

(be sure to replace nix-user-profile with your profile name)

2 Likes