mirror of
https://github.com/nix-community/home-manager.git
synced 2025-12-10 02:51:05 +01:00
firefox: add preConfig
Add `preConfig`, which acts like `extraConfig`, but placed before `settings`. This will allow to overwrite settings in `preConfig`, using `settings` option.
This commit is contained in:
parent
bd530df4e2
commit
0ee8bfdd04
7 changed files with 93 additions and 5 deletions
|
|
@ -1972,6 +1972,19 @@ in {
|
|||
'yazi' alias.
|
||||
'';
|
||||
}
|
||||
|
||||
{
|
||||
time = "2025-01-29T17:34:53+00:00";
|
||||
condition = config.programs.firefox.enable;
|
||||
message = ''
|
||||
The Firefox module now provides a
|
||||
'programs.firefox.profiles.<name>.preConfig' option.
|
||||
|
||||
It allows extra preferences to be added to 'user.js' before the
|
||||
options specified in 'programs.firefox.profiles.<name>.settings', so
|
||||
that they can be overwritten.
|
||||
'';
|
||||
}
|
||||
];
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -75,7 +75,7 @@ let
|
|||
else
|
||||
builtins.toJSON pref);
|
||||
|
||||
mkUserJs = prefs: extraPrefs: bookmarks:
|
||||
mkUserJs = prePrefs: prefs: 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')}
|
||||
|
|
@ -369,6 +371,20 @@ in {
|
|||
'';
|
||||
};
|
||||
|
||||
preConfig = mkOption {
|
||||
type = types.lines;
|
||||
default = "";
|
||||
description = ''
|
||||
Extra preferences to add to {file}`user.js`, before
|
||||
[](#opt-programs.firefox.profiles._name_.settings).
|
||||
|
||||
Use [](#opt-programs.firefox.profiles._name_.extraConfig), unless
|
||||
you want to overwrite in
|
||||
[](#opt-programs.firefox.profiles._name_.settings), then use this
|
||||
option.
|
||||
'';
|
||||
};
|
||||
|
||||
settings = mkOption {
|
||||
type = types.attrsOf (jsonFormat.type // {
|
||||
description =
|
||||
|
|
@ -768,10 +784,11 @@ in {
|
|||
"${profilesPath}/${profile.path}/chrome/userContent.css" =
|
||||
mkIf (profile.userContent != "") { text = profile.userContent; };
|
||||
|
||||
"${profilesPath}/${profile.path}/user.js" = mkIf (profile.settings != { }
|
||||
|| profile.extraConfig != "" || profile.bookmarks != [ ]) {
|
||||
text =
|
||||
mkUserJs profile.settings profile.extraConfig profile.bookmarks;
|
||||
"${profilesPath}/${profile.path}/user.js" = mkIf (profile.preConfig != ""
|
||||
|| profile.settings != { } || profile.extraConfig != ""
|
||||
|| profile.bookmarks != [ ]) {
|
||||
text = mkUserJs profile.preConfig profile.settings profile.extraConfig
|
||||
profile.bookmarks;
|
||||
};
|
||||
|
||||
"${profilesPath}/${profile.path}/containers.json" =
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue