Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions nixos/modules/config/pulseaudio.nix
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ let

overriddenPackage = cfg.package.override
(optionalAttrs hasZeroconf { zeroconfSupport = true; });
binary = "${getBin overriddenPackage}/bin/pulseaudio";
getDaemon = getOutput "daemon";
binary = "${getDaemon overriddenPackage}/bin/pulseaudio";
binaryNoDaemon = "${binary} --daemonize=no";

# Forces 32bit pulseaudio and alsaPlugins to be built/supported for apps
Expand Down Expand Up @@ -144,9 +145,9 @@ in {

package = mkOption {
type = types.package;
default = pulseaudioLight;
defaultText = "pkgs.pulseaudioLight";
example = literalExample "pkgs.pulseaudioFull";
default = pulseaudio;
defaultText = "pkgs.pulseaudio";
example = literalExample "pkgs.pulseaudio.override {};";
description = ''
The PulseAudio derivation to use. This can be used to enable
features (such as JACK support, Bluetooth) via the
Expand Down Expand Up @@ -212,7 +213,9 @@ in {
}

(mkIf cfg.enable {
environment.systemPackages = [ overriddenPackage ];
environment.systemPackages = [ overriddenPackage ]
# We won't pollute $PATH with server binaries, as long as we run it as system server
++ optionals nonSystemWide [(getDaemon overridenPackage)];

environment.etc = [
{ target = "asound.conf";
Expand Down
64 changes: 33 additions & 31 deletions pkgs/development/libraries/kerberos/heimdal.nix
Original file line number Diff line number Diff line change
@@ -1,17 +1,11 @@
{ stdenv, fetchFromGitHub, autoreconfHook, pkgconfig, python2, perl, yacc, flex
, texinfo, perlPackages
, openldap, libcap_ng, sqlite, openssl, db, libedit, pam

# Extra Args
, type ? ""
}:

let
libOnly = type == "lib";
in
with stdenv.lib;
stdenv.mkDerivation rec {
name = "${type}heimdal-${version}";
name = "heimdal-${version}";
version = "7.5.0";

src = fetchFromGitHub {
Expand All @@ -21,51 +15,46 @@ stdenv.mkDerivation rec {
sha256 = "1j38wjj4k0q8vx168k3d3k0fwa8j1q5q8f2688nnx1b9qgjd6w1d";
};

outputs = [ "out" "bin" "dev" "man" ];

patches = [ ./heimdal-make-missing-headers.patch ];

nativeBuildInputs = [ autoreconfHook pkgconfig python2 perl yacc flex ]
++ (with perlPackages; [ JSON ])
++ optional (!libOnly) texinfo;
nativeBuildInputs = [ autoreconfHook pkgconfig python2 perl yacc flex texinfo ]
++ (with perlPackages; [ JSON ]);
buildInputs = optionals (!stdenv.isFreeBSD) [ libcap_ng db ]
++ [ sqlite openssl libedit ]
++ optionals (!libOnly) [ openldap pam ];
++ [ sqlite openssl libedit openldap pam ];

## ugly, X should be made an option
configureFlags = [
"--sysconfdir=/etc"
"--localstatedir=/var"
"--enable-hdb-openldap-module"
"--with-sqlite3=${sqlite.dev}"
"--with-libedit=${libedit}"

# ugly, --with-libedit is not enought, it fall back to bundled libedit
"--with-libedit-include=${libedit.dev}/include"
"--with-libedit-lib=${libedit}/lib"
"--with-openssl=${openssl.dev}"
"--without-x"
"--with-berkeley-db=${db}"
] ++ optionals (!libOnly) [
"--with-openldap=${openldap.dev}"
] ++ optionals (!stdenv.isFreeBSD) [
"--with-capng"
];

postUnpack = ''
sed -i '/^DEFAULT_INCLUDES/ s,$, -I..,' source/cf/Makefile.am.common
sed -i -e 's/date/date --date="@$SOURCE_DATE_EPOCH"/' source/configure.ac
'';

buildPhase = optionalString libOnly ''
(cd include; make -j $NIX_BUILD_CORES)
(cd lib; make -j $NIX_BUILD_CORES)
(cd tools; make -j $NIX_BUILD_CORES)
(cd include/hcrypto; make -j $NIX_BUILD_CORES)
(cd lib/hcrypto; make -j $NIX_BUILD_CORES)
'';

installPhase = optionalString libOnly ''
(cd include; make -j $NIX_BUILD_CORES install)
(cd lib; make -j $NIX_BUILD_CORES install)
(cd tools; make -j $NIX_BUILD_CORES install)
(cd include/hcrypto; make -j $NIX_BUILD_CORES install)
(cd lib/hcrypto; make -j $NIX_BUILD_CORES install)
rm -rf $out/{libexec,sbin,share}
find $out/bin -type f | grep -v 'krb5-config' | xargs rm
preConfigure = ''
configureFlagsArray+=(
"--bindir=$out/bin" # Put binaries to $out, then move them to $bin,
# otherwise we go a cyclic dependecny
"--sbindir=$out/sbin"
"--mandir=$man/share/man"
"--infodir=$man/share/info"
"--includedir=$dev/include")
'';

# We need to build hcrypt for applications like samba
Expand All @@ -74,14 +63,27 @@ stdenv.mkDerivation rec {
(cd lib/hcrypto; make -j $NIX_BUILD_CORES)
'';

# FIXME: share/info hits $bin, IDK why, but I decide is to minor to block
postInstall = ''
# Install hcrypto
(cd include/hcrypto; make -j $NIX_BUILD_CORES install)
(cd lib/hcrypto; make -j $NIX_BUILD_CORES install)

# Do we need it?
rm $out/bin/su

# Doesn't succeed with --libexec=$out/sbin, so
mv "$out/libexec/"* $out/sbin/
mkdir -p $dev/bin
mkdir -p $bin/{,s}bin
mv "$out/libexec/heimdal/"* $dev/bin/
rmdir $out/libexec/heimdal
mv "$out/libexec/"* $bin/sbin/
rmdir $out/libexec

mkdir -p $dev/bin && mv $out/bin/krb5-config $dev/bin/

# Move remaining binaries to $bin
mv $out/bin/* $bin/bin/
'';

# Issues with hydra
Expand Down
29 changes: 15 additions & 14 deletions pkgs/misc/jackaudio/default.nix
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
{ stdenv, fetchFromGitHub, pkgconfig, python2Packages, makeWrapper
, bash, libsamplerate, libsndfile, readline, eigen, celt
, dbus, libffado, alsaLib, libopus
# Darwin Dependencies
, aften, AudioToolbox, CoreAudio, CoreFoundation

# Optional Dependencies
, dbus ? null, libffado ? null, alsaLib ? null
, libopus ? null
, darwin

# Extra options
Expand All @@ -17,12 +16,10 @@ let
inherit (python2Packages) python dbus-python;
shouldUsePkg = pkg: if pkg != null && pkg.meta.available then pkg else null;

libOnly = prefix == "lib";

optDbus = if stdenv.isDarwin then null else shouldUsePkg dbus;
optPythonDBus = if libOnly then null else shouldUsePkg dbus-python;
optLibffado = if libOnly then null else shouldUsePkg libffado;
optAlsaLib = if libOnly then null else shouldUsePkg alsaLib;
optPythonDBus = shouldUsePkg dbus-python;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can probably get rid of shouldUsePkg. I think they are officially deprecated (just use dbus-python directly).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It don't used outside of mixer, so if we move mixer to own app, we can drop dbus-python in main ffado.

optLibffado = shouldUsePkg libffado;
optAlsaLib = shouldUsePkg alsaLib;
optLibopus = shouldUsePkg libopus;
in
stdenv.mkDerivation rec {
Expand All @@ -36,6 +33,8 @@ stdenv.mkDerivation rec {
sha256 = "0ynpyn0l77m94b50g7ysl795nvam3ra65wx5zb46nxspgbf6wnkh";
};

outputs = [ "out" "bin" "dev"];

nativeBuildInputs = [ pkgconfig python makeWrapper ];
buildInputs = [ libsamplerate libsndfile readline eigen celt
optDbus optPythonDBus optLibffado optAlsaLib optLibopus
Expand All @@ -59,7 +58,8 @@ stdenv.mkDerivation rec {
configurePhase = ''
runHook preConfigure

python waf configure --prefix=$out \
python waf configure --prefix=$bin \
--libdir=$out/lib \
${optionalString (optDbus != null) "--dbus"} \
--classic \
${optionalString (optLibffado != null) "--firewire"} \
Expand All @@ -75,12 +75,13 @@ stdenv.mkDerivation rec {

installPhase = ''
python waf install
'' + (if libOnly then ''
rm -rf $out/{bin,share}
rm -rf $out/lib/{jack,libjacknet*,libjackserver*}
'' else ''
wrapProgram $out/bin/jack_control --set PYTHONPATH $PYTHONPATH
'');

# Move drivers from $out to $bin
mkdir -p $bin/lib/jack && mv $out/lib/jack $bin/lib/jack
wrapProgram $bin/bin/jackd --set JACK_DRIVER_DIR $bin/lib/jack
wrapProgram $bin/bin/jackdbus --set JACK_DRIVER_DIR $bin/lib/jack
wrapProgram $bin/bin/jack_control --set PYTHONPATH $PYTHONPATH
'';

meta = {
description = "JACK audio connection kit, version 2 with jackdbus";
Expand Down
60 changes: 33 additions & 27 deletions pkgs/os-specific/linux/ffado/default.nix
Original file line number Diff line number Diff line change
@@ -1,44 +1,57 @@
{ stdenv, fetchurl, scons, pkgconfig, which, makeWrapper, python
, expat, libraw1394, libconfig, libavc1394, libiec61883, libxmlxx, glibmm
, expat, libraw1394, libconfig, libavc1394, libiec61883, libxmlxx
, alsaLib, dbus, dbus_cplusplus

# Optional dependencies
, libjack2 ? null, dbus ? null, dbus_cplusplus ? null, alsaLib ? null
, pyqt4 ? null, dbus-python ? null, xdg_utils ? null

# Other Flags
, prefix ? ""
, libOnly ? false
}:

let

shouldUsePkg = pkg: if pkg != null && pkg.meta.available then pkg else null;

libOnly = prefix == "lib";

optLibjack2 = shouldUsePkg libjack2;
optDbus = shouldUsePkg dbus;
optDbus_cplusplus = shouldUsePkg dbus_cplusplus;
optAlsaLib = shouldUsePkg alsaLib;
# Mixer/tools dependencies
# FIXME: can we build mixer separately? Then we can farewell `libOnly` mode
# (otherwise we have perfect loop via qt -> pulseaudio -> jack -> ffado -> qt)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can probably override ffado in jack's callPackage-jack shouldn't need Qt.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ffado' mixer is actually separate app, which have completely own dependencies (dbus-python and PyQt), so I feel separate expression may be better solution. But would be nice to hear someone who use ffado.

# FIXME: it should work with pyqt5 as well (so we can farewell `qt4` sometimes)
optPyqt4 = shouldUsePkg pyqt4;
optPythonDBus = shouldUsePkg dbus-python;
optXdg_utils = shouldUsePkg xdg_utils;

PYDIR="$out/lib/${python.libPrefix}/site-packages";
SCONS_OPTIONS = ''
PREFIX=$out \
PYPKGDIR=${PYDIR} \
DEBUG=False \
ENABLE_ALL=True \
SERIALIZE_USE_EXPAT=True \
BUILD_TESTS=False \
UDEVDIR=$out/lib/udev/rules.d \
BINDIR=$bin/bin \
INCLUDEDIR=$dev/include \
BUILD_MIXER=${if libOnly then "False" else "True"} \
'';
in
stdenv.mkDerivation rec {
name = "${prefix}ffado-${version}";
name = "ffado-${version}";
version = "2.4.0";

src = fetchurl {
url = "http://www.ffado.org/files/libffado-${version}.tgz";
sha256 = "14rprlcd0gpvg9kljh0zzjzd2rc9hbqqpjidshxxjvvfh4r00f4f";
};

outputs = [ "out" "bin" "dev" ];

nativeBuildInputs = [ scons pkgconfig which makeWrapper python ];

buildInputs = [
expat libraw1394 libconfig libavc1394 libiec61883
expat libraw1394 libconfig libavc1394 libiec61883 dbus dbus_cplusplus libxmlxx
] ++ stdenv.lib.optionals (!libOnly) [
optLibjack2 optDbus optDbus_cplusplus optAlsaLib optPyqt4
optXdg_utils libxmlxx glibmm
optXdg_utils
];

postPatch = ''
Expand All @@ -62,25 +75,18 @@ stdenv.mkDerivation rec {

# TODO fix ffado-diag, it doesn't seem to use PYPKGDIR
buildPhase = ''
export PYDIR=$out/lib/${python.libPrefix}/site-packages

scons PYPKGDIR=$PYDIR DEBUG=False \
ENABLE_ALL=True \
SERIALIZE_USE_EXPAT=True \
scons ${SCONS_OPTIONS}
'';

installPhase = if libOnly then ''
scons PREFIX=$TMPDIR UDEVDIR=$TMPDIR \
LIBDIR=$out/lib INCLUDEDIR=$out/include install
'' else ''
scons PREFIX=$out PYPKGDIR=$PYDIR UDEVDIR=$out/lib/udev/rules.d install
'' + stdenv.lib.optionalString (optPyqt4 != null && optPythonDBus != null) ''
installPhase = ''
scons ${SCONS_OPTIONS} install
'' + stdenv.lib.optionalString (!libOnly && optPyqt4 != null && optPythonDBus != null) ''
wrapProgram $out/bin/ffado-mixer --prefix PYTHONPATH : \
$PYTHONPATH:$PYDIR:${optPyqt4}/$LIBSUFFIX:${optPythonDBus}/$LIBSUFFIX:
$PYTHONPATH:${PYDIR}:${optPyqt4}/$LIBSUFFIX:${optPythonDBus}/$LIBSUFFIX:

wrapProgram $out/bin/ffado-diag --prefix PYTHONPATH : \
$PYTHONPATH:$PYDIR:$out/share/libffado/python:${optPyqt4}/$LIBSUFFIX:${optPythonDBus}/$LIBSUFFIX:
'';
$PYTHONPATH:${PYDIR}:$out/share/libffado/python:${optPyqt4}/$LIBSUFFIX:${optPythonDBus}/$LIBSUFFIX:
'';

meta = with stdenv.lib; {
homepage = http://www.ffado.org;
Expand Down
Loading