add get* helper functions and mass-replace manual outputs search with them

+67 -64
+4
lib/attrsets.nix
··· 450 then pkg.${output} or pkg.out or pkg 451 else pkg; 452 453 454 /*** deprecated stuff ***/ 455
··· 450 then pkg.${output} or pkg.out or pkg 451 else pkg; 452 453 + getBin = getOutput "bin"; 454 + getLib = getOutput "lib"; 455 + getDev = getOutput "dev"; 456 + 457 458 /*** deprecated stuff ***/ 459
+1 -2
nixos/modules/system/activation/activation-script.nix
··· 12 ''; 13 }); 14 15 - path = map # outputs TODO? 16 - (pkg: (pkg.bin or (pkg.out or pkg))) 17 [ pkgs.coreutils pkgs.gnugrep pkgs.findutils 18 pkgs.glibc # needed for getent 19 pkgs.shadow
··· 12 ''; 13 }); 14 15 + path = map getBin 16 [ pkgs.coreutils pkgs.gnugrep pkgs.findutils 17 pkgs.glibc # needed for getent 18 pkgs.shadow
+22 -22
pkgs/applications/search/recoll/default.nix
··· 1 - { stdenv, fetchurl, bison 2 , qt4, xapian, file, python, perl 3 , djvulibre, groff, libxslt, unzip, poppler_utils, antiword, catdoc, lyx 4 , libwpd, unrtf, untex ··· 26 # the absolute path to the filtering command. 27 postInstall = '' 28 for f in $out/share/recoll/filters/* ; do 29 - substituteInPlace $f --replace antiword ${antiword}/bin/antiword 30 - substituteInPlace $f --replace awk ${gawk}/bin/awk 31 - substituteInPlace $f --replace catppt ${catdoc}/bin/catppt 32 - substituteInPlace $f --replace djvused ${djvulibre.bin}/bin/djvused 33 - substituteInPlace $f --replace djvutxt ${djvulibre.bin}/bin/djvutxt 34 - substituteInPlace $f --replace egrep ${gnugrep}/bin/egrep 35 - substituteInPlace $f --replace groff ${groff}/bin/groff 36 - substituteInPlace $f --replace gunzip ${gzip}/bin/gunzip 37 - substituteInPlace $f --replace iconv ${libiconv.bin or libiconv}/bin/iconv 38 - substituteInPlace $f --replace lyx ${lyx}/bin/lyx 39 - substituteInPlace $f --replace pdftotext ${poppler_utils.out}/bin/pdftotext 40 - substituteInPlace $f --replace pstotext ${ghostscript}/bin/ps2ascii 41 - substituteInPlace $f --replace sed ${gnused}/bin/sed 42 - substituteInPlace $f --replace tar ${gnutar}/bin/tar 43 - substituteInPlace $f --replace unzip ${unzip}/bin/unzip 44 - substituteInPlace $f --replace xls2csv ${catdoc}/bin/xls2csv 45 - substituteInPlace $f --replace xsltproc ${libxslt.bin}/bin/xsltproc 46 - substituteInPlace $f --replace unrtf ${unrtf}/bin/unrtf 47 - substituteInPlace $f --replace untex ${untex}/bin/untex 48 - substituteInPlace $f --replace wpd2html ${libwpd}/bin/wpd2html 49 - substituteInPlace $f --replace /usr/bin/perl ${perl}/bin/perl 50 done 51 ''; 52
··· 1 + { stdenv, fetchurl, lib, bison 2 , qt4, xapian, file, python, perl 3 , djvulibre, groff, libxslt, unzip, poppler_utils, antiword, catdoc, lyx 4 , libwpd, unrtf, untex ··· 26 # the absolute path to the filtering command. 27 postInstall = '' 28 for f in $out/share/recoll/filters/* ; do 29 + substituteInPlace $f --replace antiword ${lib.getBin antiword}/bin/antiword 30 + substituteInPlace $f --replace awk ${lib.getBin gawk}/bin/awk 31 + substituteInPlace $f --replace catppt ${lib.getBin catdoc}/bin/catppt 32 + substituteInPlace $f --replace djvused ${lib.getBin djvulibre}/bin/djvused 33 + substituteInPlace $f --replace djvutxt ${lib.getBin djvulibre}/bin/djvutxt 34 + substituteInPlace $f --replace egrep ${lib.getBin gnugrep}/bin/egrep 35 + substituteInPlace $f --replace groff ${lib.getBin groff}/bin/groff 36 + substituteInPlace $f --replace gunzip ${lib.getBin gzip}/bin/gunzip 37 + substituteInPlace $f --replace iconv ${lib.getBin libiconv}/bin/iconv 38 + substituteInPlace $f --replace lyx ${lib.getBin lyx}/bin/lyx 39 + substituteInPlace $f --replace pdftotext ${lib.getBin poppler_utils}/bin/pdftotext 40 + substituteInPlace $f --replace pstotext ${lib.getBin ghostscript}/bin/ps2ascii 41 + substituteInPlace $f --replace sed ${lib.getBin gnused}/bin/sed 42 + substituteInPlace $f --replace tar ${lib.getBin gnutar}/bin/tar 43 + substituteInPlace $f --replace unzip ${lib.getBin unzip}/bin/unzip 44 + substituteInPlace $f --replace xls2csv ${lib.getBin catdoc}/bin/xls2csv 45 + substituteInPlace $f --replace xsltproc ${lib.getBin libxslt}/bin/xsltproc 46 + substituteInPlace $f --replace unrtf ${lib.getBin unrtf}/bin/unrtf 47 + substituteInPlace $f --replace untex ${lib.getBin untex}/bin/untex 48 + substituteInPlace $f --replace wpd2html ${lib.getBin libwpd}/bin/wpd2html 49 + substituteInPlace $f --replace /usr/bin/perl ${lib.getBin perl}/bin/perl 50 done 51 ''; 52
+6 -6
pkgs/build-support/cc-wrapper/default.nix
··· 27 ccVersion = (builtins.parseDrvName cc.name).version; 28 ccName = (builtins.parseDrvName cc.name).name; 29 30 - libc_bin = if nativeLibc then null else libc.bin or libc; 31 - libc_dev = if nativeLibc then null else libc.dev or libc; 32 - libc_lib = if nativeLibc then null else libc.out or libc; 33 - cc_solib = cc.lib or cc; 34 - binutils_bin = if nativeTools then "" else binutils.bin or binutils; 35 # The wrapper scripts use 'cat' and 'grep', so we may need coreutils. 36 - coreutils_bin = if nativeTools then "" else coreutils.bin or coreutils; 37 in 38 39 stdenv.mkDerivation {
··· 27 ccVersion = (builtins.parseDrvName cc.name).version; 28 ccName = (builtins.parseDrvName cc.name).name; 29 30 + libc_bin = if nativeLibc then null else getBin libc; 31 + libc_dev = if nativeLibc then null else getDev libc; 32 + libc_lib = if nativeLibc then null else getLib libc; 33 + cc_solib = getLib cc; 34 + binutils_bin = if nativeTools then "" else getBin binutils; 35 # The wrapper scripts use 'cat' and 'grep', so we may need coreutils. 36 + coreutils_bin = if nativeTools then "" else getBin coreutils; 37 in 38 39 stdenv.mkDerivation {
+4 -4
pkgs/build-support/gcc-wrapper-old/default.nix
··· 5 # stdenv.mkDerivation provides a wrapper that sets up the right environment 6 # variables so that the compiler and the linker just "work". 7 8 - { name ? "", stdenv, nativeTools, nativeLibc, nativePrefix ? "" 9 , gcc ? null, libc ? null, binutils ? null, coreutils ? null, shell ? "" 10 , zlib ? null 11 }: ··· 41 addFlags = ./add-flags; 42 43 inherit nativeTools nativeLibc nativePrefix gcc; 44 - gcc_lib = gcc.lib or gcc; 45 libc = if nativeLibc then null else libc; 46 - libc_dev = if nativeLibc then null else libc.dev or libc; 47 - libc_bin = if nativeLibc then null else libc.bin or libc; 48 binutils = if nativeTools then null else binutils; 49 # The wrapper scripts use 'cat', so we may need coreutils 50 coreutils = if nativeTools then null else coreutils;
··· 5 # stdenv.mkDerivation provides a wrapper that sets up the right environment 6 # variables so that the compiler and the linker just "work". 7 8 + { name ? "", stdenv, lib, nativeTools, nativeLibc, nativePrefix ? "" 9 , gcc ? null, libc ? null, binutils ? null, coreutils ? null, shell ? "" 10 , zlib ? null 11 }: ··· 41 addFlags = ./add-flags; 42 43 inherit nativeTools nativeLibc nativePrefix gcc; 44 + gcc_lib = lib.getLib gcc; 45 libc = if nativeLibc then null else libc; 46 + libc_dev = if nativeLibc then null else lib.getDev libc; 47 + libc_bin = if nativeLibc then null else lib.getBin libc; 48 binutils = if nativeTools then null else binutils; 49 # The wrapper scripts use 'cat', so we may need coreutils 50 coreutils = if nativeTools then null else coreutils;
+2 -2
pkgs/development/compilers/gcc-arm-embedded/default.nix
··· 33 34 for f in $(find $out); do 35 if [ -f "$f" ] && patchelf "$f" 2> /dev/null; then 36 - patchelf --set-interpreter ${glibc.out}/lib/ld-linux.so.2 \ 37 - --set-rpath $out/lib:${gcc.lib or gcc}/lib:${ncurses.out}/lib \ 38 "$f" || true 39 fi 40 done
··· 33 34 for f in $(find $out); do 35 if [ -f "$f" ] && patchelf "$f" 2> /dev/null; then 36 + patchelf --set-interpreter ${getLib glibc}/lib/ld-linux.so.2 \ 37 + --set-rpath $out/lib:${getLib gcc}/lib:${ncurses.out}/lib \ 38 "$f" || true 39 fi 40 done
+2 -2
pkgs/development/compilers/ghc/6.10.2-binary.nix
··· 1 - {stdenv, fetchurl, perl, libedit, ncurses, gmp}: 2 3 stdenv.mkDerivation rec { 4 version = "6.10.2"; ··· 47 '' else ""); 48 49 configurePhase = '' 50 - ./configure --prefix=$out --with-gmp-libraries=${gmp.out}/lib --with-gmp-includes=${gmp.dev or gmp}/include 51 ''; 52 53 # Stripping combined with patchelf breaks the executables (they die
··· 1 + {stdenv, lib, fetchurl, perl, libedit, ncurses, gmp}: 2 3 stdenv.mkDerivation rec { 4 version = "6.10.2"; ··· 47 '' else ""); 48 49 configurePhase = '' 50 + ./configure --prefix=$out --with-gmp-libraries=${lib.getLib gmp}/lib --with-gmp-includes=${lib.getDev gmp}/include 51 ''; 52 53 # Stripping combined with patchelf breaks the executables (they die
+1 -1
pkgs/development/compilers/go/1.4.nix
··· 58 sed -i 's,/usr/share/zoneinfo/,${tzdata}/share/zoneinfo/,' src/time/zoneinfo_unix.go 59 60 # Find the loader dynamically 61 - LOADER="$(find ${libc.out or libc}/lib -name ld-linux\* | head -n 1)" 62 63 # Replace references to the loader 64 find src/cmd -name asm.c -exec sed -i "s,/lib/ld-linux.*\.so\.[0-9],$LOADER," {} \;
··· 58 sed -i 's,/usr/share/zoneinfo/,${tzdata}/share/zoneinfo/,' src/time/zoneinfo_unix.go 59 60 # Find the loader dynamically 61 + LOADER="$(find ${lib.getLib libc}/lib -name ld-linux\* | head -n 1)" 62 63 # Replace references to the loader 64 find src/cmd -name asm.c -exec sed -i "s,/lib/ld-linux.*\.so\.[0-9],$LOADER," {} \;
+2 -2
pkgs/development/interpreters/perl/default.nix
··· 17 let 18 19 libc = if stdenv.cc.libc or null != null then stdenv.cc.libc else "/usr"; 20 - libcInc = libc.dev or libc; 21 - libcLib = libc.out or libc; 22 common = { version, sha256 }: stdenv.mkDerivation rec { 23 name = "perl-${version}"; 24
··· 17 let 18 19 libc = if stdenv.cc.libc or null != null then stdenv.cc.libc else "/usr"; 20 + libcInc = lib.getDev libc; 21 + libcLib = lib.getLib libc; 22 common = { version, sha256 }: stdenv.mkDerivation rec { 23 name = "perl-${version}"; 24
+3 -4
pkgs/development/interpreters/pypy/default.nix
··· 25 ++ stdenv.lib.optional (stdenv ? cc && stdenv.cc.libc != null) stdenv.cc.libc 26 ++ stdenv.lib.optional zlibSupport zlib; 27 28 - C_INCLUDE_PATH = stdenv.lib.concatStringsSep ":" (map (p: "${p.dev or p}/include") buildInputs); 29 - LIBRARY_PATH = stdenv.lib.concatStringsSep ":" (map (p: "${p.lib or p.out or p}/lib") buildInputs); 30 - LD_LIBRARY_PATH = stdenv.lib.concatStringsSep ":" (map (p: "${p.lib or p.out or p}/lib") 31 - (stdenv.lib.filter (x : x.outPath != stdenv.cc.libc.outPath or "") buildInputs)); 32 33 preConfigure = '' 34 # hint pypy to find nix ncurses
··· 25 ++ stdenv.lib.optional (stdenv ? cc && stdenv.cc.libc != null) stdenv.cc.libc 26 ++ stdenv.lib.optional zlibSupport zlib; 27 28 + C_INCLUDE_PATH = stdenv.lib.makeSearchPathOutput "dev" "include" buildInputs; 29 + LIBRARY_PATH = stdenv.lib.makeLibraryPath buildInputs; 30 + LD_LIBRARY_PATH = stdenv.lib.makeLibraryPath (stdenv.lib.filter (x : x.outPath != stdenv.cc.libc.outPath or "") buildInputs); 31 32 preConfigure = '' 33 # hint pypy to find nix ncurses
+2 -2
pkgs/development/interpreters/python/2.6/default.nix
··· 53 ++ optional zlibSupport zlib; 54 55 mkPaths = paths: { 56 - C_INCLUDE_PATH = concatStringsSep ":" (map (p: "${p.dev or p}/include") paths); 57 - LIBRARY_PATH = concatStringsSep ":" (map (p: "${p.lib or (p.out or p)}/lib") paths); 58 }; 59 60 # Build the basic Python interpreter without modules that have
··· 53 ++ optional zlibSupport zlib; 54 55 mkPaths = paths: { 56 + C_INCLUDE_PATH = makeSearchPathOutput "dev" "include" paths; 57 + LIBRARY_PATH = makeLibraryPath paths; 58 }; 59 60 # Build the basic Python interpreter without modules that have
+2 -2
pkgs/development/interpreters/python/2.7/default.nix
··· 102 propagatedBuildInputs = optional stdenv.isDarwin configd; 103 104 mkPaths = paths: { 105 - C_INCLUDE_PATH = concatStringsSep ":" (map (p: "${p.dev or p}/include") paths); 106 - LIBRARY_PATH = concatStringsSep ":" (map (p: "${p.lib or (p.out or p)}/lib") paths); 107 }; 108 109 # Build the basic Python interpreter without modules that have
··· 102 propagatedBuildInputs = optional stdenv.isDarwin configd; 103 104 mkPaths = paths: { 105 + C_INCLUDE_PATH = makeSearchPathOutput "dev" "include" paths; 106 + LIBRARY_PATH = makeLibraryPath paths; 107 }; 108 109 # Build the basic Python interpreter without modules that have
+2 -2
pkgs/development/interpreters/python/3.2/default.nix
··· 44 ${optionalString stdenv.isDarwin ''export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -msse2"''} 45 46 configureFlagsArray=( --enable-shared --with-threads --with-wide-unicode 47 - CPPFLAGS="${concatStringsSep " " (map (p: "-I${p.dev or p}/include") buildInputs)}" 48 - LDFLAGS="${concatStringsSep " " (map (p: "-L${p.lib or (p.out or p)}/lib") buildInputs)}" 49 LIBS="${optionalString (!stdenv.isDarwin) "-lcrypt"} ${optionalString (ncurses != null) "-lncurses"}" 50 ) 51 '';
··· 44 ${optionalString stdenv.isDarwin ''export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -msse2"''} 45 46 configureFlagsArray=( --enable-shared --with-threads --with-wide-unicode 47 + CPPFLAGS="${makeSearchPathOutput "dev" "include" buildInputs}" 48 + LDFLAGS="${makeLibraryPath buildInputs}" 49 LIBS="${optionalString (!stdenv.isDarwin) "-lcrypt"} ${optionalString (ncurses != null) "-lncurses"}" 50 ) 51 '';
+2 -2
pkgs/development/interpreters/python/3.3/default.nix
··· 46 ${optionalString stdenv.isDarwin ''export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -msse2"''} 47 48 configureFlagsArray=( --enable-shared --with-threads 49 - CPPFLAGS="${concatStringsSep " " (map (p: "-I${p.dev or p}/include") buildInputs)}" 50 - LDFLAGS="${concatStringsSep " " (map (p: "-L${p.lib or (p.out or p)}/lib") buildInputs)}" 51 LIBS="${optionalString (!stdenv.isDarwin) "-lcrypt"} ${optionalString (ncurses != null) "-lncurses"}" 52 ) 53 '';
··· 46 ${optionalString stdenv.isDarwin ''export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -msse2"''} 47 48 configureFlagsArray=( --enable-shared --with-threads 49 + CPPFLAGS="${makeSearchPathOutput "dev" "include" buildInputs}" 50 + LDFLAGS="${makeLibraryPath buildInputs}" 51 LIBS="${optionalString (!stdenv.isDarwin) "-lcrypt"} ${optionalString (ncurses != null) "-lncurses"}" 52 ) 53 '';
+2 -2
pkgs/development/interpreters/python/3.4/default.nix
··· 58 ''} 59 60 configureFlagsArray=( --enable-shared --with-threads 61 - CPPFLAGS="${concatStringsSep " " (map (p: "-I${p.dev or p}/include") buildInputs)}" 62 - LDFLAGS="${concatStringsSep " " (map (p: "-L${p.lib or (p.out or p)}/lib") buildInputs)}" 63 LIBS="${optionalString (!stdenv.isDarwin) "-lcrypt"} ${optionalString (ncurses != null) "-lncurses"}" 64 ) 65 '';
··· 58 ''} 59 60 configureFlagsArray=( --enable-shared --with-threads 61 + CPPFLAGS="${makeSearchPathOutput "dev" "include" buildInputs}" 62 + LDFLAGS="${makeLibraryPath buildInputs}" 63 LIBS="${optionalString (!stdenv.isDarwin) "-lcrypt"} ${optionalString (ncurses != null) "-lncurses"}" 64 ) 65 '';
+2 -2
pkgs/development/interpreters/python/3.5/default.nix
··· 58 ''} 59 60 configureFlagsArray=( --enable-shared --with-threads 61 - CPPFLAGS="${concatStringsSep " " (map (p: "-I${p.dev or p}/include") buildInputs)}" 62 - LDFLAGS="${concatStringsSep " " (map (p: "-L${p.lib or (p.out or p)}/lib") buildInputs)}" 63 LIBS="${optionalString (!stdenv.isDarwin) "-lcrypt"} ${optionalString (ncurses != null) "-lncurses"}" 64 ) 65 '';
··· 58 ''} 59 60 configureFlagsArray=( --enable-shared --with-threads 61 + CPPFLAGS="${makeSearchPathOutput "dev" "include" buildInputs}" 62 + LDFLAGS="${makeLibraryPath buildInputs}" 63 LIBS="${optionalString (!stdenv.isDarwin) "-lcrypt"} ${optionalString (ncurses != null) "-lncurses"}" 64 ) 65 '';
+3 -3
pkgs/development/tools/build-managers/cmake/default.nix
··· 47 '' 48 fixCmakeFiles . 49 substituteInPlace Modules/Platform/UnixPaths.cmake \ 50 - --subst-var-by glibc_bin ${glibc.bin or glibc} \ 51 - --subst-var-by glibc_dev ${glibc.dev or glibc} \ 52 - --subst-var-by glibc_lib ${glibc.out or glibc} 53 ''; 54 configureFlags = 55 [ "--docdir=/share/doc/${name}"
··· 47 '' 48 fixCmakeFiles . 49 substituteInPlace Modules/Platform/UnixPaths.cmake \ 50 + --subst-var-by glibc_bin ${getBin glibc} \ 51 + --subst-var-by glibc_dev ${getDev glibc} \ 52 + --subst-var-by glibc_lib ${getLib glibc} 53 ''; 54 configureFlags = 55 [ "--docdir=/share/doc/${name}"
+3 -2
pkgs/misc/emulators/wine/base.nix
··· 32 # them to the RPATH so that the user doesn't have to set them in 33 # LD_LIBRARY_PATH. 34 NIX_LDFLAGS = map (path: "-rpath " + path) ( 35 - map (x: "${x}/lib") ([ stdenv.cc.cc ] ++ (map (x: x.lib or x.out) buildInputs)) 36 # libpulsecommon.so is linked but not found otherwise 37 - ++ lib.optionals pulseaudioSupport (map (x: "${x}/lib/pulseaudio") (toBuildInputs pkgArches (pkgs: [ pkgs.libpulseaudio ]))) 38 ); 39 40 # Don't shrink the ELF RPATHs in order to keep the extra RPATH
··· 32 # them to the RPATH so that the user doesn't have to set them in 33 # LD_LIBRARY_PATH. 34 NIX_LDFLAGS = map (path: "-rpath " + path) ( 35 + map (x: "${lib.getLib x}/lib") ([ stdenv.cc.cc ] ++ buildInputs) 36 # libpulsecommon.so is linked but not found otherwise 37 + ++ lib.optionals pulseaudioSupport (map (x: "${lib.getLib x}/lib/pulseaudio") 38 + (toBuildInputs pkgArches (pkgs: [ pkgs.libpulseaudio ]))) 39 ); 40 41 # Don't shrink the ELF RPATHs in order to keep the extra RPATH
+1 -1
pkgs/stdenv/darwin/make-bootstrap-tools.nix
··· 62 cp -d ${openssl.out}/lib/*.dylib $out/lib 63 64 cp -d ${gnugrep.pcre.out}/lib/libpcre*.dylib $out/lib 65 - cp -d ${libiconv.lib or libiconv}/lib/lib*.dylib $out/lib 66 cp -d ${gettext}/lib/libintl*.dylib $out/lib 67 chmod +x $out/lib/libintl*.dylib 68 cp -d ${ncurses.out}/lib/libncurses*.dylib $out/lib
··· 62 cp -d ${openssl.out}/lib/*.dylib $out/lib 63 64 cp -d ${gnugrep.pcre.out}/lib/libpcre*.dylib $out/lib 65 + cp -d ${lib.getLib libiconv}/lib/lib*.dylib $out/lib 66 cp -d ${gettext}/lib/libintl*.dylib $out/lib 67 chmod +x $out/lib/libintl*.dylib 68 cp -d ${ncurses.out}/lib/libncurses*.dylib $out/lib
+1 -1
pkgs/stdenv/generic/default.nix
··· 223 # include it in the result, it *is* available to nix-env for queries. 224 meta = { } 225 # If the packager hasn't specified `outputsToInstall`, choose a default, 226 - # namely `p.bin or p.out or p`; 227 # if he has specified it, it will be overridden below in `// meta`. 228 # Note: This default probably shouldn't be globally configurable. 229 # Services and users should specify outputs explicitly,
··· 223 # include it in the result, it *is* available to nix-env for queries. 224 meta = { } 225 # If the packager hasn't specified `outputsToInstall`, choose a default, 226 + # namely `lib.getBin p`; 227 # if he has specified it, it will be overridden below in `// meta`. 228 # Note: This default probably shouldn't be globally configurable. 229 # Services and users should specify outputs explicitly,