forked from
lass.pds.lassul.us/superconfig
This repository has no description
1.8 kB
62 lines
1{ self, ... }:
2{
3 perSystem =
4 {
5 pkgs,
6 lib,
7 system,
8 ...
9 }:
10 let
11 tridactylrc = ./tridactylrc;
12
13 workspaceTabsExtension = self.packages.${system}.workspace-tabs-extension;
14
15 firefoxBase = pkgs.wrapFirefox pkgs.firefox-devedition-unwrapped {
16 nativeMessagingHosts = [
17 pkgs.tridactyl-native
18 self.packages.${system}.workspace-tabs-native-host
19 ];
20 extraPolicies = {
21 Extensions.Install = [
22 "${workspaceTabsExtension}/workspace-tabs@workspace-manager.xpi"
23 ];
24 };
25 extraPrefsFiles = [
26 (pkgs.writeText "workspace-tabs-prefs.js" ''
27 lockPref("xpinstall.signatures.required", false);
28 lockPref("browser.startup.page", 0);
29 lockPref("browser.sessionstore.resume_from_crash", false);
30 '')
31 ];
32 };
33
34 # Wrapper that sets up tridactylrc symlink before starting Firefox
35 firefox = pkgs.writeShellScriptBin "firefox" ''
36 # Tridactyl config setup
37 config_dir="$HOME/.config/tridactyl"
38 config_file="$config_dir/tridactylrc"
39 repo_config="$HOME/src/superconfig/tools/firefox/tridactylrc"
40 store_config="${tridactylrc}"
41
42 mkdir -p "$config_dir"
43
44 # Prefer repo version if it exists, otherwise use store version
45 if [[ -f "$repo_config" ]]; then
46 target="$repo_config"
47 else
48 target="$store_config"
49 fi
50
51 # Update symlink if needed
52 if [[ ! -L "$config_file" ]] || [[ "$(readlink "$config_file")" != "$target" ]]; then
53 ln -sf "$target" "$config_file"
54 fi
55
56 exec ${lib.getExe firefoxBase} "$@"
57 '';
58 in
59 {
60 packages.firefox = firefox;
61 };
62}