home/himalaya: fix himz script

This commit is contained in:
Dmitriy Pleshevskiy 2022-09-04 22:26:19 +03:00
parent 58bd85641a
commit e0b741bf65
Signed by: pleshevskiy
GPG key ID: 1B59187B161C0215
3 changed files with 15 additions and 13 deletions

View file

@ -5,20 +5,24 @@ with lib;
let
cfg = config.progs.himalaya;
himz = with pkgs; stdenv.mkDerivation {
name = "himz-0.1";
himz = with pkgs; stdenv.mkDerivation rec {
pname = "himz";
version = "2022-09-04";
src = ../../scripts;
nativeBuildInputs = [ makeWrapper ];
installPhase = ''
runHook preInstall
wrapperPath = makeBinPath [ w3m fzf ];
installPhase = ''
mkdir -p $out/bin
cp himz $out/bin/himz
wrapProgram "$out/bin/himz" --prefix PATH : "$out/bin:${lib.makeBinPath [ w3m fzf ]}"
'';
runHook postInstall
postFixup = ''
# Ensure all dependencies are in PATH
wrapProgram $out/bin/himz \
--prefix PATH : "${wrapperPath}"
'';
};
in
@ -35,7 +39,7 @@ in
home.packages = [ himz ];
programs.himalaya = {
enable = true;
package = pkgs.my-himalaya;
package = pkgs.himalaya-fixed;
settings = {
default-page-size = 20;
downloads-dir = "${config.home.homeDirectory}/downloads/email";

View file

@ -1,5 +1,5 @@
final: prev: {
my-himalaya = prev.himalaya.overrideAttrs (oldAttrs: rec {
himalaya-fixed = prev.himalaya.overrideAttrs (oldAttrs: rec {
src = prev.fetchFromGitHub {
owner = "pleshevskiy";
repo = "himalaya";

View file

@ -16,10 +16,8 @@ function accounts() {
function emails() {
if [ "$#" != "0" ]; then
local acc=$1
local size=${2-50}
local w3m_cmd="w3m ${w3m_opts[@]}"
local HIM_CMD="himalaya $himalaya_opts -a $acc list -s $size -w 150"
local W3M_CMD="w3m ${w3m_opts[@]}"
local HIM_CMD="himalaya $himalaya_opts -a $acc list -w 150"
local selected=$(
FZF_DEFAULT_COMMAND="$HIM_CMD | grep '│'" \
fzf --exit-0 --ansi --layout=reverse \
@ -29,7 +27,7 @@ function emails() {
res=\$(himalaya $himalaya_opts -a $acc read -t html {1});
echo \$res | head -n 2;
echo -e "\\\\n\===============================================================================\\\\n";
echo \$res | tail -n +3 | ${w3m_cmd}
echo \$res | tail -n +3 | ${W3M_CMD}
" \
--preview-window=down,70% \
--bind='ctrl-r:reload(eval $FZF_DEFAULT_COMMAND)'