nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 unstableGitUpdater,
6 cmake,
7 pkg-config,
8 alsa-lib,
9 jack2,
10 libpulseaudio,
11 sndio,
12 speexdsp,
13 validatePkgConfig,
14
15 # passthru.tests
16 testers,
17
18 alsaSupport ? !stdenv.hostPlatform.isDarwin,
19 pulseSupport ? !stdenv.hostPlatform.isDarwin,
20 jackSupport ? !stdenv.hostPlatform.isDarwin,
21 sndioSupport ? !stdenv.hostPlatform.isDarwin,
22 enableShared ? !stdenv.hostPlatform.isStatic,
23}:
24
25stdenv.mkDerivation (finalAttrs: {
26 pname = "cubeb";
27 version = "0-unstable-2026-01-23";
28
29 src = fetchFromGitHub {
30 owner = "mozilla";
31 repo = "cubeb";
32 rev = "484857522c73318c06f18ba0a3e17525fa98c608";
33 hash = "sha256-Uq+UINIXc3uuqS7MwbTQ5pL72KmknM33/3CLH21Od/Y=";
34 };
35
36 outputs = [
37 "out"
38 "lib"
39 "dev"
40 ];
41
42 nativeBuildInputs = [
43 cmake
44 pkg-config
45 validatePkgConfig
46 ];
47
48 buildInputs = [
49 speexdsp
50 ]
51 # In the default configuration these inputs are lazy-loaded. If your package builds a vendored cubeb please make
52 # sure to include these in the runtime LD path.
53 ++ lib.optional alsaSupport alsa-lib
54 ++ lib.optional jackSupport jack2
55 ++ lib.optional pulseSupport libpulseaudio
56 ++ lib.optional sndioSupport sndio;
57
58 cmakeFlags = [
59 (lib.cmakeBool "BUILD_SHARED_LIBS" enableShared)
60 (lib.cmakeBool "BUILD_TESTS" false) # tests require an audio server
61 (lib.cmakeBool "BUNDLE_SPEEX" false)
62 (lib.cmakeBool "USE_SANITIZERS" false)
63
64 # Whether to lazily load libraries with dlopen()
65 (lib.cmakeBool "LAZY_LOAD_LIBS" false)
66 ];
67
68 passthru = {
69 updateScript = unstableGitUpdater { hardcodeZeroVersion = true; };
70 tests.pkg-config = testers.testMetaPkgConfig finalAttrs.finalPackage;
71 };
72
73 meta = {
74 description = "Cross platform audio library";
75 mainProgram = "cubeb-test";
76 homepage = "https://github.com/mozilla/cubeb";
77 license = lib.licenses.isc;
78 platforms = with lib.platforms; linux ++ darwin;
79 maintainers = with lib.maintainers; [
80 zhaofengli
81 marcin-serwin
82 ];
83 pkgConfigModules = [ "libcubeb" ];
84 };
85})