Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: NixOS/nixpkgs
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: a4ae8ceec303
Choose a base ref
...
head repository: NixOS/nixpkgs
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: f32f452cdb32
Choose a head ref
  • 2 commits
  • 4 files changed
  • 1 contributor

Commits on Mar 30, 2019

  1. dlib: add flag to disable AVX support

    Especially older hardware doesn't support AVX instructions. DLib is
    still functional there, but significantly slower[1].
    
    By setting `avxInstructions` to false, DLib will be compiled without
    this feature.
    
    [1] http://dlib.net/compile.html
    
    (cherry picked from commit 9732c44)
    Ma27 committed Mar 30, 2019

    Verified

    This commit was signed with the committer’s verified signature.
    davidtwco David Wood
    Copy the full SHA
    6f55b04 View commit details
  2. pythonPackages.face_recognition: 1.2.2 -> 1.2.3

    There's no git tag for 1.2.3, hence we need to pin to the corresponding
    revision because we build from a git source.
    
    After recent breakage on Hydra[1], the tests were disabled. Although
    some build machines don't support AVX, we shouldn't use a DLib without
    AVX as the builder's result is also used on modern machines with AVX
    support. Before merging changes, maintainers should run the check phase
    locally in a `nix-shell`.
    
    [1] https://hydra.nixos.org/build/89533530
    
    (cherry picked from commit 6fec5aa)
    Ma27 committed Mar 30, 2019

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    f32f452 View commit details
27 changes: 27 additions & 0 deletions doc/package-notes.xml
Original file line number Diff line number Diff line change
@@ -882,6 +882,33 @@ citrix_receiver.override {
On NixOS it can be installed using the following expression:
<programlisting>{ pkgs, ... }: {
fonts.fonts = with pkgs; [ noto-fonts-emoji ];
}</programlisting>
</para>
</section>
</section>
<section xml:id="dlib">
<title>DLib</title>

<para>
<link xlink:href="http://dlib.net/">DLib</link> is a modern, C++-based toolkit which
provides several machine learning algorithms.
</para>

<section xml:id="compiling-without-avx-support">
<title>Compiling without AVX support</title>

<para>
Especially older CPUs don't support
<link xlink:href="https://en.wikipedia.org/wiki/Advanced_Vector_Extensions">AVX</link>
(<abbrev>Advanced Vector Extensions</abbrev>) instructions that are used by DLib to
optimize their algorithms.
</para>

<para>
On the affected hardware errors like <literal>Illegal instruction</literal> will occur.
In those cases AVX support needs to be disabled:
<programlisting>self: super: {
dlib = super.dlib.override { avxSupport = false; };
}</programlisting>
</para>
</section>
5 changes: 5 additions & 0 deletions pkgs/development/libraries/dlib/default.nix
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
{ stdenv, lib, fetchFromGitHub, cmake, pkgconfig, libpng, libjpeg
, guiSupport ? false, libX11

# see http://dlib.net/compile.html
, avxSupport ? true
}:

stdenv.mkDerivation rec {
@@ -17,6 +20,8 @@ stdenv.mkDerivation rec {
rm -rf dlib/external
'';

cmakeFlags = [ "-DUSE_AVX_INSTRUCTIONS=${if avxSupport then "yes" else "no"}" ];

enableParallelBuilding = true;
nativeBuildInputs = [ cmake pkgconfig ];
buildInputs = [ libpng libjpeg ] ++ lib.optional guiSupport libX11;
7 changes: 6 additions & 1 deletion pkgs/development/python-modules/dlib/default.nix
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
{ buildPythonPackage, dlib, python, pytest }:
{ buildPythonPackage, dlib, python, pytest, avxSupport ? true }:

buildPythonPackage {
inherit (dlib) name src nativeBuildInputs buildInputs meta;

# although AVX can be enabled, we never test with it. Some Hydra machines
# fail because of this, however their build results are probably used on hardware
# with AVX support.
checkPhase = ''
${python.interpreter} nix_run_setup test --no USE_AVX_INSTRUCTIONS
'';

setupPyBuildFlags = [ "--${if avxSupport then "yes" else "no"} USE_AVX_INSTRUCTIONS" ];

patches = [ ./build-cores.patch ];

checkInputs = [ pytest ];
15 changes: 12 additions & 3 deletions pkgs/development/python-modules/face_recognition/default.nix
Original file line number Diff line number Diff line change
@@ -4,13 +4,13 @@

buildPythonPackage rec {
pname = "face_recognition";
version = "1.2.2";
version = "1.2.3";

src = fetchFromGitHub {
repo = pname;
owner = "ageitgey";
rev = "v${version}";
sha256 = "17jnyr80j1p74gyvh1jabvwd3zsxvip2y7cjhh2g6gsjv2dpvrjv";
rev = "634db2e4309a365cee2503cb65d6f2e88f519d1e";
sha256 = "06zw5hq417d5yp17zynhxhb73074lx2qy64fqfzf711rw5vrn2mx";
};

postPatch = ''
@@ -19,6 +19,15 @@ buildPythonPackage rec {

propagatedBuildInputs = [ pillow click dlib numpy face_recognition_models ];

# Our dlib is compiled with AVX instructions by default which breaks
# with "Illegal instruction" on some builders due to missing hardware features.
#
# As this makes the build fairly unreliable, it's better to skip the test and to ensure that
# the build is working and after each change to the package, manual testing should be done.
doCheck = false;

# Although tests are disabled by default, checkPhase still exists, so
# maintainers can check the package's functionality locally before modifying it.
checkInputs = [ flake8 pytest glibcLocales ];
checkPhase = ''
LC_ALL="en_US.UTF-8" py.test