-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfirefox.nix
64 lines (56 loc) · 1.66 KB
/
firefox.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
{ pkgs, config, lib, ... }:
let
inherit (lib) getExe mkIf mkMerge mkOption pipe;
inherit (lib.types) bool;
cfg = config.aquaris.firefox;
package = pipe pkgs.firefox [
(x: if !cfg.cleanHome then x else
x.overrideAttrs (old: {
buildCommand = old.buildCommand + ''
mv $out/bin/{firefox,.firefox-env}
makeWrapper \
${getExe pkgs.boxxy} \
$out/bin/firefox \
--add-flags --rule='~/.mozilla:~/.local/share/mozilla:directory' \
--add-flags $out/bin/.firefox-env
'';
}))
(x: x.override { cfg.speechSynthesisSupport = cfg.speechSynth; })
];
in
{
options.aquaris.firefox = {
enable = mkOption {
description = "Enable Firefox";
type = bool;
default = false;
};
cleanHome = mkOption {
description = "Move ~/.mozilla to ~/.local/share/mozilla";
type = bool;
default = false;
};
speechSynth = mkOption {
description = "Enable speech synthesis support";
type = bool;
default = false;
};
};
config = mkIf cfg.enable (mkMerge [
{
programs.firefox = {
enable = true;
inherit package;
};
}
(mkIf cfg.cleanHome {
assertions = [{
assertion = false;
message = "home-manager: aquaris.firefox.cleanHome is currently broken!";
}];
# TODO also move files of declarative firefox profiles
home.file.".mozilla/native-messaging-hosts".target =
".local/share/mozilla/native-messaging-hosts";
})
]);
}