diff options
author | Vincent Ambo <tazjin@google.com> | 2019-12-19T14·48+0000 |
---|---|---|
committer | Vincent Ambo <tazjin@google.com> | 2019-12-19T14·48+0000 |
commit | c1a5d7d62ac8c79e00a82d5d09f04a9b9aae2ff4 (patch) | |
tree | ef2b8eea4ee990ab0aa36d13864e38cd359b0d12 | |
parent | 166aff23bcffc2afa5ca5ac475f5866b759be443 (diff) |
feat(emacs): Add telega.el support r/199
Packages the telega-server binary and adds the required mode into Emacs. Unread message count is displayed in the modeline, which is neat. Probably need to figure out some key bindings for this.
-rw-r--r-- | third_party/default.nix | 1 | ||||
-rw-r--r-- | third_party/telega/default.nix | 22 | ||||
-rw-r--r-- | tools/emacs/config/init.el | 1 | ||||
-rw-r--r-- | tools/emacs/default.nix | 6 |
4 files changed, 30 insertions, 0 deletions
diff --git a/third_party/default.nix b/third_party/default.nix index 1837cf26ca20..890b1777625f 100644 --- a/third_party/default.nix +++ b/third_party/default.nix @@ -69,6 +69,7 @@ let stdenv stern symlinkJoin + tdlib terraform_0_12 thttpd tree diff --git a/third_party/telega/default.nix b/third_party/telega/default.nix new file mode 100644 index 000000000000..4fdf0667ff9f --- /dev/null +++ b/third_party/telega/default.nix @@ -0,0 +1,22 @@ +# Telega is an Emacs client for Telegram. It requires a native server +# component to run correctly, which is built by this derivation. +{ pkgs, ... }: + +with pkgs.third_party; + +stdenv.mkDerivation { + name = "telega"; + buildInputs = [ tdlib ]; + + src = fetchFromGitHub { + owner = "zevlg"; + repo = "telega.el"; + rev = "d532b16067cf24728a2aa03a7aeaebe2ceac7df4"; + sha256 = "1s2sd07sin9sy833wqprhbfk5j1d1s4azzvj6d8k68sxlgz8996m"; + } + "/server"; + + installPhase = '' + mkdir -p $out/bin + mv telega-server $out/bin/ + ''; +} diff --git a/tools/emacs/config/init.el b/tools/emacs/config/init.el index d601efa67df9..0be9a33963bf 100644 --- a/tools/emacs/config/init.el +++ b/tools/emacs/config/init.el @@ -171,6 +171,7 @@ (use-package nix-util) (use-package nginx-mode) (use-package rust-mode) +(use-package telega :config (telega-mode-line-mode 1)) (use-package terraform-mode) (use-package toml-mode) (use-package web-mode) diff --git a/tools/emacs/default.nix b/tools/emacs/default.nix index c44403e6d692..d36673e363f4 100644 --- a/tools/emacs/default.nix +++ b/tools/emacs/default.nix @@ -11,6 +11,9 @@ let localPackages = pkgs.tools.emacs-pkgs; emacsWithPackages = (third_party.emacsPackagesNgGen third_party.emacs26).emacsWithPackages; + # $PATH for binaries that need to be available to Emacs + emacsBinPath = lib.makeBinPath [ third_party.telega ]; + identity = x: x; tazjinsEmacs = pkgfun: (emacsWithPackages(epkgs: pkgfun( # Actual ELPA packages (the enlightened!) @@ -68,6 +71,7 @@ let sly string-edit swiper + telega telephone-line terraform-mode toml-mode @@ -90,6 +94,7 @@ let term-switcher ])))); in lib.fix(self: l: f: third_party.writeShellScriptBin "tazjins-emacs" '' + export PATH="${emacsBinPath}:$PATH" exec ${tazjinsEmacs f}/bin/emacs \ --debug-init \ --no-site-file \ @@ -109,6 +114,7 @@ in lib.fix(self: l: f: third_party.writeShellScriptBin "tazjins-emacs" '' # Build a derivation that uses the specified local Emacs (i.e. # built outside of Nix) instead withLocalEmacs = emacsBin: third_party.writeShellScriptBin "tazjins-emacs" '' + export PATH="${emacsBinPath}:$PATH" export EMACSLOADPATH="${(tazjinsEmacs f).deps}/share/emacs/site-lisp:" exec ${emacsBin} \ --debug-init \ |