Commit 9338d924 authored by adisbladis's avatar adisbladis
Browse files

lib.meta.availableOn: Return false if pkg parameter is null

To fix overriding packages that checks for platform compatibility, like pipewire.

`pipewire` contains the following logic to enable support for ldac depending on library platform compatibility:
```nix
ldacbtSupport = lib.meta.availableOn stdenv.hostPlatform ldacbt
```

Which is used later in the expression to create a Meson flag:
```nix
(lib.mesonEnable "bluez5-codec-ldac" (bluezSupport && ldacbtSupport))
```

This means that attempting to build `pipewire` without `ldacbt` like:
```nix
pipewire.override {
  ldacbt = null;
}
```
will fail because the the Meson flag indicates the feature should be enabled, but the library is passed to `buildInputs` as `null`.
parent 4ad8dfd9
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -289,7 +289,8 @@ rec {
  */
  availableOn =
    platform: pkg:
    ((!pkg ? meta.platforms) || any (platformMatch platform) pkg.meta.platforms)
    pkg != null
    && ((!pkg ? meta.platforms) || any (platformMatch platform) pkg.meta.platforms)
    && all (elem: !platformMatch platform elem) (pkg.meta.badPlatforms or [ ]);

  /**