summary refs log tree commit diff
path: root/pkgs/servers/pulseaudio/default.nix
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2015-06-01 20:52:03 +0200
committerEelco Dolstra <eelco.dolstra@logicblox.com>2015-06-04 14:54:48 +0200
commit3096d03435bb177af8c4868a8efa637b393f2715 (patch)
treeb5353e40eb18bba0e86b04a176879f3e635f48e7 /pkgs/servers/pulseaudio/default.nix
parent4f60156afbb8d61d8d28db8ab594ec9328946d71 (diff)
downloadnixlib-3096d03435bb177af8c4868a8efa637b393f2715.tar
nixlib-3096d03435bb177af8c4868a8efa637b393f2715.tar.gz
nixlib-3096d03435bb177af8c4868a8efa637b393f2715.tar.bz2
nixlib-3096d03435bb177af8c4868a8efa637b393f2715.tar.lz
nixlib-3096d03435bb177af8c4868a8efa637b393f2715.tar.xz
nixlib-3096d03435bb177af8c4868a8efa637b393f2715.tar.zst
nixlib-3096d03435bb177af8c4868a8efa637b393f2715.zip
Revert "Refactor mkFlag / shouldUsePkg into the nixpkgs libraries"
This reverts commit 25a148fa196b944b3f134527da87e43d88c066f9.
Diffstat (limited to 'pkgs/servers/pulseaudio/default.nix')
-rw-r--r--pkgs/servers/pulseaudio/default.nix21
1 files changed, 14 insertions, 7 deletions
diff --git a/pkgs/servers/pulseaudio/default.nix b/pkgs/servers/pulseaudio/default.nix
index 3930c45a0976..8196caa08d9d 100644
--- a/pkgs/servers/pulseaudio/default.nix
+++ b/pkgs/servers/pulseaudio/default.nix
@@ -15,8 +15,16 @@
 , prefix ? ""
 }:
 
-with stdenv;
 let
+  mkFlag = trueStr: falseStr: cond: name: val:
+    if cond == null then null else
+      "--${if cond != false then trueStr else falseStr}${name}${if val != null && cond != false then "=${val}" else ""}";
+  mkEnable = mkFlag "enable-" "disable-";
+  mkWith = mkFlag "with-" "without-";
+  mkOther = mkFlag "" "" true;
+
+  shouldUsePkg = pkg: if pkg != null && stdenv.lib.any (x: x == stdenv.system) pkg.meta.platforms then pkg else null;
+
   libOnly = prefix == "lib";
 
   hasXlibs = xlibs != null;
@@ -58,7 +66,6 @@ let
     simple = null;
   }.${databaseName};
 in
-with stdenv.lib;
 stdenv.mkDerivation rec {
   name = "${prefix}pulseaudio-${version}";
   version = "6.0";
@@ -77,9 +84,9 @@ stdenv.mkDerivation rec {
     optLibcap valgrind optOss optCoreaudio optAlsaLib optEsound optGlib
     optGtk3 optGconf optAvahi optLibjack2 optLibasyncns optLirc optDbus optUdev
     optOpenssl optFftw optSpeexdsp optSystemd optWebrtc-audio-processing
-  ] ++ optionals hasXlibs (with xlibs; [
+  ] ++ stdenv.lib.optionals hasXlibs (with xlibs; [
       libX11 libxcb libICE libSM libXtst xextproto libXi
-    ]) ++ optionals (optBluez5 != null) [ optBluez5 optSbc ];
+    ]) ++ stdenv.lib.optionals (optBluez5 != null) [ optBluez5 optSbc ];
 
   preConfigure = ''
     # Performs and autoreconf
@@ -155,7 +162,7 @@ stdenv.mkDerivation rec {
   # the alternative is to copy the files from /usr/include to src, but there are
   # probably a large number of files that would need to be copied (I stopped
   # after the seventh)
-  NIX_CFLAGS_COMPILE = optionalString stdenv.isDarwin
+  NIX_CFLAGS_COMPILE = stdenv.lib.optionalString stdenv.isDarwin
     "-I/usr/include";
 
   installFlags = [
@@ -163,11 +170,11 @@ stdenv.mkDerivation rec {
     "pulseconfdir=$(out)/etc/pulse"
   ];
 
-  postInstall = optionalString libOnly ''
+  postInstall = stdenv.lib.optionalString libOnly ''
     rm -rf $out/{bin,share,etc,lib/{pulse-*,systemd}}
   '';
 
-  meta = {
+  meta = with stdenv.lib; {
     description = "Sound server for POSIX and Win32 systems";
     homepage    = http://www.pulseaudio.org/;
     # Note: Practically, the server is under the GPL due to the