Refactor the whole configuration #1
1 changed files with 13 additions and 4 deletions
|
@ -1,12 +1,21 @@
|
||||||
let
|
let
|
||||||
|
prefToString = value:
|
||||||
|
if builtins.isBool value then
|
||||||
|
if value then "true" else "false"
|
||||||
|
else if (builtins.isInt value) || (builtins.isNull value) then
|
||||||
|
builtins.toString value
|
||||||
|
else if builtins.isString value then
|
||||||
|
value
|
||||||
|
else
|
||||||
|
builtins.throw
|
||||||
|
"Pref expected one of (Bool, String, Int, Null) got instead ${builtins.typeOf value}";
|
||||||
|
|
||||||
mkPrefs = prefs: builtins.concatStringsSep
|
mkPrefs = prefs: builtins.concatStringsSep
|
||||||
"\n"
|
"\n"
|
||||||
(builtins.attrValues
|
(builtins.attrValues
|
||||||
(builtins.mapAttrs
|
(builtins.mapAttrs
|
||||||
(n: v: ''user_pref("${n}", "${v}");'') prefs));
|
(n: v: ''user_pref("${n}", "${(prefToString v)}");'') prefs));
|
||||||
in
|
in
|
||||||
mkPrefs {
|
mkPrefs {
|
||||||
prefs = {
|
"browser.urlbar.suggest.topsites" = "false";
|
||||||
"browser.urlbar.suggest.topsites" = false;
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue