mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-25 16:33:15 +00:00
e0464e4788
In preparation for the deprecation of `stdenv.isX`. These shorthands are not conducive to cross-compilation because they hide the platforms. Darwin might get cross-compilation for which the continued usage of `stdenv.isDarwin` will get in the way One example of why this is bad and especially affects compiler packages https://www.github.com/NixOS/nixpkgs/pull/343059 There are too many files to go through manually but a treewide should get users thinking when they see a `hostPlatform.isX` in a place where it doesn't make sense. ``` fd --type f "\.nix" | xargs sd --fixed-strings "stdenv.is" "stdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "stdenv'.is" "stdenv'.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "clangStdenv.is" "clangStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "gccStdenv.is" "gccStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "stdenvNoCC.is" "stdenvNoCC.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "inherit (stdenv) is" "inherit (stdenv.hostPlatform) is" fd --type f "\.nix" | xargs sd --fixed-strings "buildStdenv.is" "buildStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "effectiveStdenv.is" "effectiveStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "originalStdenv.is" "originalStdenv.hostPlatform.is" ```
46 lines
1.3 KiB
Nix
46 lines
1.3 KiB
Nix
{ lib, stdenv, fetchurl, pkg-config
|
|
|
|
# Optional Dependencies
|
|
, alsa-lib ? null, db ? null, libuuid ? null, libffado ? null, celt ? null
|
|
|
|
, testers
|
|
}:
|
|
|
|
let
|
|
shouldUsePkg = pkg: if pkg != null && lib.meta.availableOn stdenv.hostPlatform pkg then pkg else null;
|
|
|
|
optAlsaLib = shouldUsePkg alsa-lib;
|
|
optDb = shouldUsePkg db;
|
|
optLibuuid = shouldUsePkg libuuid;
|
|
optLibffado = shouldUsePkg libffado;
|
|
optCelt = shouldUsePkg celt;
|
|
in
|
|
stdenv.mkDerivation (finalAttrs: {
|
|
pname = "jack1";
|
|
version = "0.125.0";
|
|
|
|
src = fetchurl {
|
|
url = "https://jackaudio.org/downloads/jack-audio-connection-kit-${finalAttrs.version}.tar.gz";
|
|
sha256 = "0i6l25dmfk2ji2lrakqq9icnwjxklgcjzzk65dmsff91z2zva5rm";
|
|
};
|
|
|
|
configureFlags = [
|
|
(lib.enableFeature (optLibffado != null) "firewire")
|
|
];
|
|
|
|
nativeBuildInputs = [ pkg-config ];
|
|
buildInputs = [ optAlsaLib optDb optLibffado optCelt ];
|
|
propagatedBuildInputs = [ optLibuuid ];
|
|
|
|
passthru.tests.pkg-config = testers.testMetaPkgConfig finalAttrs.finalPackage;
|
|
|
|
meta = with lib; {
|
|
broken = stdenv.hostPlatform.isDarwin;
|
|
description = "JACK audio connection kit";
|
|
homepage = "https://jackaudio.org";
|
|
license = with licenses; [ gpl2Plus lgpl21 ];
|
|
pkgConfigModules = [ "jack" ];
|
|
platforms = platforms.unix;
|
|
};
|
|
})
|