treewide: remove lib.meta.enableIfAvailable

This commit is contained in:
Matthew Bauer 2018-05-09 16:13:38 -05:00
parent 8a98cf97e9
commit c37b93bd52
3 changed files with 10 additions and 9 deletions

View File

@ -86,6 +86,4 @@ rec {
then { system = elem; } then { system = elem; }
else { parsed = elem; }; else { parsed = elem; };
in lib.matchAttrs pattern platform; in lib.matchAttrs pattern platform;
enableIfAvailable = p: if p.meta.available or true then [ p ] else [];
} }

View File

@ -1,9 +1,9 @@
{ stdenv, fetchFromGitHub, fetchpatch, pkgconfig, intltool, gperf, libcap, kmod { stdenv, fetchFromGitHub, fetchpatch, pkgconfig, intltool, gperf, libcap, kmod
, zlib, xz, pam, acl, cryptsetup, libuuid, m4, utillinux, libffi , zlib, xz, pam, acl, cryptsetup, libuuid, m4, utillinux, libffi
, glib, kbd, libxslt, coreutils, libgcrypt, libgpgerror, libidn2, libapparmor , glib, kbd, libxslt, coreutils, libgcrypt, libgpgerror, libidn2, libapparmor
, audit, lz4, bzip2, kexectools, libmicrohttpd , audit, lz4, bzip2, libmicrohttpd
, linuxHeaders ? stdenv.cc.libc.linuxHeaders , linuxHeaders ? stdenv.cc.libc.linuxHeaders
, libseccomp, iptables, gnu-efi , iptables, gnu-efi
, autoreconfHook, gettext, docbook_xsl, docbook_xml_dtd_42, docbook_xml_dtd_45 , autoreconfHook, gettext, docbook_xsl, docbook_xml_dtd_42, docbook_xml_dtd_45
, ninja, meson, python3Packages, glibcLocales , ninja, meson, python3Packages, glibcLocales
, patchelf , patchelf
@ -11,6 +11,8 @@
, hostPlatform , hostPlatform
, buildPackages , buildPackages
, withSelinux ? false, libselinux , withSelinux ? false, libselinux
, withLibseccomp ? libseccomp.meta.available, libseccomp
, withKexectools ? kexectools.meta.available, kexectools
}: }:
let let
@ -42,13 +44,13 @@ in stdenv.mkDerivation rec {
[ linuxHeaders libcap kmod xz pam acl [ linuxHeaders libcap kmod xz pam acl
/* cryptsetup */ libuuid glib libgcrypt libgpgerror libidn2 /* cryptsetup */ libuuid glib libgcrypt libgpgerror libidn2
libmicrohttpd ] ++ libmicrohttpd ] ++
stdenv.lib.meta.enableIfAvailable kexectools ++ stdenv.lib.optional withKexectools kexectools ++
stdenv.lib.meta.enableIfAvailable libseccomp ++ stdenv.lib.optional withLibseccomp libseccomp ++
[ libffi audit lz4 bzip2 libapparmor [ libffi audit lz4 bzip2 libapparmor
iptables gnu-efi iptables gnu-efi
# This is actually native, but we already pull it from buildPackages # This is actually native, but we already pull it from buildPackages
pythonLxmlEnv pythonLxmlEnv
] ++ stdenv.lib.optionals withSelinux [ libselinux ]; ] ++ stdenv.lib.optional withSelinux libselinux;
#dontAddPrefix = true; #dontAddPrefix = true;

View File

@ -1,11 +1,12 @@
{ lib, stdenv, fetchurl, fetchFromGitHub, perl, curl, bzip2, sqlite, openssl ? null, xz { lib, stdenv, fetchurl, fetchFromGitHub, perl, curl, bzip2, sqlite, openssl ? null, xz
, pkgconfig, boehmgc, perlPackages, libsodium, aws-sdk-cpp, brotli, boost , pkgconfig, boehmgc, perlPackages, libsodium, aws-sdk-cpp, brotli, boost
, autoreconfHook, autoconf-archive, bison, flex, libxml2, libxslt, docbook5, docbook5_xsl , autoreconfHook, autoconf-archive, bison, flex, libxml2, libxslt, docbook5, docbook5_xsl
, libseccomp, busybox-sandbox-shell , busybox-sandbox-shell
, hostPlatform, buildPlatform , hostPlatform, buildPlatform
, storeDir ? "/nix/store" , storeDir ? "/nix/store"
, stateDir ? "/nix/var" , stateDir ? "/nix/var"
, confDir ? "/etc" , confDir ? "/etc"
, withLibseccomp ? libseccomp.meta.available, libseccomp
}: }:
let let
@ -30,7 +31,7 @@ let
buildInputs = [ curl openssl sqlite xz bzip2 ] buildInputs = [ curl openssl sqlite xz bzip2 ]
++ lib.optional (stdenv.isLinux || stdenv.isDarwin) libsodium ++ lib.optional (stdenv.isLinux || stdenv.isDarwin) libsodium
++ lib.optionals is20 [ brotli ] # Since 1.12 ++ lib.optionals is20 [ brotli ] # Since 1.12
++ lib.meta.enableIfAvailable libseccomp ++ lib.optional withLibseccomp libseccomp
++ lib.optional ((stdenv.isLinux || stdenv.isDarwin) && is20) ++ lib.optional ((stdenv.isLinux || stdenv.isDarwin) && is20)
(aws-sdk-cpp.override { (aws-sdk-cpp.override {
apis = ["s3"]; apis = ["s3"];