This repository has no description
1.1 kB
41 lines
1{
2 perSystem =
3 { pkgs, ... }:
4 let
5 tridactylrc = ./tridactylrc;
6
7 firefoxBase = pkgs.wrapFirefox pkgs.firefox-unwrapped {
8 nativeMessagingHosts = [
9 pkgs.tridactyl-native
10 ];
11 };
12
13 # Wrapper that sets up tridactylrc symlink before starting Firefox
14 firefox = pkgs.writeShellScriptBin "firefox" ''
15 # Tridactyl config setup
16 config_dir="$HOME/.config/tridactyl"
17 config_file="$config_dir/tridactylrc"
18 repo_config="$HOME/src/superconfig/tools/firefox/tridactylrc"
19 store_config="${tridactylrc}"
20
21 mkdir -p "$config_dir"
22
23 # Prefer repo version if it exists, otherwise use store version
24 if [[ -f "$repo_config" ]]; then
25 target="$repo_config"
26 else
27 target="$store_config"
28 fi
29
30 # Update symlink if needed
31 if [[ ! -L "$config_file" ]] || [[ "$(readlink "$config_file")" != "$target" ]]; then
32 ln -sf "$target" "$config_file"
33 fi
34
35 exec ${firefoxBase}/bin/firefox "$@"
36 '';
37 in
38 {
39 packages.firefox = firefox;
40 };
41}