connman: Use global reference to lib.optionals

This commit is contained in:
Doron Behar 2020-03-02 00:51:14 +02:00
parent cdc20ac30e
commit e59deafc2d

View File

@ -52,6 +52,8 @@
assert stdenv.lib.asserts.assertOneOf "firewallType" firewallType [ "iptables" "nftables" ]; assert stdenv.lib.asserts.assertOneOf "firewallType" firewallType [ "iptables" "nftables" ];
assert stdenv.lib.asserts.assertOneOf "dnsType" dnsType [ "internal" "systemd-resolved" ]; assert stdenv.lib.asserts.assertOneOf "dnsType" dnsType [ "internal" "systemd-resolved" ];
let inherit (stdenv.lib) optionals;
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
pname = "connman"; pname = "connman";
version = "1.38"; version = "1.38";
@ -72,13 +74,13 @@ stdenv.mkDerivation rec {
pkgconfig pkgconfig
file file
] ]
++ stdenv.lib.optionals (enableOpenvpn) [ openvpn ] ++ optionals (enableOpenvpn) [ openvpn ]
++ stdenv.lib.optionals (enableOpenconnect) [ openconnect ] ++ optionals (enableOpenconnect) [ openconnect ]
++ stdenv.lib.optionals (enableVpnc) [ vpnc ] ++ optionals (enableVpnc) [ vpnc ]
++ stdenv.lib.optionals (enablePolkit) [ polkit ] ++ optionals (enablePolkit) [ polkit ]
++ stdenv.lib.optionals (enablePptp) [ pptp ppp ] ++ optionals (enablePptp) [ pptp ppp ]
++ stdenv.lib.optionals (firewallType == "iptables") [ iptables ] ++ optionals (firewallType == "iptables") [ iptables ]
++ stdenv.lib.optionals (firewallType == "nftables") [ libnftnl ] ++ optionals (firewallType == "nftables") [ libnftnl ]
; ;
# fix invalid path to 'file' # fix invalid path to 'file'
@ -103,60 +105,60 @@ stdenv.mkDerivation rec {
# --enable-tests # installs the tests, we don't want that # --enable-tests # installs the tests, we don't want that
"--enable-tools" "--enable-tools"
] ]
++ stdenv.lib.optionals (!enableLoopback) [ "--disable-loopback" ] ++ optionals (!enableLoopback) [ "--disable-loopback" ]
++ stdenv.lib.optionals (!enableEthernet) [ "--disable-ethernet" ] ++ optionals (!enableEthernet) [ "--disable-ethernet" ]
++ stdenv.lib.optionals (!enableWireguard) [ "--disable-wireguard" ] ++ optionals (!enableWireguard) [ "--disable-wireguard" ]
++ stdenv.lib.optionals (!enableGadget) [ "--disable-gadget" ] ++ optionals (!enableGadget) [ "--disable-gadget" ]
++ stdenv.lib.optionals (!enableWifi) [ "--disable-wifi" ] ++ optionals (!enableWifi) [ "--disable-wifi" ]
# enable IWD support for wifi as it doesn't require any new dependencies # enable IWD support for wifi as it doesn't require any new dependencies
# and it's easier for the NixOS module to use only one connman package when # and it's easier for the NixOS module to use only one connman package when
# IWD is requested # IWD is requested
++ stdenv.lib.optionals (enableWifi) [ "--enable-iwd" ] ++ optionals (enableWifi) [ "--enable-iwd" ]
++ stdenv.lib.optionals (!enableBluetooth) [ "--disable-bluetooth" ] ++ optionals (!enableBluetooth) [ "--disable-bluetooth" ]
++ stdenv.lib.optionals (!enableOfono) [ "--disable-ofono" ] ++ optionals (!enableOfono) [ "--disable-ofono" ]
++ stdenv.lib.optionals (!enableDundee) [ "--disable-dundee" ] ++ optionals (!enableDundee) [ "--disable-dundee" ]
++ stdenv.lib.optionals (!enablePacrunner) [ "--disable-pacrunner" ] ++ optionals (!enablePacrunner) [ "--disable-pacrunner" ]
++ stdenv.lib.optionals (!enableNeard) [ "--disable-neard" ] ++ optionals (!enableNeard) [ "--disable-neard" ]
++ stdenv.lib.optionals (!enableWispr) [ "--disable-wispr" ] ++ optionals (!enableWispr) [ "--disable-wispr" ]
++ stdenv.lib.optionals (!enableTools) [ "--disable-tools" ] ++ optionals (!enableTools) [ "--disable-tools" ]
++ stdenv.lib.optionals (!enableStats) [ "--disable-stats" ] ++ optionals (!enableStats) [ "--disable-stats" ]
++ stdenv.lib.optionals (!enableClient) [ "--disable-client" ] ++ optionals (!enableClient) [ "--disable-client" ]
++ stdenv.lib.optionals (!enableDatafiles) [ "--disable-datafiles" ] ++ optionals (!enableDatafiles) [ "--disable-datafiles" ]
++ stdenv.lib.optionals (enableOpenconnect) [ ++ optionals (enableOpenconnect) [
"--enable-openconnect=builtin" "--enable-openconnect=builtin"
"--with-openconnect=${openconnect}/sbin/openconnect" "--with-openconnect=${openconnect}/sbin/openconnect"
] ]
++ stdenv.lib.optionals (enableOpenvpn) [ ++ optionals (enableOpenvpn) [
"--enable-openvpn=builtin" "--enable-openvpn=builtin"
"--with-openvpn=${openvpn}/sbin/openvpn" "--with-openvpn=${openvpn}/sbin/openvpn"
] ]
++ stdenv.lib.optionals (enableVpnc) [ ++ optionals (enableVpnc) [
"--enable-vpnc=builtin" "--enable-vpnc=builtin"
"--with-vpnc=${vpnc}/sbin/vpnc" "--with-vpnc=${vpnc}/sbin/vpnc"
] ]
++ stdenv.lib.optionals (enablePolkit) [ ++ optionals (enablePolkit) [
"--enable-polkit" "--enable-polkit"
] ]
++ stdenv.lib.optionals (enablePptp) [ ++ optionals (enablePptp) [
"--enable-pptp" "--enable-pptp"
"--with-pptp=${pptp}/sbin/pptp" "--with-pptp=${pptp}/sbin/pptp"
] ]
++ stdenv.lib.optionals (!enableWireguard) [ ++ optionals (!enableWireguard) [
"--disable-wireguard" "--disable-wireguard"
] ]
++ stdenv.lib.optionals (enableNetworkManager) [ ++ optionals (enableNetworkManager) [
"--enable-nmcompat" "--enable-nmcompat"
] ]
++ stdenv.lib.optionals (enableHh2serialGps) [ ++ optionals (enableHh2serialGps) [
"--enable-hh2serial-gps" "--enable-hh2serial-gps"
] ]
++ stdenv.lib.optionals (enableL2tp) [ ++ optionals (enableL2tp) [
"--enable-l2tp" "--enable-l2tp"
] ]
++ stdenv.lib.optionals (enableIospm) [ ++ optionals (enableIospm) [
"--enable-iospm" "--enable-iospm"
] ]
++ stdenv.lib.optionals (enableTist) [ ++ optionals (enableTist) [
"--enable-tist" "--enable-tist"
] ]
; ;