Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Firefox configuration tracking issue (+Thunderbird?) #606

Open
deliciouslytyped opened this issue Mar 7, 2019 · 17 comments
Open

Firefox configuration tracking issue (+Thunderbird?) #606

deliciouslytyped opened this issue Mar 7, 2019 · 17 comments
Labels
pinned Prevent marking as stale program: firefox

Comments

@deliciouslytyped
Copy link

deliciouslytyped commented Mar 7, 2019

I hope this is an appropriate place for this.
A bit of a brain dump till further notice, I've heard of people working on this but only by proxy so...:

References: [all being researched, will be cleaned later, inconsistencies likely]
Nixpkgs issues:

Upstream (firefox):

,

Note:

  • torbrowser seems to have an extraPrefs

TODO: check bugzilla (mostly relating to "autoconfig", just for starters there are some interesting things here https://bugzilla.mozilla.org/show_bug.cgi?id=1455601

Current verdict: look into "autoconfig"
keywords: autoadmin, autoconfig.jsc, failover.jsc, MCD, Autoconfig, Mission Control Desktop,

@deliciouslytyped
Copy link
Author

deliciouslytyped commented Mar 7, 2019

Autoconf:
After running across the "Mission Control Desktop" keywords here: http://forums.mozillazine.org/viewtopic.php?f=39&t=601199 I finally made some progress figuring this stuff out, which is to say, documentation seems to be extremely spotty unless you assume decade old articles from 55 versions ago are still relevant.

This is the firefox code relating to this "autoconfig" stuff https://dxr.mozilla.org/mozilla-central/source/extensions/pref/autoconfig

https://bugzilla.mozilla.org/show_bug.cgi?id=1438247
After some digging, here seems to be some relatively recent input on Autoconfig / MCD / Mission Control Desktop / ??? being officially supported, and used in large enterprises/whatever. This component seems to have a history, and https://bugzilla.mozilla.org/show_bug.cgi?id=1438247#c16 suggests it probably wont get removed immediately (?), so unless Mozilla unilaterally pulls another Quantum this seems like a viable path to (more) declarative configuration?
It also appears to be relevant to all mozilla products.

It needs to be clarified whether the new Windows Group Policy Objects based stuff will be present in parallel to MCD, or whether MCD will be phased out and removed, and we will be left with the (currently?) crippled GPO stuff.

If Autoconfig is a viable option, how stable are the firefox config APIs? Do numeric constants change? (e.g. browser.startup.page uses a numeric constant like an enum)

Bugzillas: (note these dont show closed issues, need to edit the search)
https://bugzilla.mozilla.org/buglist.cgi?product=Core&component=AutoConfig%20(Mission%20Control%20Desktop) For bugs using an AutoConfig (mozilla.cfg) file to configure Firefox or other Mozilla applications. NOT for Thunderbird Autoconfiguration.
https://bugzilla.mozilla.org/buglist.cgi?quicksearch=mcd

Note: there are mentions of LDAP support, changig these files only has results on next start of firefox (?)
TODO: prefs.js vs user.js vs autoconfig.js

@deliciouslytyped deliciouslytyped changed the title Firefox configuration tracking issue (WIP?) Firefox configuration tracking issue (+Thunderbird?) Mar 7, 2019
@deliciouslytyped
Copy link
Author

deliciouslytyped commented Mar 7, 2019

@wsmwk @mkaply can you shed some light on the above? I would very much appreciate not needing to poke in the dark. :)

I am looking for a way to do per-profile firefox configuration on linux, with tools (here: Nix) externally imposing configuration settings on firefox, say, by adding a generated "autoconfigure" file.

@xaverdh
Copy link

xaverdh commented Mar 8, 2019

A common problem with all of those options appears to be that it tries really hard to resolve configuration files relative to the real executable. That defeats the usual methods for configuration through wrapping.
The tor-browser-bundle works around this by copying the entire runtime around.
Maybe this can be done for the firefox wrapper as well?
Then we could have hooks for {policies.json,...} in the wrapper package.

I am also interested in configuring firefox through nix.

@xaverdh
Copy link

xaverdh commented Mar 9, 2019

Another possible (but rather hacky) solution for this problem is to use user namespaces and bind mounts to work around that. I have a proof of concept script here.

@deliciouslytyped
Copy link
Author

deliciouslytyped commented Mar 11, 2019

@xaverdh I must have forgotten to mention it, but because autoconf is a js file, it might be possible to just have a global autoconfig that lets you set an environment variable to load further configuration from. IIRC the documentation explicitly suggests the possibility of using env vars. Now, I don't know if this is a good idea, but it sounds like it could work well.

In analogy to the emacs stuff I've been working on, you'd have a site-start.el (a "site-specific configuration file run by emacs before the rest of its init process) that calls out to a path set in an environment variable. (also unsure whether that is a good idea, but it works as a first prototype)

@xaverdh
Copy link

xaverdh commented Mar 13, 2019

Ok, my hope is to get some more customizability into the firefox wrapper itself.
I opened NixOS/nixpkgs#57554 to get things rolling.

@mkaply
Copy link

mkaply commented Mar 13, 2019

Thunderbird policies is just not something on our radar right now. As you found, you can use autoconfig to customize thunderbird (Not to be confused with the thunderbird autoconfig server for configuring email servers).

@deliciouslytyped
Copy link
Author

Though I guess given how nix in general works, it's probably fine to have config stuff set in the firefox root because we can easily just generate new ones? and I think total rebuilds of firefox / wasting disk space could be avoided by just using symlinkJoin or something like that?

@rycee
Copy link
Member

rycee commented Mar 20, 2019

Just want to say that it is very nice of you to put some effort into Firefox configuration. At some point I had a quick look at it but gave up quite quickly 😀 I'll help in what way I can.

For what it's worth, I've added an option programs.firefox.extensions that can be used to declaratively add Firefox extensions. It's not very fancy, simply copies them to the extensions directory where Firefox will see them. Right now the only source of addon packages is from my NUR.

@deliciouslytyped
Copy link
Author

Meanwhile I just realized this might be helpful for anything else in this ecosystem like zotero. (?)

@rycee
Copy link
Member

rycee commented May 30, 2019

I just merged #719, which adds some profile handling and generation of user.js. Please have a look and see what you think. See https://rycee.gitlab.io/home-manager/options.html#opt-programs.firefox.profiles for the new options.

@deliciouslytyped
Copy link
Author

A very rough implementation for generating a string from a nested attribute set in that style:

#nix eval -f attrtostr.nix a
with import <nixpkgs> {};

#Huh, this implementation coincidentally ignores options that are empty sets.
let
  wot = {
    a = {
      b = 1;
      };
    b = 2;
    c = {};
    d = "asd";
    e.f.g = 3;
    };

  dropLeadingDot = s: builtins.substring 1 (builtins.stringLength s) s;

  typeCase = v: ifrec: ifval:
    if (builtins.typeOf v == "set")
      then ifrec
      else ifval;

    ifVal = acc: v: "${acc}=${builtins.toString v}";

  m = acc: a:
    let
      acc' = n: "${acc}.${n}";
    in
      #TODO this is a deprecated function
      lib.mapAttrsFlatten (n: v: typeCase v (m (acc' n) v) (ifVal (acc' n) v)) a;
in {
  a = lib.traceValSeq ("\n" + (lib.concatMapStringsSep "\n" dropLeadingDot (lib.flatten (m "" wot))));
  }

@deliciouslytyped
Copy link
Author

Some stuff about profile up- aand down-grades for more recent foxes: https://discourse.nixos.org/t/why-does-the-following-setup-reset-firefox/4129

I didn't really look into it.

@mestaritonttu
Copy link

How to import Firefox bookmarks without GUI: https://stackoverflow.com/a/35804955/3057764

@nh2
Copy link
Contributor

nh2 commented Jan 8, 2021

Please have a look and see what you think. See https://rycee.gitlab.io/home-manager/options.html#opt-programs.firefox.profiles for the new options.

@rycee FYI in my current .mozilla/firefox/profiles.ini there is a Version=2:

[General]
StartWithLastProfile=1
Version=2

Your generated ini currently doesn't generate that (

General = {
StartWithLastProfile = 1;
};
); I'm wondering whether it should. I couldn't find out what concrete difference it makes so far.

@deliciouslytyped
Copy link
Author

Lol how about no

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pinned Prevent marking as stale program: firefox
Projects
None yet
Development

No branches or pull requests

8 participants