diff options
author | Tim Keller <tjk@tjkeller.xyz> | 2025-08-30 12:31:28 -0500 |
---|---|---|
committer | Tim Keller <tjk@tjkeller.xyz> | 2025-08-30 12:31:28 -0500 |
commit | 9da942ba47d34210e86a1a709e802eda5c3b95db (patch) | |
tree | f7434c4b4c9b8e5271220c11f9b802815c3519c7 /home-manager/firefox.nix | |
parent | c3c3d6f1fd19a5da015c9a9d3ae5c54f2d177be0 (diff) | |
download | nixos-9da942ba47d34210e86a1a709e802eda5c3b95db.tar.xz nixos-9da942ba47d34210e86a1a709e802eda5c3b95db.zip |
refactor users activation. refactor home manager config to match nixos conf and move tjkeller archetypes to users/timmy. update many of the exising home manager configs to be nicer and better organized. profile archetypes now include homeconfigs which can be enabled per user, and are setup using a new mkProfileArchetype function.
Diffstat (limited to 'home-manager/firefox.nix')
-rw-r--r-- | home-manager/firefox.nix | 159 |
1 files changed, 83 insertions, 76 deletions
diff --git a/home-manager/firefox.nix b/home-manager/firefox.nix index 8aa1af3..811b811 100644 --- a/home-manager/firefox.nix +++ b/home-manager/firefox.nix @@ -1,82 +1,89 @@ -{ lib, pkgs, userDetails, ... }: { - programs.firefox = { - enable = lib.mkDefault true; - arkenfox.enable = true; - profiles = let - search = { - engines = { - "Timmy Search" = { - urls = [{ - template = "https://search.tjkeller.xyz/search"; - params = [ { name = "q"; value = "{searchTerms}"; } ]; - }]; - iconURI = "https://search.tjkeller.xyz/static/themes/simple/img/favicon.svg"; # TODO doesn't seem to work - }; - "Nix Packages" = { - urls = [{ - template = "https://search.nixos.org/packages"; - params = [ { name = "query"; value = "{searchTerms}"; } ]; - }]; - icon = "${pkgs.nixos-icons}/share/icons/hicolor/scalable/apps/nix-snowflake.svg"; - definedAliases = [ "@np" ]; - }; - "NixOS Options" = { - urls = [{ - template = "https://search.nixos.org/options"; - params = [ { name = "query"; value = "{searchTerms}"; } ]; - }]; - icon = "${pkgs.nixos-icons}/share/icons/hicolor/scalable/apps/nix-snowflake.svg"; - definedAliases = [ "@no" ]; - }; - }; - default = "Timmy Search"; - privateDefault = "Timmy Search"; - force = true; # Overwrite old - }; - userChrome = builtins.readFile ./resources/firefox/userChrome.css; - arkenfox = { - enable = true; - enableAllSections = true; - "0100"."0102"."browser.startup.page".value = 3; # 0=blank, 1=home, 2=last visited page, 3=resume previous session - "0100"."0103"."browser.startup.homepage".enable = false; - "0100"."0104"."browser.newtabpage.enabled".enable = false; - #"2800"."2811"."privacy.clearOnShutdown.history".enable = false; - }; - settings = { - "browser.compactmode.show" = true; - "browser.uiCustomization.state" = builtins.readFile ./resources/firefox/uiCustomization.json; # Toolbar etc. - "browser.uidensity" = 1; # Compact - "toolkit.legacyUserProfileCustomizations.stylesheets" = true; # userchrome - - "app.normandy.first_run" = false; - "browser.aboutConfig.showWarning" = false; # arkenfox does - #"browser.download.dir" = userDetails.userDirs.downloads; - "browser.newtabpage.activity-stream.feeds.section.topstories" = false; - "browser.newtabpage.activity-stream.feeds.topsites" = false; - "browser.urlbar.suggest.topsites" = false; - "devtools.toolbox.host" = "window"; - "dom.push.enabled" = false; # - "extensions.pocket.enabled" = false; - "general.smoothScroll" = false; +{ config, lib, pkgs, ... }: let + cfg = config.programs.firefox; + search = { + engines = { + "Timmy Search" = { + urls = [{ + template = "https://search.tjkeller.xyz/search"; + params = [ { name = "q"; value = "{searchTerms}"; } ]; + }]; + iconURI = "https://search.tjkeller.xyz/static/themes/simple/img/favicon.svg"; # TODO doesn't seem to work }; - workSettings = settings // { - "extensions.activeThemeID" = "firefox-compact-dark@mozilla.org"; # Use builtin dark theme instead of system theme + "Nix Packages" = { + urls = [{ + template = "https://search.nixos.org/packages"; + params = [ { name = "query"; value = "{searchTerms}"; } ]; + }]; + icon = "${pkgs.nixos-icons}/share/icons/hicolor/scalable/apps/nix-snowflake.svg"; + definedAliases = [ "@np" ]; }; - in { - Personal = { - id = 0; - isDefault = true; - inherit search; - inherit userChrome; - inherit arkenfox; - inherit settings; + "NixOS Options" = { + urls = [{ + template = "https://search.nixos.org/options"; + params = [ { name = "query"; value = "{searchTerms}"; } ]; + }]; + icon = "${pkgs.nixos-icons}/share/icons/hicolor/scalable/apps/nix-snowflake.svg"; + definedAliases = [ "@no" ]; }; - Work = { - id = 1; - inherit search; - inherit userChrome; - inherit arkenfox; - settings = workSettings; + }; + default = "Timmy Search"; + privateDefault = "Timmy Search"; + force = true; # Overwrite old + }; + userChrome = builtins.readFile ./resources/firefox/userChrome.css; + arkenfox = { + enable = true; + enableAllSections = true; + "0100"."0102"."browser.startup.page".value = 3; # 0=blank, 1=home, 2=last visited page, 3=resume previous session + "0100"."0103"."browser.startup.homepage".enable = false; + "0100"."0104"."browser.newtabpage.enabled".enable = false; + #"2800"."2811"."privacy.clearOnShutdown.history".enable = false; + }; + settings = { + "browser.compactmode.show" = true; + "browser.uiCustomization.state" = builtins.readFile ./resources/firefox/uiCustomization.json; # Toolbar etc. + "browser.uidensity" = 1; # Compact + "toolkit.legacyUserProfileCustomizations.stylesheets" = true; # userchrome + + "app.normandy.first_run" = false; + "browser.aboutConfig.showWarning" = false; # arkenfox does + #"browser.download.dir" = userDetails.userDirs.downloads; + "browser.newtabpage.activity-stream.feeds.section.topstories" = false; + "browser.newtabpage.activity-stream.feeds.topsites" = false; + "browser.urlbar.suggest.topsites" = false; + "devtools.toolbox.host" = "window"; + "dom.push.enabled" = false; # + "extensions.pocket.enabled" = false; + "general.smoothScroll" = false; + }; + workSettings = settings // { + "extensions.activeThemeID" = "firefox-compact-dark@mozilla.org"; # Use builtin dark theme instead of system theme + }; +in { + options.programs.firefox = { + _configure = lib.mkEnableOption "configure firefox profiles"; + }; + + config = lib.mkIf cfg._configure { + programs.firefox = { + enable = lib.mkDefault true; + arkenfox.enable = lib.mkDefault true; + profiles = { + Personal = { + id = 0; + isDefault = true; + inherit search; + inherit userChrome; + inherit arkenfox; + inherit settings; + }; + Work = { + id = 1; + inherit search; + inherit userChrome; + inherit arkenfox; + settings = workSettings; + }; }; }; }; |