Skip to content

Instantly share code, notes, and snippets.

@garbas
Last active February 15, 2017 12:50
Show Gist options
  • Save garbas/5d50d3f5836ef990f1a46a029c33f62e to your computer and use it in GitHub Desktop.
Save garbas/5d50d3f5836ef990f1a46a029c33f62e to your computer and use it in GitHub Desktop.
# IMPORTANT: make sure you copy over `requirements_override.nix` file
% pypi2nix --version
1.8.0 (master)
% pypi2nix -v -V "3.5" -e rinohtype
...
% nix-build requirements.nix -A interpreter
% /result/bin/python -c "import rinoh; import rinoh_typeface_texgyrepagella;"
# generated using pypi2nix tool (version: 1.8.0)
# See more at: https://github.com/garbas/pypi2nix
#
# COMMAND:
# pypi2nix -v -V 3.5 -e rinohtype
#
{ pkgs ? import <nixpkgs> {}
}:
let
inherit (pkgs) makeWrapper;
inherit (pkgs.stdenv.lib) fix' extends inNixShell;
pythonPackages = import "${toString pkgs.path}/pkgs/top-level/python-packages.nix" {
inherit pkgs;
inherit (pkgs) stdenv;
python = pkgs.python35;
};
commonBuildInputs = [];
commonDoCheck = false;
withPackages = pkgs':
let
pkgs = builtins.removeAttrs pkgs' ["__unfix__"];
interpreter = pythonPackages.buildPythonPackage {
name = "python35-interpreter";
buildInputs = [ makeWrapper ] ++ (builtins.attrValues pkgs);
buildCommand = ''
mkdir -p $out/bin
ln -s ${pythonPackages.python.interpreter} $out/bin/${pythonPackages.python.executable}
for dep in ${builtins.concatStringsSep " " (builtins.attrValues pkgs)}; do
if [ -d "$dep/bin" ]; then
for prog in "$dep/bin/"*; do
if [ -f $prog ]; then
ln -s $prog $out/bin/`basename $prog`
fi
done
fi
done
for prog in "$out/bin/"*; do
wrapProgram "$prog" --prefix PYTHONPATH : "$PYTHONPATH"
done
pushd $out/bin
ln -s ${pythonPackages.python.executable} python
popd
'';
passthru.interpreter = pythonPackages.python;
};
in {
__old = pythonPackages;
inherit interpreter;
mkDerivation = pythonPackages.buildPythonPackage;
packages = pkgs;
overrideDerivation = drv: f:
pythonPackages.buildPythonPackage (drv.drvAttrs // f drv.drvAttrs);
withPackages = pkgs'':
withPackages (pkgs // pkgs'');
};
python = withPackages {};
generated = import ./requirements_generated.nix { inherit pkgs python commonBuildInputs commonDoCheck; };
overrides = import ./requirements_override.nix { inherit pkgs python; };
in python.withPackages (fix' (extends overrides generated))
appdirs==1.4.0
CommonMark==0.5.4
docutils==0.13.1
packaging==16.8
purepng==0.2.0
pyparsing==2.1.10
recommonmark==0.4.0
rinoh-typeface-dejavuserif==0.1.1
rinoh-typeface-texgyrecursor==0.1.1
rinoh-typeface-texgyreheros==0.1.1
rinoh-typeface-texgyrepagella==0.1.1
rinohtype==0.3.1
six==1.10.0
# generated using pypi2nix tool (version: 1.8.0)
#
# COMMAND:
# pypi2nix -v -V 3.5 -e rinohtype
#
{ pkgs, python, commonBuildInputs ? [], commonDoCheck ? false }:
self: {
"CommonMark" = python.mkDerivation {
name = "CommonMark-0.5.4";
src = pkgs.fetchurl { url = "https://pypi.python.org/packages/4d/93/3808cbcebe94d205f55a9a32857df733a603339d32c46cd32669d808d964/CommonMark-0.5.4.tar.gz"; sha256 = "34d73ec8085923c023930dfc0bcd1c4286e28a2a82de094bb72fabcc0281cbe5"; };
doCheck = commonDoCheck;
buildInputs = commonBuildInputs;
propagatedBuildInputs = [ ];
meta = with pkgs.stdenv.lib; {
homepage = "";
license = licenses.bsdOriginal;
description = "Python parser for the CommonMark Markdown spec";
};
};
"appdirs" = python.mkDerivation {
name = "appdirs-1.4.0";
src = pkgs.fetchurl { url = "https://pypi.python.org/packages/bd/66/0a7f48a0f3fb1d3a4072bceb5bbd78b1a6de4d801fb7135578e7c7b1f563/appdirs-1.4.0.tar.gz"; sha256 = "8fc245efb4387a4e3e0ac8ebcc704582df7d72ff6a42a53f5600bbb18fdaadc5"; };
doCheck = commonDoCheck;
buildInputs = commonBuildInputs;
propagatedBuildInputs = [ ];
meta = with pkgs.stdenv.lib; {
homepage = "";
license = licenses.mit;
description = "A small Python module for determining appropriate \" + \"platform-specific dirs, e.g. a \"user data dir\".";
};
};
"docutils" = python.mkDerivation {
name = "docutils-0.13.1";
src = pkgs.fetchurl { url = "https://pypi.python.org/packages/05/25/7b5484aca5d46915493f1fd4ecb63c38c333bd32aa9ad6e19da8d08895ae/docutils-0.13.1.tar.gz"; sha256 = "718c0f5fb677be0f34b781e04241c4067cbd9327b66bdd8e763201130f5175be"; };
doCheck = commonDoCheck;
buildInputs = commonBuildInputs;
propagatedBuildInputs = [ ];
meta = with pkgs.stdenv.lib; {
homepage = "";
license = licenses.publicDomain;
description = "Docutils -- Python Documentation Utilities";
};
};
"packaging" = python.mkDerivation {
name = "packaging-16.8";
src = pkgs.fetchurl { url = "https://pypi.python.org/packages/c6/70/bb32913de251017e266c5114d0a645f262fb10ebc9bf6de894966d124e35/packaging-16.8.tar.gz"; sha256 = "5d50835fdf0a7edf0b55e311b7c887786504efea1177abd7e69329a8e5ea619e"; };
doCheck = commonDoCheck;
buildInputs = commonBuildInputs;
propagatedBuildInputs = [
self."pyparsing"
self."six"
];
meta = with pkgs.stdenv.lib; {
homepage = "";
license = licenses.bsdOriginal;
description = "Core utilities for Python packages";
};
};
"purepng" = python.mkDerivation {
name = "purepng-0.2.0";
src = pkgs.fetchurl { url = "https://pypi.python.org/packages/b3/91/9fa8a4752a4c028237cb6ea7efab6680eb68a686e8d70c8124ff347d6553/purepng-0.2.0.tar.gz"; sha256 = "0d64d1464252184dae30c9a4611faed72868a6e352fce58019a9b4d38c3a94cd"; };
doCheck = commonDoCheck;
buildInputs = commonBuildInputs;
propagatedBuildInputs = [ ];
meta = with pkgs.stdenv.lib; {
homepage = "";
license = licenses.mit;
description = "Pure Python PNG image encoder/decoder";
};
};
"pyparsing" = python.mkDerivation {
name = "pyparsing-2.1.10";
src = pkgs.fetchurl { url = "https://pypi.python.org/packages/38/bb/bf325351dd8ab6eb3c3b7c07c3978f38b2103e2ab48d59726916907cd6fb/pyparsing-2.1.10.tar.gz"; sha256 = "811c3e7b0031021137fc83e051795025fcb98674d07eb8fe922ba4de53d39188"; };
doCheck = commonDoCheck;
buildInputs = commonBuildInputs;
propagatedBuildInputs = [ ];
meta = with pkgs.stdenv.lib; {
homepage = "";
license = licenses.mit;
description = "Python parsing module";
};
};
"recommonmark" = python.mkDerivation {
name = "recommonmark-0.4.0";
src = pkgs.fetchurl { url = "https://pypi.python.org/packages/3d/95/aa1085573adf3dc7b164ae8569d57b1af5e98922e40345bb7efffed5ad2e/recommonmark-0.4.0.tar.gz"; sha256 = "6e29c723abcf5533842376d87c4589e62923ecb6002a8e059eb608345ddaff9d"; };
doCheck = commonDoCheck;
buildInputs = commonBuildInputs;
propagatedBuildInputs = [
self."CommonMark"
self."docutils"
];
meta = with pkgs.stdenv.lib; {
homepage = "";
license = "";
description = "UNKNOWN";
};
};
"rinoh-typeface-dejavuserif" = python.mkDerivation {
name = "rinoh-typeface-dejavuserif-0.1.1";
src = pkgs.fetchurl { url = "https://pypi.python.org/packages/42/30/ac1a96bfd3c4db5c82418e3045951fbfcb00f35eaa5b6cb61d530ca0c475/rinoh-typeface-dejavuserif-0.1.1.tar.gz"; sha256 = "ff0b236bdd69ef36c14887ac5078bbf1f14ae1ca403fc81b5426ba0bdfb13bea"; };
doCheck = commonDoCheck;
buildInputs = commonBuildInputs;
propagatedBuildInputs = [
self."rinohtype"
];
meta = with pkgs.stdenv.lib; {
homepage = "";
license = "Bitstream Vera Fonts Copyright, Arev Fonts Copyright, Public Domain";
description = "DejaVu Serif typeface";
};
};
"rinoh-typeface-texgyrecursor" = python.mkDerivation {
name = "rinoh-typeface-texgyrecursor-0.1.1";
src = pkgs.fetchurl { url = "https://pypi.python.org/packages/68/70/b0a661118e7a93d1abf4375543644b054bb74b258924d62dd898b9860a71/rinoh-typeface-texgyrecursor-0.1.1.tar.gz"; sha256 = "076f7dbbd0201b0d44f4c77e4f7070474e1365152dc8509b5cded04c1648308a"; };
doCheck = commonDoCheck;
buildInputs = commonBuildInputs;
propagatedBuildInputs = [
self."rinohtype"
];
meta = with pkgs.stdenv.lib; {
homepage = "";
license = "GUST Font License (GFL)";
description = "TeX Gyre Cursor typeface";
};
};
"rinoh-typeface-texgyreheros" = python.mkDerivation {
name = "rinoh-typeface-texgyreheros-0.1.1";
src = pkgs.fetchurl { url = "https://pypi.python.org/packages/8e/62/3b28c30558fd53590797c455bb46ab47599c2b9145a09e7ae162dd625426/rinoh-typeface-texgyreheros-0.1.1.tar.gz"; sha256 = "fd7082e917bccc292894447f11d15a3efce9f1386056118b57b66cc2f5a36bbd"; };
doCheck = commonDoCheck;
buildInputs = commonBuildInputs;
propagatedBuildInputs = [
self."rinohtype"
];
meta = with pkgs.stdenv.lib; {
homepage = "";
license = "GUST Font License (GFL)";
description = "TeX Gyre Heros typeface";
};
};
"rinoh-typeface-texgyrepagella" = python.mkDerivation {
name = "rinoh-typeface-texgyrepagella-0.1.1";
src = pkgs.fetchurl { url = "https://pypi.python.org/packages/6a/2a/86db888c244f11bb0f6fed72c75b09dba9dbf8aa72e7b69c27cf7975340f/rinoh-typeface-texgyrepagella-0.1.1.tar.gz"; sha256 = "53f4dba338c6b1df758888f23ce1ed728e5be45746f161488ad3b944e5e79fd2"; };
doCheck = commonDoCheck;
buildInputs = commonBuildInputs;
propagatedBuildInputs = [
self."rinohtype"
];
meta = with pkgs.stdenv.lib; {
homepage = "";
license = "GUST Font License (GFL)";
description = "TeX Gyre Pagella typeface";
};
};
"rinohtype" = python.mkDerivation {
name = "rinohtype-0.3.1";
src = pkgs.fetchurl { url = "https://pypi.python.org/packages/82/c6/6d8f9a35a6635beb441646754d051eb298f36211168773ad6a0304f3ab94/rinohtype-0.3.1.tar.gz"; sha256 = "e1ed450a866a224c806e20d0f15fd5a28239f454138ab8615dd518d5cdc4532c"; };
doCheck = commonDoCheck;
buildInputs = commonBuildInputs;
propagatedBuildInputs = [
self."docutils"
self."purepng"
self."recommonmark"
self."rinoh-typeface-dejavuserif"
self."rinoh-typeface-texgyrecursor"
self."rinoh-typeface-texgyreheros"
self."rinoh-typeface-texgyrepagella"
];
meta = with pkgs.stdenv.lib; {
homepage = "";
license = licenses.agpl3;
description = "The Python document processor";
};
};
"six" = python.mkDerivation {
name = "six-1.10.0";
src = pkgs.fetchurl { url = "https://pypi.python.org/packages/b3/b2/238e2590826bfdd113244a40d9d3eb26918bd798fc187e2360a8367068db/six-1.10.0.tar.gz"; sha256 = "105f8d68616f8248e24bf0e9372ef04d3cc10104f1980f54d57b2ce73a5ad56a"; };
doCheck = commonDoCheck;
buildInputs = commonBuildInputs;
propagatedBuildInputs = [ ];
meta = with pkgs.stdenv.lib; {
homepage = "";
license = licenses.mit;
description = "Python 2 and 3 compatibility utilities";
};
};
}
{ pkgs, python }:
self: super: {
"rinohtype" = python.overrideDerivation super."rinohtype" (old: {
propagatedNativeBuildInputs =
builtins.filter
(x: (builtins.parseDrvName x.name).name != "${python.__old.python.libPrefix}-rinoh-typeface-dejavuserif" &&
(builtins.parseDrvName x.name).name != "${python.__old.python.libPrefix}-rinoh-typeface-texgyrecursor" &&
(builtins.parseDrvName x.name).name != "${python.__old.python.libPrefix}-rinoh-typeface-texgyreheros" &&
(builtins.parseDrvName x.name).name != "${python.__old.python.libPrefix}-rinoh-typeface-texgyrepagella"
)
old.propagatedNativeBuildInputs;
patchPhase = ''
sed -i \
-e "s|'rinoh-typeface-texgyrecursor>=0.1.1',||" \
-e "s|'rinoh-typeface-texgyreheros>=0.1.1',||" \
-e "s|'rinoh-typeface-texgyrepagella>=0.1.1',||" \
-e "s|'rinoh-typeface-dejavuserif'\],|\],|" \
setup.py
'';
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment