From 001cb2e91d0927b176fcfc135ccf819a42b6cc22 Mon Sep 17 00:00:00 2001 From: Sridhar Ratnakumar Date: Tue, 13 Apr 2021 00:39:55 -0400 Subject: [PATCH] Install himalaya vim plugin --- features/email/default.nix | 2 +- ...{himalaya-client.nix => himalaya-workflow.nix} | 15 +++------------ features/email/himalaya.nix | 10 ++++++++++ flake.lock | 8 ++++---- flake.nix | 7 +++++-- home.nix | 14 ++++++++++++-- 6 files changed, 35 insertions(+), 21 deletions(-) rename features/email/{himalaya-client.nix => himalaya-workflow.nix} (56%) create mode 100644 features/email/himalaya.nix diff --git a/features/email/default.nix b/features/email/default.nix index 84ab4a4..9b139cc 100644 --- a/features/email/default.nix +++ b/features/email/default.nix @@ -1,6 +1,6 @@ { pkgs, ... }: { imports = [ ./protonmail-bridge.nix - ./himalaya-client.nix + ./himalaya-workflow.nix ]; } diff --git a/features/email/himalaya-client.nix b/features/email/himalaya-workflow.nix similarity index 56% rename from features/email/himalaya-client.nix rename to features/email/himalaya-workflow.nix index ee9ea50..a35ee8e 100644 --- a/features/email/himalaya-client.nix +++ b/features/email/himalaya-workflow.nix @@ -1,23 +1,14 @@ { pkgs, lib, system, inputs, ... }: -let - himalaya = inputs.himalaya.outputs.defaultPackage.${system}; -in { environment.systemPackages = let - # Wrap himalaya to be aware of ProtonMail's bridge cert. - himalayaWithSslEnv = - pkgs.writeScriptBin "h" '' - #!${pkgs.stdenv.shell} - export SSL_CERT_FILE=~/.config/protonmail/bridge/cert.pem - exec ${himalaya}/bin/himalaya $* - ''; + himalaya = import ./himalaya.nix { inherit pkgs system inputs; }; # Helper to read and display the (HTML) email message in Markdown, # highlighted with pager. himalayaReadMail = pkgs.writeScriptBin "h-read" '' #!${pkgs.stdenv.shell} - ${himalayaWithSslEnv}/bin/h read $* \ + ${himalaya}/bin/himalaya read $* \ | ${pkgs.pandoc}/bin/pandoc -f html -t markdown_strict \ | ${pkgs.bat}/bin/bat -l md ''; @@ -25,7 +16,7 @@ in # - `h move` with fzf-selector for target folder in [ - himalayaWithSslEnv + himalaya # Helpers himalayaReadMail ]; diff --git a/features/email/himalaya.nix b/features/email/himalaya.nix new file mode 100644 index 0000000..6bbd6e5 --- /dev/null +++ b/features/email/himalaya.nix @@ -0,0 +1,10 @@ +{ pkgs, system, inputs, ... }: +let + himalaya = inputs.himalaya.outputs.defaultPackage.${system}; +in +# Wrap himalaya to be aware of ProtonMail's bridge cert. +pkgs.writeScriptBin "himalaya" '' + #!${pkgs.stdenv.shell} + export SSL_CERT_FILE=~/.config/protonmail/bridge/cert.pem + exec ${himalaya}/bin/himalaya $* +'' diff --git a/flake.lock b/flake.lock index 8a861c6..45d3646 100644 --- a/flake.lock +++ b/flake.lock @@ -167,17 +167,17 @@ }, "nixpkgs_4": { "locked": { - "lastModified": 1618072958, - "narHash": "sha256-QDKj58ECixtb4EJMWV5D5Lb2xdCgab1Opi4zjQWbDOg=", + "lastModified": 1618260938, + "narHash": "sha256-sRIKbJKplnAY9uN4QGGVtq4dasRKzmZhjleCUtPvTa8=", "owner": "nixos", "repo": "nixpkgs", - "rev": "a73020b2a150322c9832b50baeb0296ba3b13dd7", + "rev": "e8893cc489de8ffbe8125fb0d37f05e8023a2d99", "type": "github" }, "original": { "owner": "nixos", "repo": "nixpkgs", - "rev": "a73020b2a150322c9832b50baeb0296ba3b13dd7", + "rev": "e8893cc489de8ffbe8125fb0d37f05e8023a2d99", "type": "github" } }, diff --git a/flake.nix b/flake.nix index d5570d5..2fb418c 100644 --- a/flake.nix +++ b/flake.nix @@ -6,7 +6,7 @@ # https://status.nixos.org/ # # This ensures that we always use the official # cache. - nixpkgs.url = "github:nixos/nixpkgs/a73020b2a150322c9832b50baeb0296ba3b13dd7"; + nixpkgs.url = "github:nixos/nixpkgs/e8893cc489de8ffbe8125fb0d37f05e8023a2d99"; nixos-hardware.url = github:NixOS/nixos-hardware/master; home-manager.url = "github:nix-community/home-manager"; @@ -38,7 +38,10 @@ { home-manager.useGlobalPkgs = true; home-manager.useUserPackages = true; - home-manager.users.srid = import ./home.nix; + home-manager.users.srid = import ./home.nix { + inherit inputs system; + pkgs = import nixpkgs { inherit system; }; + }; } ] ++ extraModules); }; diff --git a/home.nix b/home.nix index 959ea5c..c05e4be 100644 --- a/home.nix +++ b/home.nix @@ -1,8 +1,9 @@ -{ config, pkgs, ... }: - +{ pkgs, inputs, system, ... }: let nix-thunk = (import (builtins.fetchTarball "https://github.com/obsidiansystems/nix-thunk/archive/master.tar.gz") { }).command; + himalayaSrc = inputs.himalaya; + himalaya = import ./features/email/himalaya.nix { inherit pkgs inputs system; }; in { # Let Home Manager install and manage itself. @@ -73,8 +74,16 @@ in vimAlias = true; # withNodeJs = true; + extraPackages = [ + himalaya + ]; + plugins = with pkgs.vimPlugins; [ vim-nix + (pkgs.vimUtils.buildVimPlugin { + name = "himalaya"; + src = himalayaSrc + "/vim"; + }) ]; }; @@ -84,6 +93,7 @@ in g = "git"; t = "tig"; l = "ls --color=always"; + h = "${himalaya}/bin/himalaya"; }; };