Added a module to configure browser based on the gecko engine, such as Firefox.
This module should provide similar functionality to the firefox module in home-manager. Some notable differences between the two include: * home-manager configures a single browser. This means that any configuration that cannot be done on a per-profile basis is shared between all profiles. This module configures a new copy of the browser for every profile, ensuring that *all* configuration can be on a per-profile basis. This might be seen as insanity in a regular distro, but in NixOS this is trivial to do and requires no extra storage space. * home-manager modifies files in the user's directory to configure things such as extensions and search engines. This module avoids that when possible by pushing configuration into policies and preferences at a browser level. This is much nicer for impermanence-based systems.
This commit is contained in:
parent
977595f7e8
commit
0f0c4c7727
10 changed files with 962 additions and 1 deletions
49
modules/home-manager/gecko-browser/gecko-lib/prefs.nix
Normal file
49
modules/home-manager/gecko-browser/gecko-lib/prefs.nix
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
{
|
||||
pkgs,
|
||||
lib,
|
||||
info,
|
||||
...
|
||||
}:
|
||||
|
||||
let
|
||||
type = lib.types.attrsOf (
|
||||
lib.types.oneOf [
|
||||
lib.types.int
|
||||
lib.types.bool
|
||||
lib.types.str
|
||||
]
|
||||
);
|
||||
in
|
||||
{
|
||||
inherit type;
|
||||
|
||||
options = {
|
||||
prefs = lib.mkOption {
|
||||
inherit type;
|
||||
default = { };
|
||||
description = "User preferences.";
|
||||
};
|
||||
|
||||
lockPref = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = false;
|
||||
example = true;
|
||||
description = "When adding user preferences, determine whether to use lockPref over user_pref";
|
||||
};
|
||||
};
|
||||
|
||||
postprocess =
|
||||
{ lockPref, prefs, ... }:
|
||||
{
|
||||
prefs =
|
||||
builtins.concatStringsSep "\n"
|
||||
<| (x: [ "// Generated by ${info.name} module" ] ++ x)
|
||||
<| lib.mapAttrsToList (
|
||||
let
|
||||
prefFunc = if lockPref then "lockPref" else "user_pref";
|
||||
in
|
||||
key: val: ''${prefFunc}("${key}", ${builtins.toJSON val});''
|
||||
)
|
||||
<| prefs;
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue