From b7b56fdb9888ba162ba7dc2f34e5f40660f3a993 Mon Sep 17 00:00:00 2001 From: Alexander Bantyev Date: Tue, 7 Feb 2023 17:00:04 +0400 Subject: [PATCH] Switch to tridactyl --- flake.lock | 19 ++++++++++++++++++- flake.nix | 10 +++++++--- profiles/applications/firefox.nix | 29 +++++++++++++++++++++++++++-- 3 files changed, 52 insertions(+), 6 deletions(-) diff --git a/flake.lock b/flake.lock index e786aeb..2f78acf 100644 --- a/flake.lock +++ b/flake.lock @@ -1022,7 +1022,8 @@ "rycee": "rycee", "simple-nixos-mailserver": "simple-nixos-mailserver", "simple-osd-daemons": "simple-osd-daemons", - "sonoff-lan": "sonoff-lan" + "sonoff-lan": "sonoff-lan", + "tridactyl-native-messenger": "tridactyl-native-messenger" } }, "rust-overlay": { @@ -1150,6 +1151,22 @@ "type": "github" } }, + "tridactyl-native-messenger": { + "flake": false, + "locked": { + "lastModified": 1663952229, + "narHash": "sha256-YGDVcfFcI9cRCCZ4BrO5xTuI9mrGq1lfbEITB7o3vQQ=", + "owner": "tridactyl", + "repo": "native_messenger", + "rev": "62f19dba573b924703829847feb1bfee68885514", + "type": "github" + }, + "original": { + "owner": "tridactyl", + "repo": "native_messenger", + "type": "github" + } + }, "utils": { "locked": { "lastModified": 1667395993, diff --git a/flake.nix b/flake.nix index 7dc6276..7ea192a 100644 --- a/flake.nix +++ b/flake.nix @@ -99,6 +99,12 @@ remapper.url = "github:balsoft/remapper"; helix.url = "github:helix-editor/helix"; + + tridactyl-native-messenger = { + url = "github:tridactyl/native_messenger"; + flake = false; + }; + }; outputs = { nixpkgs, self, nix, deploy-rs, ... }@inputs: @@ -119,9 +125,7 @@ import inputs.nixpkgs { overlays = [ self.overlay ]; localSystem = { inherit system; }; - config = { - android_sdk.accept_license = true; - }; + config = { android_sdk.accept_license = true; }; }; in { nixosModules = builtins.listToAttrs (findModules ./modules); diff --git a/profiles/applications/firefox.nix b/profiles/applications/firefox.nix index 8aaf4ed..2ff8d47 100644 --- a/profiles/applications/firefox.nix +++ b/profiles/applications/firefox.nix @@ -1,4 +1,4 @@ -{ config, pkgs, lib, ... }: +{ config, pkgs, lib, inputs, ... }: let thm = pkgs.my-lib.thmHash config.themes.colors; fonts = config.themes.fonts; @@ -42,6 +42,31 @@ in { ]; }; + home.file.".mozilla/native-messaging-hosts/tridactyl.json".text = let + tridactyl = with pkgs.nimPackages; buildNimPackage { + pname = "tridactyl_native"; + version = "dev"; + nimBinOnly = true; + src = inputs.tridactyl-native-messenger; + buildInputs = [ tempfile ]; + }; + in builtins.toJSON { + name = "tridactyl"; + description = "Tridactyl native command handler"; + path = "${tridactyl}/bin/native_main"; + type = "stdio"; + + allowed_extensions = [ + "tridactyl.vim@cmcaine.co.uk" + "tridactyl.vim.betas@cmcaine.co.uk" + "tridactyl.vim.betas.nonewtab@cmcaine.co.uk" + ]; + }; + + xdg.configFile."tridactyl/tridactylrc".text = '' + js tri.config.set("editorcmd", "alacritty -e hx") + ''; + programs.firefox = { enable = true; package = pkgs.firefox-wayland; @@ -115,7 +140,7 @@ in { adsum-notabs ublock-origin browserpass - vimium-c + tridactyl ]; }; };