about summary refs log tree commit diff
path: root/pkgs/servers/pulseaudio
diff options
context:
space:
mode:
authorWilliam A. Kennington III <william@wkennington.com>2015-05-22 12:59:21 -0700
committerWilliam A. Kennington III <william@wkennington.com>2015-05-22 13:26:55 -0700
commit25a148fa196b944b3f134527da87e43d88c066f9 (patch)
treeb75635c87759b11e52eba1bd7d02116257571b8a /pkgs/servers/pulseaudio
parent50fa9d8eeab5e90e8d673c5d65a0af2a7c57b2fe (diff)
downloadnixlib-25a148fa196b944b3f134527da87e43d88c066f9.tar
nixlib-25a148fa196b944b3f134527da87e43d88c066f9.tar.gz
nixlib-25a148fa196b944b3f134527da87e43d88c066f9.tar.bz2
nixlib-25a148fa196b944b3f134527da87e43d88c066f9.tar.lz
nixlib-25a148fa196b944b3f134527da87e43d88c066f9.tar.xz
nixlib-25a148fa196b944b3f134527da87e43d88c066f9.tar.zst
nixlib-25a148fa196b944b3f134527da87e43d88c066f9.zip
Refactor mkFlag / shouldUsePkg into the nixpkgs libraries
Diffstat (limited to 'pkgs/servers/pulseaudio')
-rw-r--r--pkgs/servers/pulseaudio/default.nix21
1 files changed, 7 insertions, 14 deletions
diff --git a/pkgs/servers/pulseaudio/default.nix b/pkgs/servers/pulseaudio/default.nix
index 8dee9a801e36..784b5a2ce94f 100644
--- a/pkgs/servers/pulseaudio/default.nix
+++ b/pkgs/servers/pulseaudio/default.nix
@@ -15,16 +15,8 @@
 , 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;
@@ -66,6 +58,7 @@ let
     simple = null;
   }.${databaseName};
 in
+with stdenv.lib;
 stdenv.mkDerivation rec {
   name = "${prefix}pulseaudio-${version}";
   version = "6.0";
@@ -84,9 +77,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
-  ] ++ stdenv.lib.optionals hasXlibs (with xlibs; [
+  ] ++ optionals hasXlibs (with xlibs; [
       libX11 libxcb libICE libSM libXtst xextproto libXi
-    ]) ++ stdenv.lib.optionals (optBluez5 != null) [ optBluez5 optSbc ];
+    ]) ++ optionals (optBluez5 != null) [ optBluez5 optSbc ];
 
   preConfigure = ''
     # Performs and autoreconf
@@ -162,7 +155,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 = stdenv.lib.optionalString stdenv.isDarwin
+  NIX_CFLAGS_COMPILE = optionalString stdenv.isDarwin
     "-I/usr/include";
 
   installFlags = [
@@ -170,11 +163,11 @@ stdenv.mkDerivation rec {
     "pulseconfdir=$(out)/etc/pulse"
   ];
 
-  postInstall = stdenv.lib.optionalString libOnly ''
+  postInstall = optionalString libOnly ''
     rm -rf $out/{bin,share,etc,lib/{pulse-*,systemd}}
   '';
 
-  meta = with stdenv.lib; {
+  meta = {
     description = "Sound server for POSIX and Win32 systems";
     homepage    = http://www.pulseaudio.org/;
     # Note: Practically, the server is under the GPL due to the