nixpkgs/pkgs/development/libraries/pcaudiolib/default.nix
Artturin e0464e4788 treewide: replace stdenv.is with stdenv.hostPlatform.is
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"
```
2024-09-25 00:04:37 +03:00

57 lines
1.2 KiB
Nix

{ config
, lib
, stdenv
, fetchFromGitHub
, alsa-lib
, autoconf
, automake
, libpulseaudio
, libtool
, pkg-config
, portaudio
, which
, pulseaudioSupport ? config.pulseaudio or stdenv.hostPlatform.isLinux
}:
stdenv.mkDerivation (finalAttrs: {
pname = "pcaudiolib";
version = "1.2";
src = fetchFromGitHub {
owner = "espeak-ng";
repo = "pcaudiolib";
rev = finalAttrs.version;
hash = "sha256-ZG/HBk5DHaZP/H3M01vDr3M2nP9awwsPuKpwtalz3EE=";
};
nativeBuildInputs = [
autoconf
automake
libtool
pkg-config
which
];
buildInputs = [
portaudio
]
++ lib.optional stdenv.hostPlatform.isLinux alsa-lib
++ lib.optional pulseaudioSupport libpulseaudio;
# touch ChangeLog to avoid below error on darwin:
# Makefile.am: error: required file './ChangeLog.md' not found
preConfigure = lib.optionalString stdenv.hostPlatform.isDarwin ''
touch ChangeLog
'' + ''
./autogen.sh
'';
meta = with lib; {
homepage = "https://github.com/espeak-ng/pcaudiolib";
description = "Provides a C API to different audio devices";
license = licenses.gpl3Plus;
maintainers = with maintainers; [ aske ];
platforms = platforms.unix;
};
})