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 let
cfg = config.progs.himalaya; cfg = config.progs.himalaya;
himz = with pkgs; stdenv.mkDerivation { himz = with pkgs; stdenv.mkDerivation rec {
name = "himz-0.1"; pname = "himz";
version = "2022-09-04";
src = ../../scripts; src = ../../scripts;
nativeBuildInputs = [ makeWrapper ]; nativeBuildInputs = [ makeWrapper ];
installPhase = '' wrapperPath = makeBinPath [ w3m fzf ];
runHook preInstall
installPhase = ''
mkdir -p $out/bin mkdir -p $out/bin
cp himz $out/bin/himz 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 in
@ -35,7 +39,7 @@ in
home.packages = [ himz ]; home.packages = [ himz ];
programs.himalaya = { programs.himalaya = {
enable = true; enable = true;
package = pkgs.my-himalaya; package = pkgs.himalaya-fixed;
settings = { settings = {
default-page-size = 20; default-page-size = 20;
downloads-dir = "${config.home.homeDirectory}/downloads/email"; downloads-dir = "${config.home.homeDirectory}/downloads/email";

View file

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

View file

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