Updating to Sphinx 1.3.1 using Nix

Today I updated my Sphinx version to 1.3.1, using Nix. I hadn't updated it since last July if my previous Nix blog is anything to go by.

There are quite a few additional dependencies, and no big issues, but I should begin with the disclaimer.

Issues

Before you do the same, here are my issues with it, nothing major:

  1. If using the readthedocs theme, then it is currently not supporting 1.3.1, issue 1214. It seems the way Sphinx is now generating its HTML is different, so until this is fixed I'm rolling back to 1.2.2 Here is what command line output now looks like. Red text is usually for big errors!

  2. During installation the Babel library is not picking up the pytz library, so I had to disable the checks.

Default.nix

Anyway, here you go, a default.nix for Sphinx 1.3.1. It's also in a Github gist if you prefer.

{ system ? builtins.currentSystem
}:

let

  pkgs = import <nixpkgs> { inherit system; };

  inherit (pkgs) fetchurl fetchgit;

  buildPythonPackage = pkgs.python27Packages.buildPythonPackage;
  python = pkgs.python27Packages.python;

  Jinja2 = buildPythonPackage rec {
    name = "Jinja2-2.7.3";
    src = fetchurl {
      url = "http://pypi.python.org/packages/source/J/Jinja2/${name}.tar.gz";
  md5 = "b9dffd2f3b43d673802fe857c8445b1a";
};
propagatedBuildInputs = [ MarkupSafe ];
};

MarkupSafe = buildPythonPackage rec {
  name = "MarkupSafe-0.23";
  src = fetchurl {
    url = "https://pypi.python.org/packages/source/M/MarkupSafe/${name}.tar.gz";
    md5 = "f5ab3deee4c37cd6a922fb81e730da6e";
};
};

Pygments = buildPythonPackage rec {
  name = "Pygments-2.0.2";
  src = fetchurl {
    url = "https://pypi.python.org/packages/source/P/Pygments/${name}.tar.gz";
    md5 = "238587a1370d62405edabd0794b3ec4a";
};
};

alabaster = buildPythonPackage rec {
  name = "alabaster-0.7.3";
  src = fetchurl {
    url = "https://pypi.python.org/packages/source/a/alabaster/${name}.tar.gz";
    md5 = "67428d1383fd833f1282fed5deba0898";
};
};

six = buildPythonPackage rec {
  name = "six-1.9.0";
  src = fetchurl {
    url = "https://pypi.python.org/packages/source/s/six/${name}.tar.gz";
    md5 = "476881ef4012262dfc8adc645ee786c4";
};
};

snowballstemmer = buildPythonPackage rec {
  name = "snowballstemmer-1.2.0";
  src = fetchurl {
    url = "https://pypi.python.org/packages/source/s/snowballstemmer/${name}.tar.gz";
    md5 = "51f2ef829db8129dd0f2354f0b209970";
};
};

pytz = buildPythonPackage rec {
  name = "pytz-2015.2";
  src = fetchurl {
    url = "https://pypi.python.org/packages/source/p/pytz/${name}.tar.gz";
    md5 = "08440d994cfbbf13d3343362cc3173f7";
};
};

babel = buildPythonPackage rec {
  name = "Babel-1.3";
  src = fetchurl {
    url = "https://pypi.python.org/packages/source/B/Babel/${name}.tar.gz";
    md5 = "5264ceb02717843cbc9ffce8e6e06bdb";
};
# TODO: tests breaking due to not finding pytz, even though it is in
doCheck = false;
};

Sphinx = buildPythonPackage (rec {
  name = "Sphinx-1.3.1";
  src = fetchurl {
    url = "https://pypi.python.org/packages/source/S/Sphinx/${name}.tar.gz";
    md5 = "8786a194acf9673464c5455b11fd4332";
  };
propagatedBuildInputs = [
  docutils
  Jinja2
  Pygments
  alabaster
  six
  snowballstemmer
  pytz
  babel

  # TODO: Had to include it here so that can be imported
  sphinx_rtd_theme
];
});

docutils = buildPythonPackage rec {
  name = "docutils-0.12";
  src = fetchurl {
    url = "https://pypi.python.org/packages/source/d/docutils/${name}.tar.gz";
    md5 = "4622263b62c5c771c03502afa3157768";
  };
};

sphinx_rtd_theme = buildPythonPackage rec {
  name = "sphinx_rtd_theme-0.1.7";
  src = fetchurl {
    url = "https://pypi.python.org/packages/source/s/sphinx_rtd_theme/${name}.tar.gz";
    md5 = "3ffe014445195705968d899c38b305fd";
  };

# TODO: Tests would require sphinx and this creates recursion issues
doCheck = false;
};

in python.buildEnv.override {
  inherit python;
  extraLibs = [
    Sphinx
    sphinx_rtd_theme
 ];
}

Running a build

Once it is done, run nix-build and you'll be able to generate your docs:

$ nix-build
/nix/store/8h6iysvp583rycl1ll6w75n1z1h1psmx-python-2.7.9-env

$ make html
../result/bin/sphinx-build -b html -d _build/doctrees   . _build/html
Running Sphinx v1.3.1
making output directory...
loading pickled environment... not yet created
loading intersphinx inventory from http://docs.python.org/objects.inv...
building [mo]: targets for 0 po files that are out of date 
building [html]: targets for 3 source files that are out of date updating environment: 3 added, 0 changed, 0 removed 
reading sources... [100%] index                                                 
looking for now-outdated files... none found
pickling environment... done
checking consistency... done
preparing documents... done
writing output... [100%] index                                                  
generating indices... genindex
writing additional pages... search
copying static files... WARNING: html_static_path entry u'/Users/brian/personal-vcs/cahoots/app-design/_static' does not exist
done
copying extra files... done
dumping search index in English (code: en) ... done
dumping object inventory... done
build succeeded, 1 warning.

Build finished. The HTML pages are in _build/html.
Comments