2021-04-19 10:08:34 +01:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, rustPlatform
|
|
|
|
, fetchFromGitHub
|
|
|
|
, openssl
|
|
|
|
, pkg-config
|
|
|
|
, installShellFiles
|
|
|
|
, enableCompletions ? stdenv.hostPlatform == stdenv.buildPlatform
|
|
|
|
, Security
|
|
|
|
, libiconv
|
|
|
|
}:
|
|
|
|
rustPlatform.buildRustPackage rec {
|
|
|
|
pname = "himalaya";
|
2021-06-03 17:24:19 +01:00
|
|
|
version = "0.4.0";
|
2021-04-19 10:08:34 +01:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "soywod";
|
|
|
|
repo = pname;
|
|
|
|
rev = "v${version}";
|
2021-06-03 17:24:19 +01:00
|
|
|
sha256 = "sha256-6RgT/SxO4vsk8Yx2AbaNIFvnAvgDmeTXvb/v6nUJxhc=";
|
2021-04-19 10:08:34 +01:00
|
|
|
};
|
|
|
|
|
2021-06-03 17:24:19 +01:00
|
|
|
cargoSha256 = "sha256-NEuIh7FwIdAWzlChna3+G0VukfV8nYZfVWa+3LxQCIA=";
|
2021-05-04 15:28:27 +01:00
|
|
|
|
|
|
|
# use --lib flag to avoid test with imap server
|
|
|
|
# https://github.com/soywod/himalaya/issues/145
|
|
|
|
cargoTestFlags = [ "--lib" ];
|
2021-04-19 10:08:34 +01:00
|
|
|
|
|
|
|
nativeBuildInputs = [ ]
|
|
|
|
++ lib.optionals (enableCompletions) [ installShellFiles ]
|
|
|
|
++ lib.optionals (!stdenv.hostPlatform.isDarwin) [ pkg-config ];
|
|
|
|
|
|
|
|
buildInputs =
|
|
|
|
if stdenv.hostPlatform.isDarwin then [
|
|
|
|
Security
|
|
|
|
libiconv
|
|
|
|
] else [
|
|
|
|
openssl
|
|
|
|
];
|
|
|
|
|
|
|
|
postInstall = lib.optionalString enableCompletions ''
|
|
|
|
# Install shell function
|
|
|
|
installShellCompletion --cmd himalaya \
|
|
|
|
--bash <($out/bin/himalaya completion bash) \
|
|
|
|
--fish <($out/bin/himalaya completion fish) \
|
|
|
|
--zsh <($out/bin/himalaya completion zsh)
|
|
|
|
'';
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "CLI email client written in Rust";
|
|
|
|
homepage = "https://github.com/soywod/himalaya";
|
|
|
|
license = licenses.bsd3;
|
|
|
|
maintainers = with maintainers; [ yanganto ];
|
|
|
|
};
|
|
|
|
}
|