Skip to content

Commit

Permalink
treewide: Make shouldUsePackages copypasta use meta.available
Browse files Browse the repository at this point in the history
The old way depended on old list-of-strings `meta.platforms`, and was
not good for cross.
  • Loading branch information
Ericson2314 committed Mar 12, 2018
1 parent eeb8419 commit 79d8353
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 7 deletions.
2 changes: 1 addition & 1 deletion pkgs/development/libraries/wiredtiger/default.nix
Expand Up @@ -15,7 +15,7 @@ let
mkWith = mkFlag "with-" "without-";
mkOther = mkFlag "" "" true;

shouldUsePkg = pkg: if pkg != null && any (x: x == stdenv.system) pkg.meta.platforms then pkg else null;
shouldUsePkg = pkg: if pkg != null && pkg.meta.available then pkg else null;

optLz4 = shouldUsePkg lz4;
optSnappy = shouldUsePkg snappy;
Expand Down
2 changes: 1 addition & 1 deletion pkgs/misc/jackaudio/default.nix
Expand Up @@ -15,7 +15,7 @@
with stdenv.lib;
let
inherit (python2Packages) python dbus-python;
shouldUsePkg = pkg: if pkg != null && stdenv.lib.any (x: x == stdenv.system) pkg.meta.platforms then pkg else null;
shouldUsePkg = pkg: if pkg != null && pkg.meta.available then pkg else null;

libOnly = prefix == "lib";

Expand Down
2 changes: 1 addition & 1 deletion pkgs/misc/jackaudio/jack1.nix
Expand Up @@ -5,7 +5,7 @@
}:

let
shouldUsePkg = pkg: if pkg != null && stdenv.lib.any (x: x == stdenv.system) pkg.meta.platforms then pkg else null;
shouldUsePkg = pkg: if pkg != null && pkg.meta.available then pkg else null;

optAlsaLib = shouldUsePkg alsaLib;
optDb = shouldUsePkg db;
Expand Down
2 changes: 1 addition & 1 deletion pkgs/os-specific/linux/ffado/default.nix
Expand Up @@ -11,7 +11,7 @@

let

shouldUsePkg = pkg: if pkg != null && stdenv.lib.any (x: x == stdenv.system) pkg.meta.platforms then pkg else null;
shouldUsePkg = pkg: if pkg != null && pkg.meta.available then pkg else null;

libOnly = prefix == "lib";

Expand Down
2 changes: 1 addition & 1 deletion pkgs/servers/shishi/default.nix
Expand Up @@ -14,7 +14,7 @@ let
mkWith = mkFlag "with-" "without-";
mkOther = mkFlag "" "" true;

shouldUsePkg = pkg: if pkg != null && stdenv.lib.any (x: x == stdenv.system) pkg.meta.platforms then pkg else null;
shouldUsePkg = pkg: if pkg != null && pkg.meta.available then pkg else null;

optPam = shouldUsePkg pam;
optLibidn = shouldUsePkg libidn;
Expand Down
3 changes: 1 addition & 2 deletions pkgs/tools/filesystems/ceph/generic.nix
Expand Up @@ -37,8 +37,7 @@ with stdenv.lib;
let

shouldUsePkg = pkg_: let pkg = (builtins.tryEval pkg_).value;
in if lib.any (x: x == system) (pkg.meta.platforms or [])
then pkg else null;
in if pkg.meta.available or false then pkg else null;

optYasm = shouldUsePkg yasm;
optFcgi = shouldUsePkg fcgi;
Expand Down

0 comments on commit 79d8353

Please sign in to comment.