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 global config not working #67117

Closed
Qubasa opened this issue Aug 20, 2019 · 2 comments
Closed

firefox global config not working #67117

Qubasa opened this issue Aug 20, 2019 · 2 comments
Labels
0.kind: bug Something is broken

Comments

@Qubasa
Copy link
Contributor

Qubasa commented Aug 20, 2019

Describe the bug
I tried to get a global firefox config to work. Mozilla says here https://developer.mozilla.org/en-US/docs/Mozilla/Firefox/Enterprise_deployment_before_60 that a file has to be placed to firefox-unwrapped/lib/firefox/defaults/pref/autoconfig.js or firefox-unwrapped/lib/firefox/defaults/pref/channel-prefs.js and firefox-unwrapped/lib/firefox/mozilla.cfg.

To achieve that I needed to write these files into another derivation and symlink everything else (except firefox-unwrapped/bin/firefox which has been re-wrapped). After successfully doing so it still doesn't load the config files.

{ config, pkgs, ... }:

let


myFirefox = pkgs.runCommand "myfirefox" {
  buildInputs = [ pkgs.makeWrapper pkgs.xorg.lndir ];
} ''

mkdir $out

# Link every top-level folder from pkgs.hello to our new target
lndir -silent ${pkgs.firefox-unwrapped} $out

# Except the bin folder
rm -r $out/bin
mkdir $out/bin

makeWrapper $out/lib/firefox/firefox $out/bin/firefox \
  --add-flags "-t"

mkdir -p $out/lib/firefox/browser/defaults/preferences
 mkdir -p $out/lib/firefox/defaults/pref
 mkdir -p $out/bin

# Generate autoconfig.js for firefox v61+
echo '// Any comment. You must start the file with a single-line comment!
pref("general.config.filename", "mozilla.cfg");
pref("general.config.obscure_value", 0);
' > "$out/lib/firefox//browser/defaults/preferences/autoconfig.js"

rm $out/lib/firefox/defaults/pref/channel-prefs.js
# Generate autoconfig.js for firefox v60-
echo '// Any comment. You must start the file with a single-line comment!
pref("general.config.filename", "mozilla.cfg");
pref("general.config.obscure_value", 0);
pref("app.update.channel", "test");
' > "$out/lib/firefox/defaults/pref/channel-prefs.js"

# Generate preference file
echo '// Any comment. You must start the file with a single-line comment!
lockPref("browser.startup.homepage", "https://youtube.com");
' > "$out/lib/firefox/mozilla.cfg"

'';


# firefox_config = pkgs.writeText "auto" ''


# '';

in {


# system.activationScripts.copyConfig = ''
# '';


environment.systemPackages = with pkgs; [
  myFirefox
  ];
}

I think to address this issue there has to be an option in the firefox package that is overridable with the config a user wants that places the config file directly into the firefox derivation.

Or a firefox patch that enable absolute paths for the config.

Metadata

  • system: "x86_64-linux"
  • host os: Linux 4.19.64, NixOS, 19.03.173251.56d94c8c69f (Koi)
  • multi-user?: yes
  • sandbox: yes
  • version: nix-env (Nix) 2.2.2
  • channels(root): "nixos-19.03.173251.56d94c8c69f, nixos-unstable-19.09pre186820.bf39fc17d46"
  • nixpkgs: /nix/var/nix/profiles/per-user/root/channels/nixos
@Qubasa Qubasa added the 0.kind: bug Something is broken label Aug 20, 2019
@xaverdh
Copy link
Contributor

xaverdh commented Aug 21, 2019

See #57554 and #58195 for my attempts at implementing this.

@Qubasa
Copy link
Contributor Author

Qubasa commented Aug 21, 2019

So nice

@Qubasa Qubasa closed this as completed Aug 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0.kind: bug Something is broken
Projects
None yet
Development

No branches or pull requests

2 participants