Skip to content

Commit

Permalink
himalaya: add args to manage cargo features
Browse files Browse the repository at this point in the history
  • Loading branch information
soywod committed Feb 16, 2023
1 parent f645f1c commit 06d21e8
Showing 1 changed file with 18 additions and 14 deletions.
32 changes: 18 additions & 14 deletions pkgs/applications/networking/mailreaders/himalaya/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@
, Security
, libiconv
, openssl
, notmuch
, withImapBackend ? true
, withNotmuchBackend ? false
, withSmtpSender ? true
}:

rustPlatform.buildRustPackage rec {
Expand All @@ -25,28 +29,28 @@ rustPlatform.buildRustPackage rec {
cargoSha256 = "sha256-FXfh6T8dNsnD/V/wYSMDWs+ll0d1jg1Dc3cQT39b0ws=";

nativeBuildInputs = [ ]
++ lib.optionals (installManPages || installShellCompletions) [ installShellFiles ]
++ lib.optionals (!stdenv.hostPlatform.isDarwin) [ pkg-config ];

buildInputs =
if stdenv.hostPlatform.isDarwin then [
Security
libiconv
] else [
openssl
];

# TODO: remove this flag once this issue is fixed:
++ lib.optional (installManPages || installShellCompletions) installShellFiles
++ lib.optional (!stdenv.hostPlatform.isDarwin) pkg-config;

buildInputs = [ ]
++ (if stdenv.hostPlatform.isDarwin then [ Security libiconv ] else [ openssl ])
++ lib.optional withNotmuchBackend notmuch;

buildNoDefaultFeatures = true;
buildFeatures = [ ]
++ lib.optional withImapBackend "imap-backend"
++ lib.optional withNotmuchBackend "notmuch-backend"
++ lib.optional withSmtpSender "smtp-sender";

# TODO: remove me once this issue is fixed:
# https://todo.sr.ht/~soywod/pimalaya/36
cargoTestFlags = [ "--lib" ];

postInstall = lib.optionalString installManPages ''
# Install man pages
mkdir -p $out/man
$out/bin/himalaya man $out/man
installManPage $out/man/*
'' + lib.optionalString installShellCompletions ''
# Install shell completions
installShellCompletion --cmd himalaya \
--bash <($out/bin/himalaya completion bash) \
--fish <($out/bin/himalaya completion fish) \
Expand Down

0 comments on commit 06d21e8

Please sign in to comment.