1
0
Fork 0
mirror of https://github.com/nix-community/home-manager.git synced 2024-12-14 11:57:55 +00:00

firefox: add preConfig option

This option mirrors `extraConfig`, except its values are added to the
resulting `user.js` before those specified in `options`.
This commit is contained in:
bandithedoge 2024-12-11 18:17:04 +01:00
parent f26aa4b76f
commit e2cbad7366
3 changed files with 26 additions and 3 deletions

View file

@ -1899,6 +1899,17 @@ in {
registry with the option 'programs.nushell.plugins'.
'';
}
{
time = "2024-12-11T18:32+00:00";
condition = config.programs.firefox.enable;
message = ''
The Firefox module now provides a
`programs.firefox.profiles.<name>.preConfig` option that allows an
arbitrary string to be added to `user.js` *before* the options
specified in `programs.firefox.profiles.<name>.settings`.
'';
}
];
};
}

View file

@ -75,7 +75,7 @@ let
else
builtins.toJSON pref);
mkUserJs = prefs: extraPrefs: bookmarks:
mkUserJs = prefs: prePrefs: extraPrefs: bookmarks:
let
prefs' = lib.optionalAttrs ([ ] != bookmarks) {
"browser.bookmarks.file" = toString (browserBookmarksFile bookmarks);
@ -84,6 +84,8 @@ let
in ''
// Generated by Home Manager.
${prePrefs}
${concatStrings (mapAttrsToList (name: value: ''
user_pref("${name}", ${userPrefValue value});
'') prefs')}
@ -406,6 +408,14 @@ in {
'';
};
preConfig = mkOption {
type = types.lines;
default = "";
description = ''
Extra preferences to add to {file}`user.js` before those specified in `settings`.
'';
};
userChrome = mkOption {
type = types.lines;
default = "";
@ -770,8 +780,8 @@ in {
"${profilesPath}/${profile.path}/user.js" = mkIf (profile.settings != { }
|| profile.extraConfig != "" || profile.bookmarks != [ ]) {
text =
mkUserJs profile.settings profile.extraConfig profile.bookmarks;
text = mkUserJs profile.settings profile.preConfig profile.extraConfig
profile.bookmarks;
};
"${profilesPath}/${profile.path}/containers.json" =

View file

@ -1,5 +1,7 @@
// Generated by Home Manager.
user_pref("browser.newtabpage.pinned", "[{\"title\":\"NixOS\",\"url\":\"https://nixos.org\"}]");
user_pref("general.smoothScroll", false);