summary refs log tree commit diff
diff options
context:
space:
mode:
authorMatthew Bauer <mjbauer95@gmail.com>2018-11-11 20:52:07 -0600
committerMatthew Bauer <mjbauer95@gmail.com>2018-11-13 19:14:10 -0600
commitbfbfe941abba2a0d7061c86d78b1e8facdeb17f8 (patch)
tree2f6b86640ce155d6ecf2c5ec79811ad63c2cc703
parent1ba9fd335d90bca03b3868d3bf10c3d9a9de29c6 (diff)
downloadnixpkgs-bfbfe941abba2a0d7061c86d78b1e8facdeb17f8.tar
nixpkgs-bfbfe941abba2a0d7061c86d78b1e8facdeb17f8.tar.gz
nixpkgs-bfbfe941abba2a0d7061c86d78b1e8facdeb17f8.tar.bz2
nixpkgs-bfbfe941abba2a0d7061c86d78b1e8facdeb17f8.tar.lz
nixpkgs-bfbfe941abba2a0d7061c86d78b1e8facdeb17f8.tar.xz
nixpkgs-bfbfe941abba2a0d7061c86d78b1e8facdeb17f8.tar.zst
nixpkgs-bfbfe941abba2a0d7061c86d78b1e8facdeb17f8.zip
treewide: use scons setup hook
Lots of packages can use it. Here is the list:

- jackmix
- klick
- mixx
- nova-filters
- rhvoice
- giv
- mypaint
- swift-im
- bombono
- mapnik
- serf
- nuitka
- pyexiv2
- godot
- hammer
- toluapp
- btanks
- dxx-rebirth
- endless-sky
- globulation
- the-powder-toy
- fceux
- gpsd
- mongodb
- rippled
- mariadb
- lprof
-rw-r--r--pkgs/applications/audio/jackmix/default.nix6
-rw-r--r--pkgs/applications/audio/klick/default.nix9
-rw-r--r--pkgs/applications/audio/mixxx/default.nix17
-rw-r--r--pkgs/applications/audio/nova-filters/default.nix8
-rw-r--r--pkgs/applications/audio/rhvoice/default.nix12
-rw-r--r--pkgs/applications/graphics/giv/default.nix8
-rw-r--r--pkgs/applications/graphics/mypaint/default.nix5
-rw-r--r--pkgs/applications/networking/instant-messengers/swift-im/default.nix14
-rw-r--r--pkgs/applications/video/bombono/default.nix8
-rw-r--r--pkgs/development/libraries/mapnik/default.nix61
-rw-r--r--pkgs/development/libraries/serf/default.nix28
-rw-r--r--pkgs/development/libraries/swiften/default.nix22
-rw-r--r--pkgs/development/python-modules/nuitka/default.nix5
-rw-r--r--pkgs/development/python-modules/pyexiv2/default.nix7
-rw-r--r--pkgs/development/tools/godot/default.nix7
-rw-r--r--pkgs/development/tools/parsing/hammer/default.nix4
-rw-r--r--pkgs/development/tools/toluapp/default.nix7
-rw-r--r--pkgs/games/btanks/default.nix31
-rw-r--r--pkgs/games/dxx-rebirth/default.nix13
-rw-r--r--pkgs/games/endless-sky/default.nix10
-rw-r--r--pkgs/games/globulation/default.nix17
-rw-r--r--pkgs/games/the-powder-toy/default.nix2
-rw-r--r--pkgs/misc/emulators/fceux/default.nix10
-rw-r--r--pkgs/servers/gpsd/default.nix28
-rw-r--r--pkgs/servers/nosql/mongodb/default.nix44
-rw-r--r--pkgs/servers/rippled/default.nix8
-rw-r--r--pkgs/servers/sql/mariadb/default.nix8
-rw-r--r--pkgs/tools/graphics/lprof/default.nix12
28 files changed, 150 insertions, 261 deletions
diff --git a/pkgs/applications/audio/jackmix/default.nix b/pkgs/applications/audio/jackmix/default.nix
index aa78527d787..83644dd5ea5 100644
--- a/pkgs/applications/audio/jackmix/default.nix
+++ b/pkgs/applications/audio/jackmix/default.nix
@@ -17,12 +17,8 @@ stdenv.mkDerivation rec {
     jack
   ];
 
-  buildPhase = ''
-    scons
-  '';
   installPhase = ''
-    mkdir -p $out/bin
-    cp jackmix/jackmix $out/bin
+    install -D jackmix/jackmix $out/bin/jackmix
   '';
 
   meta = {
diff --git a/pkgs/applications/audio/klick/default.nix b/pkgs/applications/audio/klick/default.nix
index 3a0da876acf..4d1ae8ebd58 100644
--- a/pkgs/applications/audio/klick/default.nix
+++ b/pkgs/applications/audio/klick/default.nix
@@ -12,15 +12,9 @@ stdenv.mkDerivation rec {
 
   nativeBuildInputs = [ pkgconfig ];
   buildInputs = [ scons libsamplerate libsndfile liblo libjack2 boost ];
+  prefixKey = "PREFIX=";
   NIX_CFLAGS_COMPILE = "-fpermissive";
 
-  buildPhase = ''
-    mkdir -p $out
-    scons PREFIX=$out
-  '';
-
-  installPhase = "scons install";
-
   meta = {
     homepage = http://das.nasophon.de/klick/;
     description = "Advanced command-line metronome for JACK";
@@ -28,4 +22,3 @@ stdenv.mkDerivation rec {
     platforms = stdenv.lib.platforms.linux;
   };
 }
-
diff --git a/pkgs/applications/audio/mixxx/default.nix b/pkgs/applications/audio/mixxx/default.nix
index a99683ef994..4c84fb3c3f7 100644
--- a/pkgs/applications/audio/mixxx/default.nix
+++ b/pkgs/applications/audio/mixxx/default.nix
@@ -32,26 +32,11 @@ stdenv.mkDerivation rec {
     "opus=1"
   ];
 
-  buildPhase = ''
-    runHook preBuild
-    mkdir -p "$out"
-    scons \
-      -j$NIX_BUILD_CORES -l$NIX_BUILD_CORES \
-      $sconsFlags "prefix=$out"
-    runHook postBuild
-  '';
-
-  installPhase = ''
-    runHook preInstall
-    scons $sconsFlags "prefix=$out" install
-    runHook postInstall
-  '';
-
   fixupPhase = ''
     wrapProgram $out/bin/mixxx \
       --set LOCALE_ARCHIVE ${glibcLocales}/lib/locale/locale-archive;
   '';
-    
+
   meta = with stdenv.lib; {
     homepage = https://mixxx.org;
     description = "Digital DJ mixing software";
diff --git a/pkgs/applications/audio/nova-filters/default.nix b/pkgs/applications/audio/nova-filters/default.nix
index e65604e974a..1e52ff2d9e4 100644
--- a/pkgs/applications/audio/nova-filters/default.nix
+++ b/pkgs/applications/audio/nova-filters/default.nix
@@ -21,14 +21,6 @@ stdenv.mkDerivation rec {
     sed -i "s/= check/= detail::filter_base<internal_type, checked>::check/" nova/source/dsp/filter.hpp
   '';
 
-  buildPhase = ''
-    scons
-  '';
-
-  installPhase = ''
-    scons $sconsFlags "prefix=$out" install
-  '';
-
   meta = with stdenv.lib; {
     description = "LADSPA plugins based on filters of nova";
     homepage = http://klingt.org/~tim/nova-filters/;
diff --git a/pkgs/applications/audio/rhvoice/default.nix b/pkgs/applications/audio/rhvoice/default.nix
index 65cb7dab34a..6516532df33 100644
--- a/pkgs/applications/audio/rhvoice/default.nix
+++ b/pkgs/applications/audio/rhvoice/default.nix
@@ -1,5 +1,5 @@
-{ stdenv, lib, pkgconfig, fetchFromGitHub, scons, python, glibmm, libpulseaudio, libao
-}:
+{ stdenv, lib, pkgconfig, fetchFromGitHub, scons
+, python, glibmm, libpulseaudio, libao }:
 
 let
   version = "unstable-2018-02-10";
@@ -30,14 +30,6 @@ in stdenv.mkDerivation rec {
 
   patches = [ ./honor_nix_environment.patch ];
 
-  buildPhase = ''
-    scons prefix=$out
-  '';
-
-  installPhase = ''
-    scons install
-  '';
-
   meta = {
     description = "A free and open source speech synthesizer for Russian language and others";
     homepage = https://github.com/Olga-Yakovleva/RHVoice/wiki;
diff --git a/pkgs/applications/graphics/giv/default.nix b/pkgs/applications/graphics/giv/default.nix
index fbc84521de0..c5eb126cfbf 100644
--- a/pkgs/applications/graphics/giv/default.nix
+++ b/pkgs/applications/graphics/giv/default.nix
@@ -1,5 +1,5 @@
-{ stdenv, fetchFromGitHub, gdk_pixbuf, scons, pkgconfig, gtk2, glib,
-  pcre, cfitsio, perl, gob2, vala, libtiff, json-glib }:
+{ stdenv, fetchFromGitHub, gdk_pixbuf, scons, pkgconfig, gtk2, glib
+, pcre, cfitsio, perl, gob2, vala, libtiff, json-glib }:
 
 stdenv.mkDerivation rec {
   name = "giv-${version}";
@@ -21,10 +21,6 @@ stdenv.mkDerivation rec {
 
   patches = [ ./build.patch ];
 
-  buildPhase = "scons";
-
-  installPhase = "scons install";
-
   nativeBuildInputs = [ scons pkgconfig vala perl gob2 ];
   buildInputs = [ gdk_pixbuf gtk2 glib pcre cfitsio libtiff json-glib ];
 
diff --git a/pkgs/applications/graphics/mypaint/default.nix b/pkgs/applications/graphics/mypaint/default.nix
index 120fc1174cd..a22f9c7ac1f 100644
--- a/pkgs/applications/graphics/mypaint/default.nix
+++ b/pkgs/applications/graphics/mypaint/default.nix
@@ -26,10 +26,7 @@ in stdenv.mkDerivation rec {
 
   propagatedBuildInputs = [ numpy ];
 
-  buildPhase = "scons prefix=$out";
-
-  installPhase = ''
-    scons prefix=$out install
+  postInstall = ''
     sed -i -e 's|/usr/bin/env python2.7|${python}/bin/python|' $out/bin/mypaint
   '';
 
diff --git a/pkgs/applications/networking/instant-messengers/swift-im/default.nix b/pkgs/applications/networking/instant-messengers/swift-im/default.nix
index 8316c560b06..51e7f081d1e 100644
--- a/pkgs/applications/networking/instant-messengers/swift-im/default.nix
+++ b/pkgs/applications/networking/instant-messengers/swift-im/default.nix
@@ -3,9 +3,7 @@
 , lua, miniupnpc, openssl, qtbase, qtmultimedia, qtsvg, qtwebkit, qtx11extras, zlib
 }:
 
-let
-  _scons = "scons -j$NIX_BUILD_CORES";
-in stdenv.mkDerivation rec {
+stdenv.mkDerivation rec {
   name = "swift-im-${version}";
   version = "4.0.2";
 
@@ -30,14 +28,12 @@ in stdenv.mkDerivation rec {
     "-I${miniupnpc}/include/miniupnpc"
     "-I${qtwebkit.dev}/include/QtWebKit"
     "-I${qtwebkit.dev}/include/QtWebKitWidgets"
+    "-fpermissive"
   ];
 
-  buildPhase = ''
-    ${_scons} Swift
-  '';
-
-  installPhase = ''
-    ${_scons} SWIFT_INSTALLDIR=$out $out
+  preInstall = ''
+    installTargets="$out"
+    installFlags+=" SWIFT_INSTALLDIR=$out"
   '';
 
   meta = with stdenv.lib; {
diff --git a/pkgs/applications/video/bombono/default.nix b/pkgs/applications/video/bombono/default.nix
index e3ba331e437..ad095ddbea5 100644
--- a/pkgs/applications/video/bombono/default.nix
+++ b/pkgs/applications/video/bombono/default.nix
@@ -35,16 +35,10 @@ stdenv.mkDerivation rec {
     libxmlxx ffmpeg enca
     ];
 
-  buildPhase = ''
-    scons PREFIX=$out -j$NIX_BUILD_CORES -l$NIX_BUILD_CORES
-    '';
+  prefixKey = "PREFIX=";
 
   enableParallelBuilding = true;
 
-  installPhase = ''
-    scons install
-    '';
-
   meta = {
     description = "a DVD authoring program for personal computers";
     homepage = "http://www.bombono.org/";
diff --git a/pkgs/development/libraries/mapnik/default.nix b/pkgs/development/libraries/mapnik/default.nix
index 693260af1c7..5a6a44285ed 100644
--- a/pkgs/development/libraries/mapnik/default.nix
+++ b/pkgs/development/libraries/mapnik/default.nix
@@ -29,40 +29,35 @@ stdenv.mkDerivation rec {
       postgresql
     ];
 
-  configurePhase = ''
-    scons configure PREFIX="$out" BOOST_INCLUDES="${boost.dev}/include" \
-                                  BOOST_LIBS="${boost.out}/lib" \
-                                  CAIRO_INCLUDES="${cairo.dev}/include" \
-                                  CAIRO_LIBS="${cairo.out}/lib" \
-                                  FREETYPE_INCLUDES="${freetype.dev}/include" \
-                                  FREETYPE_LIBS="${freetype.out}/lib" \
-                                  GDAL_CONFIG="${gdal}/bin/gdal-config" \
-                                  HB_INCLUDES="${harfbuzz.dev}/include" \
-                                  HB_LIBS="${harfbuzz.out}/lib" \
-                                  ICU_INCLUDES="${icu.dev}/include" \
-                                  ICU_LIBS="${icu.out}/lib" \
-                                  JPEG_INCLUDES="${libjpeg.dev}/include" \
-                                  JPEG_LIBS="${libjpeg.out}/lib" \
-                                  PNG_INCLUDES="${libpng.dev}/include" \
-                                  PNG_LIBS="${libpng.out}/lib" \
-                                  PROJ_INCLUDES="${proj}/include" \
-                                  PROJ_LIBS="${proj}/lib" \
-                                  SQLITE_INCLUDES="${sqlite.dev}/include" \
-                                  SQLITE_LIBS="${sqlite.out}/lib" \
-                                  TIFF_INCLUDES="${libtiff.dev}/include" \
-                                  TIFF_LIBS="${libtiff.out}/lib" \
-                                  WEBP_INCLUDES="${libwebp}/include" \
-                                  WEBP_LIBS="${libwebp}/lib" \
-                                  XML2_INCLUDES="${libxml2.dev}/include" \
-                                  XML2_LIBS="${libxml2.out}/lib"
-  '';
+  prefixKey = "PREFIX=";
 
-  buildPhase = false;
-
-  installPhase = ''
-    mkdir -p "$out"
-    scons install
-  '';
+  sconsFlags = [
+    "BOOST_INCLUDES=${boost.dev}/include"
+    "BOOST_LIBS=${boost.out}/lib"
+    "CAIRO_INCLUDES=${cairo.dev}/include"
+    "CAIRO_LIBS=${cairo.out}/lib"
+    "FREETYPE_INCLUDES=${freetype.dev}/include"
+    "FREETYPE_LIBS=${freetype.out}/lib"
+    "GDAL_CONFIG=${gdal}/bin/gdal-config"
+    "HB_INCLUDES=${harfbuzz.dev}/include"
+    "HB_LIBS=${harfbuzz.out}/lib"
+    "ICU_INCLUDES=${icu.dev}/include"
+    "ICU_LIBS=${icu.out}/lib"
+    "JPEG_INCLUDES=${libjpeg.dev}/include"
+    "JPEG_LIBS=${libjpeg.out}/lib"
+    "PNG_INCLUDES=${libpng.dev}/include"
+    "PNG_LIBS=${libpng.out}/lib"
+    "PROJ_INCLUDES=${proj}/include"
+    "PROJ_LIBS=${proj}/lib"
+    "SQLITE_INCLUDES=${sqlite.dev}/include"
+    "SQLITE_LIBS=${sqlite.out}/lib"
+    "TIFF_INCLUDES=${libtiff.dev}/include"
+    "TIFF_LIBS=${libtiff.out}/lib"
+    "WEBP_INCLUDES=${libwebp}/include"
+    "WEBP_LIBS=${libwebp}/lib"
+    "XML2_INCLUDES=${libxml2.dev}/include"
+    "XML2_LIBS=${libxml2.out}/lib"
+  ];
 
   meta = with stdenv.lib; {
     description = "An open source toolkit for developing mapping applications";
diff --git a/pkgs/development/libraries/serf/default.nix b/pkgs/development/libraries/serf/default.nix
index f794c3841b9..3fd47125bcb 100644
--- a/pkgs/development/libraries/serf/default.nix
+++ b/pkgs/development/libraries/serf/default.nix
@@ -9,28 +9,22 @@ stdenv.mkDerivation rec {
     sha256 = "1k47gbgpp52049andr28y28nbwh9m36bbb0g8p0aka3pqlhjv72l";
   };
 
-  nativeBuildInputs = [ pkgconfig ];
-  buildInputs = [ apr scons openssl aprutil zlib libiconv ]
+  nativeBuildInputs = [ pkgconfig scons ];
+  buildInputs = [ apr openssl aprutil zlib libiconv ]
     ++ stdenv.lib.optional (!stdenv.isCygwin) kerberos;
 
   patches = [ ./scons.patch ];
 
-  buildPhase = ''
-    scons \
-      -j $NIX_BUILD_CORES \
-      APR="$(echo ${apr.dev}/bin/*-config)" \
-      APU="$(echo ${aprutil.dev}/bin/*-config)" \
-      CC=$CC \
-      OPENSSL=${openssl} \
-      PREFIX="$out" \
-      ZLIB=${zlib} \
-      ${
-        if stdenv.isCygwin then "" else "GSSAPI=${kerberos.dev}"
-      }
-  '';
+  prefixKey = "PREFIX=";
 
-  installPhase = ''
-    scons install
+  preConfigure = ''
+    sconsFlags+=" APR=$(echo ${apr.dev}/bin/*-config)"
+    sconsFlags+=" APU=$(echo ${aprutil.dev}/bin/*-config)"
+    sconsFlags+=" CC=$CC"
+    sconsFlags+=" OPENSSL=${openssl}"
+    sconsFlags+=" ZLIB=${zlib}"
+  '' + stdenv.lib.optionalString (!stdenv.isCygwin) ''
+    sconsFlags+=" GSSAPI=${kerberos.dev}"
   '';
 
   enableParallelBuilding = true;
diff --git a/pkgs/development/libraries/swiften/default.nix b/pkgs/development/libraries/swiften/default.nix
index 1759258e666..c83f5b0f5ac 100644
--- a/pkgs/development/libraries/swiften/default.nix
+++ b/pkgs/development/libraries/swiften/default.nix
@@ -1,8 +1,9 @@
-{ stdenv, python, fetchurl, openssl, boost }:
+{ stdenv, python, fetchurl, openssl, boost, scons }:
 stdenv.mkDerivation rec {
   name    = "swiften-${version}";
   version = "4.0.2";
 
+  nativeBuildInputs = [ scons];
   buildInputs           = [ python ];
   propagatedBuildInputs = [ openssl boost ];
 
@@ -10,16 +11,17 @@ stdenv.mkDerivation rec {
     url    = "https://swift.im/downloads/releases/swift-${version}/swift-${version}.tar.gz";
     sha256 = "0w0aiszjd58ynxpacwcgf052zpmbpcym4dhci64vbfgch6wryz0w";
   };
-  
-  buildPhase = ''
-    patchShebangs ./scons
-    ./scons openssl=${openssl.dev} \
-            boost_includedir=${boost.dev}/include \
-            boost_libdir=${boost.out}/lib \
-            boost_bundled_enable=false \
-            SWIFTEN_INSTALLDIR=$out $out
+
+  sconsFlags = [
+    "openssl=${openssl.dev}"
+    "boost_includedir=${boost.dev}/include"
+    "boost_libdir=${boost.out}/lib"
+    "boost_bundled_enable=false"
+  ];
+  preInstall = ''
+    installTargets="$out"
+    installFlags+=" SWIFT_INSTALLDIR=$out"
   '';
-  installPhase = "true";
 
   meta = with stdenv.lib; {
     description = "An XMPP library for C++, used by the Swift client";
diff --git a/pkgs/development/python-modules/nuitka/default.nix b/pkgs/development/python-modules/nuitka/default.nix
index 67e2782b53a..5b840d1993c 100644
--- a/pkgs/development/python-modules/nuitka/default.nix
+++ b/pkgs/development/python-modules/nuitka/default.nix
@@ -22,9 +22,8 @@ in buildPythonPackage rec {
     sha256 = "01vm8mqhpdrwlxw6rxbg3wz51njq69yn862141mja00mllg3j7pg";
   };
 
-  buildInputs = stdenv.lib.optionals doCheck [ vmprof pyqt4 ];
-
-  propagatedBuildInputs = [ scons ];
+  checkInputs = [ vmprof pyqt4 ];
+  nativeBuildInputs = [ scons ];
 
   postPatch = ''
     patchShebangs tests/run-tests
diff --git a/pkgs/development/python-modules/pyexiv2/default.nix b/pkgs/development/python-modules/pyexiv2/default.nix
index 3384e981ff0..5b98a61735e 100644
--- a/pkgs/development/python-modules/pyexiv2/default.nix
+++ b/pkgs/development/python-modules/pyexiv2/default.nix
@@ -10,13 +10,12 @@ buildPythonPackage rec {
     sha256 = "09r1ga6kj5cnmrldpkqzvdhh7xi7aad9g4fbcr1gawgsd9y13g0a";
   };
 
-  buildPhase = ''
+  preBuild = ''
     sed -i -e "s@env = Environment()@env = Environment( ENV = os.environ )@" src/SConscript
-    scons
   '';
-  installPhase = ''
+
+  preInstall = ''
     sed -i -e "s@    python_lib_path = get_python_lib(plat_specific=True)@    python_lib_path = \'/lib/python2.7/site-packages\'@" src/SConscript
-    scons install DESTDIR=$out
   '';
 
   buildInputs = [ python exiv2 scons boost ];
diff --git a/pkgs/development/tools/godot/default.nix b/pkgs/development/tools/godot/default.nix
index e22b8b25eaa..dd6a413cebf 100644
--- a/pkgs/development/tools/godot/default.nix
+++ b/pkgs/development/tools/godot/default.nix
@@ -33,10 +33,9 @@ in stdenv.mkDerivation rec {
 
   enableParallelBuilding = true;
 
-  buildPhase = ''
-    scons target=release_debug platform=x11 prefix=$out -j $NIX_BUILD_CORES \
-      ${lib.concatStringsSep " "
-          (lib.mapAttrsToList (k: v: "${k}=${builtins.toJSON v}") options)}
+  sconsFlags = "target=release_debug platform=x11";
+  preConfigure = ''
+    sconsFlags+=" ${lib.concatStringsSep " " (lib.mapAttrsToList (k: v: "${k}=${builtins.toJSON v}") options)}"
   '';
 
   outputs = [ "out" "dev" "man" ];
diff --git a/pkgs/development/tools/parsing/hammer/default.nix b/pkgs/development/tools/parsing/hammer/default.nix
index 86c1f82678a..bf5a2374fde 100644
--- a/pkgs/development/tools/parsing/hammer/default.nix
+++ b/pkgs/development/tools/parsing/hammer/default.nix
@@ -12,8 +12,6 @@ stdenv.mkDerivation rec {
 
   nativeBuildInputs = [ pkgconfig ];
   buildInputs = [ glib python scons ];
-  buildPhase = "scons prefix=$out";
-  installPhase = "scons prefix=$out install";
 
   meta = with stdenv.lib; {
     description = "A bit-oriented parser combinator library";
@@ -28,5 +26,5 @@ stdenv.mkDerivation rec {
     homepage = https://github.com/UpstandingHackers/hammer;
     license = licenses.gpl2;
     platforms = platforms.linux;
-    };
+  };
 }
diff --git a/pkgs/development/tools/toluapp/default.nix b/pkgs/development/tools/toluapp/default.nix
index 64a2f4346c7..1214058698e 100644
--- a/pkgs/development/tools/toluapp/default.nix
+++ b/pkgs/development/tools/toluapp/default.nix
@@ -11,7 +11,8 @@ stdenv.mkDerivation rec {
     sha256 = "0zd55bc8smmgk9j4cf0jpibb03lgsvl0knpwhplxbv93mcdnw7s0";
   };
 
-  buildInputs = [ lua scons ];
+  nativeBuildInputs = [ scons ];
+  buildInputs = [ lua ];
 
   patches = [ ./environ-and-linux-is-kinda-posix.patch ];
 
@@ -20,10 +21,6 @@ stdenv.mkDerivation rec {
       --replace /usr/local $out
   '';
 
-  buildPhase = ''scons'';
-
-  installPhase = ''scons install'';
-
   meta = with stdenv.lib; {
     description = "A tool to integrate C/Cpp code with Lua";
     homepage = http://www.codenix.com/~tolua/;
diff --git a/pkgs/games/btanks/default.nix b/pkgs/games/btanks/default.nix
index d606662323f..b1c20d72520 100644
--- a/pkgs/games/btanks/default.nix
+++ b/pkgs/games/btanks/default.nix
@@ -14,24 +14,21 @@ stdenv.mkDerivation rec {
 
   NIX_CFLAGS_COMPILE = "-I${SDL_image}/include/SDL";
 
-  patches = [ (fetchpatch {
-    name = "gcc-4.7.patch";
-    url = "https://anonscm.debian.org/viewvc/pkg-games/packages/trunk/btanks/debian/patches/gcc-4.7.patch?revision=13641&view=co&pathrev=15758";
-    sha256 = "1dxlk1xh69gj10sqcsyckiakb8an3h41206wby4z44mpmvxc7pi4";
-  }) ];
-
-  buildPhase = ''
-    scons prefix=$out
-  '';
-
-  installPhase = ''
-    scons install
-  '';
-
-  meta = {
+  patches = [
+    (fetchpatch {
+      url = "https://sources.debian.org/data/main/b/btanks/0.9.8083-7/debian/patches/gcc-4.7.patch";
+      sha256 = "1dxlk1xh69gj10sqcsyckiakb8an3h41206wby4z44mpmvxc7pi4";
+    })
+    (fetchpatch {
+      url = "https://sources.debian.org/data/main/b/btanks/0.9.8083-7/debian/patches/pow10f.patch";
+      sha256 = "1h45790v2dpdbccfn6lwfgl8782q54i14cz9gpipkaghcka4y0g9";
+    })
+  ];
+
+  meta = with stdenv.lib; {
     homepage = https://sourceforge.net/projects/btanks/;
     description = "Fast 2d tank arcade game";
-    license = stdenv.lib.licenses.gpl2Plus;
-    broken = true; # 2018-09-13, no successful build since 2018-03-16
+    license = licenses.gpl2Plus;
+    platforms = platforms.unix;
   };
 }
diff --git a/pkgs/games/dxx-rebirth/default.nix b/pkgs/games/dxx-rebirth/default.nix
index 5334e4cbd12..3e6bc2dc6f5 100644
--- a/pkgs/games/dxx-rebirth/default.nix
+++ b/pkgs/games/dxx-rebirth/default.nix
@@ -39,18 +39,7 @@ in stdenv.mkDerivation rec {
 
   NIX_CFLAGS_COMPILE = "-Wno-format-nonliteral";
 
-  buildPhase = ''
-    runHook preBuild
-
-    scons prefix=$out
-
-    runHook postBuild
-  '';
-
-  installPhase = ''
-    runHook preInstall
-
-    scons prefix=$out install
+  postInstall = ''
     install -Dm644 ${music} $out/share/games/dxx-rebirth/d2xr-sc55-music.dxa
     install -Dm644 -t $out/share/doc/dxx-rebirth *.txt
 
diff --git a/pkgs/games/endless-sky/default.nix b/pkgs/games/endless-sky/default.nix
index 8e1bd52eb42..447724a2043 100644
--- a/pkgs/games/endless-sky/default.nix
+++ b/pkgs/games/endless-sky/default.nix
@@ -22,18 +22,12 @@ stdenv.mkDerivation rec {
     SDL2 libpng libjpeg glew openal scons libmad
   ];
 
+  prefixKey = "PREFIX=";
+
   patches = [
     ./fixes.patch
   ];
 
-  buildPhase = ''
-    scons -j$NIX_BUILD_CORES PREFIX="$out"
-  '';
-
-  installPhase = ''
-    scons -j$NIX_BUILD_CORES install PREFIX="$out"
-  '';
-
   meta = with stdenv.lib; {
     description = "A sandbox-style space exploration game similar to Elite, Escape Velocity, or Star Control";
     homepage = https://endless-sky.github.io/;
diff --git a/pkgs/games/globulation/default.nix b/pkgs/games/globulation/default.nix
index 4bcf6cffa16..0c3b184b495 100644
--- a/pkgs/games/globulation/default.nix
+++ b/pkgs/games/globulation/default.nix
@@ -32,19 +32,15 @@ stdenv.mkDerivation rec {
     sed -i -e "s@env = Environment()@env = Environment( ENV = os.environ )@" SConstruct
   '';
 
-  buildInputs = [ libGLU_combined SDL scons SDL_ttf SDL_image zlib SDL_net speex libvorbis libogg boost fribidi bsdiff ];
+  nativeBuildInputs = [ scons ];
+  buildInputs = [ libGLU_combined SDL SDL_ttf SDL_image zlib SDL_net speex libvorbis libogg boost fribidi bsdiff ];
 
-  buildPhase = ''
-    scons
+  postConfigure = ''
+    sconsFlags+=" BINDIR=$out/bin"
+    sconsFlags+=" INSTALLDIR=$out/share/globulation2"
+    sconsFlags+=" DATADIR=$out/share/globulation2/glob2"
   '';
 
-  installPhase = ''
-    scons install \
-      BINDIR=$out/bin \
-      INSTALLDIR=$out/share/globulation2 \
-      DATADIR=$out/share/globulation2/glob2
-  '';
-      
   meta = with stdenv.lib; {
     description = "RTS without micromanagement";
     maintainers = with maintainers; [ raskin ];
@@ -53,4 +49,3 @@ stdenv.mkDerivation rec {
   };
   passthru.updateInfo.downloadPage = "http://globulation2.org/wiki/Download_and_Install";
 }
-
diff --git a/pkgs/games/the-powder-toy/default.nix b/pkgs/games/the-powder-toy/default.nix
index ce5b0b26966..6d10b8e2072 100644
--- a/pkgs/games/the-powder-toy/default.nix
+++ b/pkgs/games/the-powder-toy/default.nix
@@ -21,7 +21,7 @@ stdenv.mkDerivation rec {
 
   buildInputs = [ SDL lua fftwFloat zlib bzip2 ];
 
-  buildPhase = "scons DESTDIR=$out/bin --tool='' -j$NIX_BUILD_CORES";
+  sconsFlags = "--tool=";
 
   installPhase = ''
     install -Dm 755 build/powder* "$out/bin/powder"
diff --git a/pkgs/misc/emulators/fceux/default.nix b/pkgs/misc/emulators/fceux/default.nix
index 70cf32d54cc..13ebeb1d2a9 100644
--- a/pkgs/misc/emulators/fceux/default.nix
+++ b/pkgs/misc/emulators/fceux/default.nix
@@ -8,23 +8,23 @@ stdenv.mkDerivation {
     sha256 = "0gl2i3qdmcm7v9m5kpfz98w05d8m33990jiwka043ya7lflxvrjb";
   };
 
-  nativeBuildInputs = [ pkgconfig ];
+  nativeBuildInputs = [ pkgconfig scons ];
   buildInputs = [
-    scons zlib SDL lua5_1
+    zlib SDL lua5_1
   ];
 
-  phases = "unpackPhase buildPhase";
+  sconsFlags = "OPENGL=false GTK=false CREATE_AVI=false LOGO=false";
+  prefixKey = "--prefix=";
 
   # sed allows scons to find libraries in nix.
   # mkdir is a hack to make scons succeed.  It still doesn't
   # actually put the files in there due to a bug in the SConstruct file.
   # OPENGL doesn't work because fceux dlopens the library.
-  buildPhase = ''
+  preBuild = ''
     sed -e 's/env *= *Environment *.*/&; env['"'"'ENV'"'"']=os.environ;/' -i SConstruct
     export CC="gcc"
     export CXX="g++"
     mkdir -p "$out" "$out/share/applications" "$out/share/pixmaps"
-    scons --prefix="$out" OPENGL=false GTK=false CREATE_AVI=false LOGO=false install
   '';
 
   meta = {
diff --git a/pkgs/servers/gpsd/default.nix b/pkgs/servers/gpsd/default.nix
index 6e270192063..f205b600dd9 100644
--- a/pkgs/servers/gpsd/default.nix
+++ b/pkgs/servers/gpsd/default.nix
@@ -44,30 +44,30 @@ stdenv.mkDerivation rec {
 
   # - leapfetch=no disables going online at build time to fetch leap-seconds
   #   info. See <gpsd-src>/build.txt for more info.
-  buildPhase = ''
+  preBuild = ''
     patchShebangs .
     sed -e "s|systemd_dir = .*|systemd_dir = '$out/lib/systemd/system'|" -i SConstruct
-    scons \
-      -j $NIX_BUILD_CORES \
-      prefix="$out" \
-      leapfetch=no \
-      gpsd_user=${gpsdUser} \
-      gpsd_group=${gpsdGroup} \
-      systemd=yes \
-      udevdir="$out/lib/udev" \
-      python_libdir="$out/lib/${python2Packages.python.libPrefix}/site-packages"
+
+    sconsFlags+=" udevdir=$out/lib/udev"
+    sconsFlags+=" python_libdir=$out/lib/${python2Packages.python.libPrefix}/site-packages"
   '';
 
-  checkPhase = ''
+  sconsFlags = [
+    "leapfetch=no"
+    "gpsd_user=${gpsdUser}"
+    "gpsd_group=${gpsdGroup}"
+    "systemd=yes"
+  ];
+
+  preCheck = ''
     export LD_LIBRARY_PATH="$PWD"
-    scons check
   '';
 
   # TODO: the udev rules file and the hotplug script need fixes to work on NixOS
-  installPhase = ''
+  preInstall = ''
     mkdir -p "$out/lib/udev/rules.d"
-    scons install udev-install
   '';
+  installTargets = "install udev-install";
 
   postFixup = ''
     wrapPythonProgramsIn $out/bin "$out $pythonPath"
diff --git a/pkgs/servers/nosql/mongodb/default.nix b/pkgs/servers/nosql/mongodb/default.nix
index c62ade1a20b..55b4b641d15 100644
--- a/pkgs/servers/nosql/mongodb/default.nix
+++ b/pkgs/servers/nosql/mongodb/default.nix
@@ -20,25 +20,6 @@ let version = "3.4.10";
       "yaml"
     ] ++ optionals stdenv.isLinux [ "tcmalloc" ];
 
-    buildInputs = [
-      sasl boost gperftools pcre-cpp snappy
-      zlib libyamlcpp sasl openssl.dev openssl.out libpcap
-    ] ++ stdenv.lib.optionals stdenv.isDarwin [ Security ];
-
-    other-args = concatStringsSep " " ([
-      "--ssl"
-      #"--rocksdb" # Don't have this packaged yet
-      "--wiredtiger=${if stdenv.is64bit then "on" else "off"}"
-      "--js-engine=mozjs"
-      "--use-sasl-client"
-      "--disable-warnings-as-errors"
-      "VARIANT_DIR=nixos" # Needed so we don't produce argument lists that are too long for gcc / ld
-      "CC=$CC"
-      "CXX=$CXX"
-      "CCFLAGS=\"${concatStringsSep " " (map (input: "-I${input}/include") buildInputs)}\""
-      "LINKFLAGS=\"${concatStringsSep " " (map (input: "-L${input}/lib") buildInputs)}\""
-    ] ++ map (lib: "--use-system-${lib}") system-libraries);
-
 in stdenv.mkDerivation rec {
   name = "mongodb-${version}";
 
@@ -48,7 +29,10 @@ in stdenv.mkDerivation rec {
   };
 
   nativeBuildInputs = [ scons ];
-  inherit buildInputs;
+  buildInputs = [
+    sasl boost gperftools pcre-cpp snappy
+    zlib libyamlcpp sasl openssl.dev openssl.out libpcap
+  ] ++ stdenv.lib.optionals stdenv.isDarwin [ Security ];
 
   patches =
     [
@@ -83,14 +67,26 @@ in stdenv.mkDerivation rec {
 
   NIX_CFLAGS_COMPILE = stdenv.lib.optional stdenv.cc.isClang "-Wno-unused-command-line-argument";
 
-  buildPhase = ''
-    scons -j $NIX_BUILD_CORES core --release ${other-args}
+  sconsFlags = [
+    "--release"
+    "--ssl"
+    #"--rocksdb" # Don't have this packaged yet
+    "--wiredtiger=${if stdenv.is64bit then "on" else "off"}"
+    "--js-engine=mozjs"
+    "--use-sasl-client"
+    "--disable-warnings-as-errors"
+    "VARIANT_DIR=nixos" # Needed so we don't produce argument lists that are too long for gcc / ld
+  ] ++ map (lib: "--use-system-${lib}") system-libraries;
+
+  preBuild = ''
+    sconsFlags+=" CC=$CC"
+    sconsFlags+=" CXX=$CXX"
   '';
 
-  installPhase = ''
+  preInstall = ''
     mkdir -p $out/lib
-    scons -j $NIX_BUILD_CORES install --release --prefix=$out ${other-args}
   '';
+  prefixKey = "--prefix=";
 
   enableParallelBuilding = true;
 
diff --git a/pkgs/servers/rippled/default.nix b/pkgs/servers/rippled/default.nix
index c1d9655ef23..af25da7ae45 100644
--- a/pkgs/servers/rippled/default.nix
+++ b/pkgs/servers/rippled/default.nix
@@ -15,12 +15,10 @@ stdenv.mkDerivation rec {
     sed -i -e "s@ENV = dict.*@ENV = os.environ@g" SConstruct
   '';
 
-  nativeBuildInputs = [ pkgconfig ];
-  buildInputs = [ scons openssl protobuf boost zlib ];
+  nativeBuildInputs = [ pkgconfig scons ];
+  buildInputs = [ openssl protobuf boost zlib ];
 
-  buildPhase = "scons";
-
-  installPhase = ''
+  postInstall = ''
     mkdir -p $out/bin
     cp build/rippled $out/bin/
   '';
diff --git a/pkgs/servers/sql/mariadb/default.nix b/pkgs/servers/sql/mariadb/default.nix
index d2a4406a973..6415fc95437 100644
--- a/pkgs/servers/sql/mariadb/default.nix
+++ b/pkgs/servers/sql/mariadb/default.nix
@@ -233,7 +233,7 @@ galera = stdenv.mkDerivation rec {
 
   buildInputs = [ asio boost check openssl scons ];
 
-  patchPhase = ''
+  postPatch = ''
     substituteInPlace SConstruct \
       --replace "boost_library_path = '''" "boost_library_path = '${boost}/lib'"
   '';
@@ -243,11 +243,9 @@ galera = stdenv.mkDerivation rec {
     export LIBPATH="${galeraLibs}/lib"
   '';
 
-  buildPhase = ''
-     scons -j$NIX_BUILD_CORES ssl=1 system_asio=1 strict_build_flags=0
-  '';
+  sconsFlags = "ssl=1 system_asio=1 strict_build_flags=0";
 
-  installPhase = ''
+  postInstall = ''
     # copied with modifications from scripts/packages/freebsd.sh
     GALERA_LICENSE_DIR="$share/licenses/${name}"
     install -d $out/{bin,lib/galera,share/doc/galera,$GALERA_LICENSE_DIR}
diff --git a/pkgs/tools/graphics/lprof/default.nix b/pkgs/tools/graphics/lprof/default.nix
index d3a8d19dfe2..a4a2cfc1a7c 100644
--- a/pkgs/tools/graphics/lprof/default.nix
+++ b/pkgs/tools/graphics/lprof/default.nix
@@ -5,7 +5,8 @@
 */
 stdenv.mkDerivation {
   name = "lprof-1.11.4.1";
-  buildInputs = [ scons qt3 lcms1 libtiff vigra ];
+  nativeBuildInputs = [ scons ];
+  buildInputs = [ qt3 lcms1 libtiff vigra ];
 
   hardeningDisable = [ "format" ];
 
@@ -19,14 +20,11 @@ stdenv.mkDerivation {
     sha256 = "0q8x24fm5yyvm151xrl3l03p7hvvciqnkbviprfnvlr0lyg9wsrn";
   };
 
-  buildPhase = ''
-    mkdir -p $out
+  sconsFlags = "SYSLIBS=1";
+  preBuild = ''
     export CXX=g++
-
-    scons PREFIX=$out SYSLIBS=1 install
   '';
-
-  installPhase = ":";
+  prefixKey = "PREFIX=";
 
   patches = [ ./lcms-1.17.patch  ./keep-environment.patch ];