tiny: make dbus, openssl, and notifications each optional

This commit exposes support for compilation without dbus, controlled
by the global dbusSupport argument.  This argument is understood by
many other nixpkgs expressions and can be set globally in
~/.config/nixpkgs/config.nix.

This commit also adds two package-specific arguments:

* notificationsSupport allows to disable the desktop-notifications
  feature when invoking cargo.

* useOpenSSL can be set to false in order to compile tiny with rustls
  instead of openssl.
This commit is contained in:
Adam Joseph 2022-02-19 13:37:33 -08:00
parent 65c8149cb1
commit 64cb3a021b

View File

@ -3,9 +3,11 @@
, rustPlatform
, fetchFromGitHub
, pkg-config
, dbus
, openssl
, Foundation
, dbusSupport ? stdenv.isLinux, dbus
# rustls will be used for TLS if useOpenSSL=false
, useOpenSSL ? stdenv.isLinux, openssl
, notificationSupport ? stdenv.isLinux
}:
rustPlatform.buildRustPackage rec {
@ -22,9 +24,11 @@ rustPlatform.buildRustPackage rec {
cargoSha256 = "05q3f1wp48mwkz8n0102rwb6jzrgpx3dlbxzf3zcw8r1mblgzim1";
nativeBuildInputs = lib.optional stdenv.isLinux pkg-config;
buildInputs = lib.optionals stdenv.isLinux [ dbus openssl ] ++ lib.optional stdenv.isDarwin Foundation;
buildInputs = lib.optionals dbusSupport [ dbus ]
++ lib.optionals useOpenSSL [ openssl ]
++ lib.optional stdenv.isDarwin Foundation;
buildFeatures = lib.optional stdenv.isLinux "desktop-notifications";
buildFeatures = lib.optional notificationSupport "desktop-notifications";
meta = with lib; {
description = "A console IRC client";