diff --git a/.gitignore b/.gitignore index db15bb41c2c..931c65ad5f5 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ build/ +requirements_frozen.txt diff --git a/.readthedocs.yml b/.readthedocs.yml deleted file mode 100644 index 6a9460d3819..00000000000 --- a/.readthedocs.yml +++ /dev/null @@ -1,20 +0,0 @@ -# .readthedocs.yml -# Read the Docs configuration file -# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details - -# Required -version: 2 - -sphinx: - configuration: source/conf.py - fail_on_warning: true - - -# Optionally build your docs in additional formats such as PDF and ePub -formats: all - -# Optionally set the version of Python and requirements required to build your docs -python: - version: 3 - install: - - requirements: requirements.txt diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst deleted file mode 100644 index 7e6d596732f..00000000000 --- a/CONTRIBUTING.rst +++ /dev/null @@ -1,19 +0,0 @@ -.. _contributing: - -Contributing to the cookbook -============================ - -Guidelines ----------- -http://creativecommons.org/licenses/by/4.0/ - -Getting the source code ------------------------ - -Building documentation ----------------------- - -Submitting a pull request -------------------------- - - diff --git a/Makefile b/Makefile index f584198ea84..3086cb3ebfb 100644 --- a/Makefile +++ b/Makefile @@ -7,11 +7,6 @@ SPHINXBUILD = sphinx-build PAPER = BUILDDIR = build -# User-friendly check for sphinx-build -ifeq ($(shell which $(SPHINXBUILD) >/dev/null 2>&1; echo $$?), 1) - $(error The '$(SPHINXBUILD)' command was not found. Make sure you have Sphinx installed, then set the SPHINXBUILD environment variable to point to the full path of the '$(SPHINXBUILD)' executable. Alternatively you can add the directory with the executable to your PATH. If you don\'t have Sphinx installed, grab it from http://sphinx-doc.org/) -endif - # Internal variables. PAPEROPT_a4 = -D latex_paper_size=a4 PAPEROPT_letter = -D latex_paper_size=letter diff --git a/README.rst b/README.rst index d544df2a484..2545fd99f23 100644 --- a/README.rst +++ b/README.rst @@ -8,3 +8,8 @@ ========== Getting started and cookbook resources for Nix. + +Contributing +------------ + +Run `./live` and open a browser at https://localhost:5500. As you make changes, the browser should auto-reload. \ No newline at end of file diff --git a/live b/live new file mode 100755 index 00000000000..3e91c54561a --- /dev/null +++ b/live @@ -0,0 +1,2 @@ +# TODO: https://github.com/nix-community/pypi2nix/issues/432 +PATH=$PATH:$(nix-build requirements.nix)/bin nix-shell requirements.nix --run "python live.py" \ No newline at end of file diff --git a/live.py b/live.py new file mode 100644 index 00000000000..bdfa8163673 --- /dev/null +++ b/live.py @@ -0,0 +1,12 @@ +from livereload import Server, shell + +server = Server() + +build_docs = shell("make html") + +print("Doing an initial build of the docs...") +build_docs() + +server.watch("source/*.rst", build_docs) +server.watch("source/**/*.rst", build_docs) +server.serve(root="build/html") diff --git a/requirements.nix b/requirements.nix new file mode 100644 index 00000000000..74736ec6ba0 --- /dev/null +++ b/requirements.nix @@ -0,0 +1,709 @@ +# generated using pypi2nix tool (version: 2.0.4) +# See more at: https://github.com/nix-community/pypi2nix +# +# COMMAND: +# pypi2nix -r requirements.txt +# + +{ pkgs ? import {}, + overrides ? ({ pkgs, python }: self: super: {}) +}: + +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.python3; + }; + + commonBuildInputs = []; + commonDoCheck = false; + + withPackages = pkgs': + let + pkgs = builtins.removeAttrs pkgs' ["__unfix__"]; + interpreterWithPackages = selectPkgsFn: pythonPackages.buildPythonPackage { + name = "python3-interpreter"; + buildInputs = [ makeWrapper ] ++ (selectPkgsFn pkgs); + buildCommand = '' + mkdir -p $out/bin + ln -s ${pythonPackages.python.interpreter} \ + $out/bin/${pythonPackages.python.executable} + for dep in ${builtins.concatStringsSep " " + (selectPkgsFn pkgs)}; do + if [ -d "$dep/bin" ]; then + for prog in "$dep/bin/"*; do + if [ -x "$prog" ] && [ -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 + ln -s ${pythonPackages.python.executable} \ + python3 + popd + ''; + passthru.interpreter = pythonPackages.python; + }; + + interpreter = interpreterWithPackages builtins.attrValues; + in { + __old = pythonPackages; + inherit interpreter; + inherit interpreterWithPackages; + mkDerivation = args: pythonPackages.buildPythonPackage (args // { + nativeBuildInputs = (args.nativeBuildInputs or []) ++ args.buildInputs; + }); + packages = pkgs; + overrideDerivation = drv: f: + pythonPackages.buildPythonPackage ( + drv.drvAttrs // f drv.drvAttrs // { meta = drv.meta; } + ); + withPackages = pkgs'': + withPackages (pkgs // pkgs''); + }; + + python = withPackages {}; + + generated = self: { + "alabaster" = python.mkDerivation { + name = "alabaster-0.7.12"; + src = pkgs.fetchurl { + url = "https://files.pythonhosted.org/packages/cc/b4/ed8dcb0d67d5cfb7f83c4d5463a7614cb1d078ad7ae890c9143edebbf072/alabaster-0.7.12.tar.gz"; + sha256 = "a661d72d58e6ea8a57f7a86e37d86716863ee5e92788398526d58b26a4e4dc02"; +}; + doCheck = commonDoCheck; + format = "setuptools"; + buildInputs = commonBuildInputs ++ [ ]; + propagatedBuildInputs = [ ]; + meta = with pkgs.stdenv.lib; { + homepage = "https://alabaster.readthedocs.io"; + license = licenses.bsdOriginal; + description = "A configurable sidebar-enabled Sphinx theme"; + }; + }; + + "babel" = python.mkDerivation { + name = "babel-2.8.0"; + src = pkgs.fetchurl { + url = "https://files.pythonhosted.org/packages/34/18/8706cfa5b2c73f5a549fdc0ef2e24db71812a2685959cff31cbdfc010136/Babel-2.8.0.tar.gz"; + sha256 = "1aac2ae2d0d8ea368fa90906567f5c08463d98ade155c0c4bfedd6a0f7160e38"; +}; + doCheck = commonDoCheck; + format = "setuptools"; + buildInputs = commonBuildInputs ++ [ ]; + propagatedBuildInputs = [ + self."pytz" + ]; + meta = with pkgs.stdenv.lib; { + homepage = "http://babel.pocoo.org/"; + license = licenses.bsdOriginal; + description = "Internationalization utilities"; + }; + }; + + "certifi" = python.mkDerivation { + name = "certifi-2020.4.5.1"; + src = pkgs.fetchurl { + url = "https://files.pythonhosted.org/packages/b8/e2/a3a86a67c3fc8249ed305fc7b7d290ebe5e4d46ad45573884761ef4dea7b/certifi-2020.4.5.1.tar.gz"; + sha256 = "51fcb31174be6e6664c5f69e3e1691a2d72a1a12e90f872cbdb1567eb47b6519"; +}; + doCheck = commonDoCheck; + format = "setuptools"; + buildInputs = commonBuildInputs ++ [ ]; + propagatedBuildInputs = [ ]; + meta = with pkgs.stdenv.lib; { + homepage = "https://certifiio.readthedocs.io/en/latest/"; + license = licenses.mpl20; + description = "Python package for providing Mozilla's CA Bundle."; + }; + }; + + "chardet" = python.mkDerivation { + name = "chardet-3.0.4"; + src = pkgs.fetchurl { + url = "https://files.pythonhosted.org/packages/fc/bb/a5768c230f9ddb03acc9ef3f0d4a3cf93462473795d18e9535498c8f929d/chardet-3.0.4.tar.gz"; + sha256 = "84ab92ed1c4d4f16916e05906b6b75a6c0fb5db821cc65e70cbd64a3e2a5eaae"; +}; + doCheck = commonDoCheck; + format = "setuptools"; + buildInputs = commonBuildInputs ++ [ ]; + propagatedBuildInputs = [ ]; + meta = with pkgs.stdenv.lib; { + homepage = "https://github.com/chardet/chardet"; + license = licenses.lgpl2; + description = "Universal encoding detector for Python 2 and 3"; + }; + }; + + "docutils" = python.mkDerivation { + name = "docutils-0.16"; + src = pkgs.fetchurl { + url = "https://files.pythonhosted.org/packages/2f/e0/3d435b34abd2d62e8206171892f174b180cd37b09d57b924ca5c2ef2219d/docutils-0.16.tar.gz"; + sha256 = "c2de3a60e9e7d07be26b7f2b00ca0309c207e06c100f9cc2a94931fc75a478fc"; +}; + doCheck = commonDoCheck; + format = "setuptools"; + buildInputs = commonBuildInputs ++ [ ]; + propagatedBuildInputs = [ ]; + meta = with pkgs.stdenv.lib; { + homepage = "http://docutils.sourceforge.net/"; + license = licenses.publicDomain; + description = "Docutils -- Python Documentation Utilities"; + }; + }; + + "idna" = python.mkDerivation { + name = "idna-2.9"; + src = pkgs.fetchurl { + url = "https://files.pythonhosted.org/packages/cb/19/57503b5de719ee45e83472f339f617b0c01ad75cba44aba1e4c97c2b0abd/idna-2.9.tar.gz"; + sha256 = "7588d1c14ae4c77d74036e8c22ff447b26d0fde8f007354fd48a7814db15b7cb"; +}; + doCheck = commonDoCheck; + format = "setuptools"; + buildInputs = commonBuildInputs ++ [ ]; + propagatedBuildInputs = [ ]; + meta = with pkgs.stdenv.lib; { + homepage = "https://github.com/kjd/idna"; + license = licenses.bsdOriginal; + description = "Internationalized Domain Names in Applications (IDNA)"; + }; + }; + + "imagesize" = python.mkDerivation { + name = "imagesize-1.2.0"; + src = pkgs.fetchurl { + url = "https://files.pythonhosted.org/packages/e4/9f/0452b459c8ba97e07c3cd2bd243783936a992006cf4cd1353c314a927028/imagesize-1.2.0.tar.gz"; + sha256 = "b1f6b5a4eab1f73479a50fb79fcf729514a900c341d8503d62a62dbc4127a2b1"; +}; + doCheck = commonDoCheck; + format = "setuptools"; + buildInputs = commonBuildInputs ++ [ ]; + propagatedBuildInputs = [ ]; + meta = with pkgs.stdenv.lib; { + homepage = "https://github.com/shibukawa/imagesize_py"; + license = licenses.mit; + description = "Getting image size from png/jpeg/jpeg2000/gif file"; + }; + }; + + "importlib-metadata" = python.mkDerivation { + name = "importlib-metadata-1.6.0"; + src = pkgs.fetchurl { + url = "https://files.pythonhosted.org/packages/b4/1b/baab42e3cd64c9d5caac25a9d6c054f8324cdc38975a44d600569f1f7158/importlib_metadata-1.6.0.tar.gz"; + sha256 = "34513a8a0c4962bc66d35b359558fd8a5e10cd472d37aec5f66858addef32c1e"; +}; + doCheck = commonDoCheck; + format = "pyproject"; + buildInputs = commonBuildInputs ++ [ + self."setuptools" + self."setuptools-scm" + self."wheel" + ]; + propagatedBuildInputs = [ + self."zipp" + ]; + meta = with pkgs.stdenv.lib; { + homepage = "http://importlib-metadata.readthedocs.io/"; + license = licenses.asl20; + description = "Read metadata from Python packages"; + }; + }; + + "jinja2" = python.mkDerivation { + name = "jinja2-2.11.2"; + src = pkgs.fetchurl { + url = "https://files.pythonhosted.org/packages/64/a7/45e11eebf2f15bf987c3bc11d37dcc838d9dc81250e67e4c5968f6008b6c/Jinja2-2.11.2.tar.gz"; + sha256 = "89aab215427ef59c34ad58735269eb58b1a5808103067f7bb9d5836c651b3bb0"; +}; + doCheck = commonDoCheck; + format = "setuptools"; + buildInputs = commonBuildInputs ++ [ ]; + propagatedBuildInputs = [ + self."markupsafe" + ]; + meta = with pkgs.stdenv.lib; { + homepage = "https://palletsprojects.com/p/jinja/"; + license = licenses.bsdOriginal; + description = "A very fast and expressive template engine."; + }; + }; + + "livereload" = python.mkDerivation { + name = "livereload-2.6.1"; + src = pkgs.fetchurl { + url = "https://files.pythonhosted.org/packages/27/26/85ba3851d2e4905be7d2d41082adca833182bb1d7de9dfc7f623383d36e1/livereload-2.6.1.tar.gz"; + sha256 = "89254f78d7529d7ea0a3417d224c34287ebfe266b05e67e51facaf82c27f0f66"; +}; + doCheck = commonDoCheck; + format = "setuptools"; + buildInputs = commonBuildInputs ++ [ ]; + propagatedBuildInputs = [ + self."six" + self."tornado" + ]; + meta = with pkgs.stdenv.lib; { + homepage = "https://github.com/lepture/python-livereload"; + license = licenses.bsdOriginal; + description = "Python LiveReload is an awesome tool for web developers"; + }; + }; + + "markupsafe" = python.mkDerivation { + name = "markupsafe-1.1.1"; + src = pkgs.fetchurl { + url = "https://files.pythonhosted.org/packages/b9/2e/64db92e53b86efccfaea71321f597fa2e1b2bd3853d8ce658568f7a13094/MarkupSafe-1.1.1.tar.gz"; + sha256 = "29872e92839765e546828bb7754a68c418d927cd064fd4708fab9fe9c8bb116b"; +}; + doCheck = commonDoCheck; + format = "setuptools"; + buildInputs = commonBuildInputs ++ [ ]; + propagatedBuildInputs = [ ]; + meta = with pkgs.stdenv.lib; { + homepage = "https://palletsprojects.com/p/markupsafe/"; + license = licenses.bsdOriginal; + description = "Safely add untrusted strings to HTML/XML markup."; + }; + }; + + "packaging" = python.mkDerivation { + name = "packaging-20.3"; + src = pkgs.fetchurl { + url = "https://files.pythonhosted.org/packages/65/37/83e3f492eb52d771e2820e88105f605335553fe10422cba9d256faeb1702/packaging-20.3.tar.gz"; + sha256 = "3c292b474fda1671ec57d46d739d072bfd495a4f51ad01a055121d81e952b7a3"; +}; + doCheck = commonDoCheck; + format = "setuptools"; + buildInputs = commonBuildInputs ++ [ ]; + propagatedBuildInputs = [ + self."pyparsing" + self."six" + ]; + meta = with pkgs.stdenv.lib; { + homepage = "https://github.com/pypa/packaging"; + license = licenses.asl20; + description = "Core utilities for Python packages"; + }; + }; + + "pallets-sphinx-themes" = python.mkDerivation { + name = "pallets-sphinx-themes-1.2.3"; + src = pkgs.fetchurl { + url = "https://files.pythonhosted.org/packages/75/f6/e30ee3a57b57e4d96751d5613bf819f05d1c10728663dd402674094b12e4/Pallets-Sphinx-Themes-1.2.3.tar.gz"; + sha256 = "bbb4fd6e259d498e4e5b4866860f12f0c4e59a67c9ac243eb8c1472cbc730aaf"; +}; + doCheck = commonDoCheck; + format = "setuptools"; + buildInputs = commonBuildInputs ++ [ ]; + propagatedBuildInputs = [ + self."importlib-metadata" + self."packaging" + self."sphinx" + ]; + meta = with pkgs.stdenv.lib; { + homepage = "https://sphinx-themes.palletsprojects.com/"; + license = licenses.bsdOriginal; + description = "Sphinx themes for Pallets and related projects."; + }; + }; + + "pygments" = python.mkDerivation { + name = "pygments-2.6.1"; + src = pkgs.fetchurl { + url = "https://files.pythonhosted.org/packages/6e/4d/4d2fe93a35dfba417311a4ff627489a947b01dc0cc377a3673c00cf7e4b2/Pygments-2.6.1.tar.gz"; + sha256 = "647344a061c249a3b74e230c739f434d7ea4d8b1d5f3721bc0f3558049b38f44"; +}; + doCheck = commonDoCheck; + format = "setuptools"; + buildInputs = commonBuildInputs ++ [ ]; + propagatedBuildInputs = [ ]; + meta = with pkgs.stdenv.lib; { + homepage = "https://pygments.org/"; + license = licenses.bsdOriginal; + description = "Pygments is a syntax highlighting package written in Python."; + }; + }; + + "pyparsing" = python.mkDerivation { + name = "pyparsing-2.4.7"; + src = pkgs.fetchurl { + url = "https://files.pythonhosted.org/packages/c1/47/dfc9c342c9842bbe0036c7f763d2d6686bcf5eb1808ba3e170afdb282210/pyparsing-2.4.7.tar.gz"; + sha256 = "c203ec8783bf771a155b207279b9bccb8dea02d8f0c9e5f8ead507bc3246ecc1"; +}; + doCheck = commonDoCheck; + format = "setuptools"; + buildInputs = commonBuildInputs ++ [ ]; + propagatedBuildInputs = [ ]; + meta = with pkgs.stdenv.lib; { + homepage = "https://github.com/pyparsing/pyparsing/"; + license = licenses.mit; + description = "Python parsing module"; + }; + }; + + "pytz" = python.mkDerivation { + name = "pytz-2020.1"; + src = pkgs.fetchurl { + url = "https://files.pythonhosted.org/packages/f4/f6/94fee50f4d54f58637d4b9987a1b862aeb6cd969e73623e02c5c00755577/pytz-2020.1.tar.gz"; + sha256 = "c35965d010ce31b23eeb663ed3cc8c906275d6be1a34393a1d73a41febf4a048"; +}; + doCheck = commonDoCheck; + format = "setuptools"; + buildInputs = commonBuildInputs ++ [ ]; + propagatedBuildInputs = [ ]; + meta = with pkgs.stdenv.lib; { + homepage = "http://pythonhosted.org/pytz"; + license = licenses.mit; + description = "World timezone definitions, modern and historical"; + }; + }; + + "requests" = python.mkDerivation { + name = "requests-2.23.0"; + src = pkgs.fetchurl { + url = "https://files.pythonhosted.org/packages/f5/4f/280162d4bd4d8aad241a21aecff7a6e46891b905a4341e7ab549ebaf7915/requests-2.23.0.tar.gz"; + sha256 = "b3f43d496c6daba4493e7c431722aeb7dbc6288f52a6e04e7b6023b0247817e6"; +}; + doCheck = commonDoCheck; + format = "setuptools"; + buildInputs = commonBuildInputs ++ [ ]; + propagatedBuildInputs = [ + self."certifi" + self."chardet" + self."idna" + self."urllib3" + ]; + meta = with pkgs.stdenv.lib; { + homepage = "https://requests.readthedocs.io"; + license = licenses.asl20; + description = "Python HTTP for Humans."; + }; + }; + + "setuptools" = python.mkDerivation { + name = "setuptools-46.4.0"; + src = pkgs.fetchurl { + url = "https://files.pythonhosted.org/packages/ac/d6/0f6c0d9d0b07bbb2085e94a71aded1e137c7c9002ac54924bc1c0adf748a/setuptools-46.4.0.zip"; + sha256 = "4334fc63121aafb1cc98fd5ae5dd47ea8ad4a38ad638b47af03a686deb14ef5b"; +}; + doCheck = commonDoCheck; + format = "setuptools"; + buildInputs = commonBuildInputs ++ [ ]; + propagatedBuildInputs = [ ]; + meta = with pkgs.stdenv.lib; { + homepage = "https://github.com/pypa/setuptools"; + license = licenses.mit; + description = "Easily download, build, install, upgrade, and uninstall Python packages"; + }; + }; + + "setuptools-scm" = python.mkDerivation { + name = "setuptools-scm-3.5.0"; + src = pkgs.fetchurl { + url = "https://files.pythonhosted.org/packages/b2/f7/60a645aae001a2e06cf4b8db2fba9d9f36b8fd378f10647e3e218b61b74b/setuptools_scm-3.5.0.tar.gz"; + sha256 = "5bdf21a05792903cafe7ae0c9501182ab52497614fa6b1750d9dbae7b60c1a87"; +}; + doCheck = commonDoCheck; + format = "pyproject"; + buildInputs = commonBuildInputs ++ [ + self."setuptools" + self."wheel" + ]; + propagatedBuildInputs = [ ]; + meta = with pkgs.stdenv.lib; { + homepage = "https://github.com/pypa/setuptools_scm/"; + license = licenses.mit; + description = "the blessed package to manage your versions by scm tags"; + }; + }; + + "six" = python.mkDerivation { + name = "six-1.14.0"; + src = pkgs.fetchurl { + url = "https://files.pythonhosted.org/packages/21/9f/b251f7f8a76dec1d6651be194dfba8fb8d7781d10ab3987190de8391d08e/six-1.14.0.tar.gz"; + sha256 = "236bdbdce46e6e6a3d61a337c0f8b763ca1e8717c03b369e87a7ec7ce1319c0a"; +}; + doCheck = commonDoCheck; + format = "setuptools"; + buildInputs = commonBuildInputs ++ [ ]; + propagatedBuildInputs = [ ]; + meta = with pkgs.stdenv.lib; { + homepage = "https://github.com/benjaminp/six"; + license = licenses.mit; + description = "Python 2 and 3 compatibility utilities"; + }; + }; + + "snowballstemmer" = python.mkDerivation { + name = "snowballstemmer-2.0.0"; + src = pkgs.fetchurl { + url = "https://files.pythonhosted.org/packages/21/1b/6b8bbee253195c61aeaa61181bb41d646363bdaa691d0b94b304d4901193/snowballstemmer-2.0.0.tar.gz"; + sha256 = "df3bac3df4c2c01363f3dd2cfa78cce2840a79b9f1c2d2de9ce8d31683992f52"; +}; + doCheck = commonDoCheck; + format = "setuptools"; + buildInputs = commonBuildInputs ++ [ ]; + propagatedBuildInputs = [ ]; + meta = with pkgs.stdenv.lib; { + homepage = "https://github.com/snowballstem/snowball"; + license = licenses.bsdOriginal; + description = "This package provides 26 stemmers for 25 languages generated from Snowball algorithms."; + }; + }; + + "sphinx" = python.mkDerivation { + name = "sphinx-3.0.3"; + src = pkgs.fetchurl { + url = "https://files.pythonhosted.org/packages/12/a9/41a67d6638323b763b284a80b57461fe3557b128efcce892360cd73879ce/Sphinx-3.0.3.tar.gz"; + sha256 = "62edfd92d955b868d6c124c0942eba966d54b5f3dcb4ded39e65f74abac3f572"; +}; + doCheck = commonDoCheck; + format = "setuptools"; + buildInputs = commonBuildInputs ++ [ ]; + propagatedBuildInputs = [ + self."alabaster" + self."babel" + self."docutils" + self."imagesize" + self."jinja2" + self."packaging" + self."pygments" + self."requests" + self."setuptools" + self."snowballstemmer" + self."sphinxcontrib-applehelp" + self."sphinxcontrib-devhelp" + self."sphinxcontrib-htmlhelp" + self."sphinxcontrib-jsmath" + self."sphinxcontrib-qthelp" + self."sphinxcontrib-serializinghtml" + ]; + meta = with pkgs.stdenv.lib; { + homepage = "http://sphinx-doc.org/"; + license = licenses.bsdOriginal; + description = "Python documentation generator"; + }; + }; + + "sphinxcontrib-applehelp" = python.mkDerivation { + name = "sphinxcontrib-applehelp-1.0.2"; + src = pkgs.fetchurl { + url = "https://files.pythonhosted.org/packages/9f/01/ad9d4ebbceddbed9979ab4a89ddb78c9760e74e6757b1880f1b2760e8295/sphinxcontrib-applehelp-1.0.2.tar.gz"; + sha256 = "a072735ec80e7675e3f432fcae8610ecf509c5f1869d17e2eecff44389cdbc58"; +}; + doCheck = commonDoCheck; + format = "setuptools"; + buildInputs = commonBuildInputs ++ [ ]; + propagatedBuildInputs = [ ]; + meta = with pkgs.stdenv.lib; { + homepage = "http://sphinx-doc.org/"; + license = licenses.bsdOriginal; + description = "sphinxcontrib-applehelp is a sphinx extension which outputs Apple help books"; + }; + }; + + "sphinxcontrib-devhelp" = python.mkDerivation { + name = "sphinxcontrib-devhelp-1.0.2"; + src = pkgs.fetchurl { + url = "https://files.pythonhosted.org/packages/98/33/dc28393f16385f722c893cb55539c641c9aaec8d1bc1c15b69ce0ac2dbb3/sphinxcontrib-devhelp-1.0.2.tar.gz"; + sha256 = "ff7f1afa7b9642e7060379360a67e9c41e8f3121f2ce9164266f61b9f4b338e4"; +}; + doCheck = commonDoCheck; + format = "setuptools"; + buildInputs = commonBuildInputs ++ [ ]; + propagatedBuildInputs = [ ]; + meta = with pkgs.stdenv.lib; { + homepage = "http://sphinx-doc.org/"; + license = licenses.bsdOriginal; + description = "sphinxcontrib-devhelp is a sphinx extension which outputs Devhelp document."; + }; + }; + + "sphinxcontrib-htmlhelp" = python.mkDerivation { + name = "sphinxcontrib-htmlhelp-1.0.3"; + src = pkgs.fetchurl { + url = "https://files.pythonhosted.org/packages/c9/2e/a7a5fef38327b7f643ed13646321d19903a2f54b0a05868e4bc34d729e1f/sphinxcontrib-htmlhelp-1.0.3.tar.gz"; + sha256 = "e8f5bb7e31b2dbb25b9cc435c8ab7a79787ebf7f906155729338f3156d93659b"; +}; + doCheck = commonDoCheck; + format = "setuptools"; + buildInputs = commonBuildInputs ++ [ ]; + propagatedBuildInputs = [ ]; + meta = with pkgs.stdenv.lib; { + homepage = "http://sphinx-doc.org/"; + license = licenses.bsdOriginal; + description = "sphinxcontrib-htmlhelp is a sphinx extension which renders HTML help files"; + }; + }; + + "sphinxcontrib-jsmath" = python.mkDerivation { + name = "sphinxcontrib-jsmath-1.0.1"; + src = pkgs.fetchurl { + url = "https://files.pythonhosted.org/packages/b2/e8/9ed3830aeed71f17c026a07a5097edcf44b692850ef215b161b8ad875729/sphinxcontrib-jsmath-1.0.1.tar.gz"; + sha256 = "a9925e4a4587247ed2191a22df5f6970656cb8ca2bd6284309578f2153e0c4b8"; +}; + doCheck = commonDoCheck; + format = "setuptools"; + buildInputs = commonBuildInputs ++ [ ]; + propagatedBuildInputs = [ ]; + meta = with pkgs.stdenv.lib; { + homepage = "http://sphinx-doc.org/"; + license = licenses.bsdOriginal; + description = "A sphinx extension which renders display math in HTML via JavaScript"; + }; + }; + + "sphinxcontrib-qthelp" = python.mkDerivation { + name = "sphinxcontrib-qthelp-1.0.3"; + src = pkgs.fetchurl { + url = "https://files.pythonhosted.org/packages/b1/8e/c4846e59f38a5f2b4a0e3b27af38f2fcf904d4bfd82095bf92de0b114ebd/sphinxcontrib-qthelp-1.0.3.tar.gz"; + sha256 = "4c33767ee058b70dba89a6fc5c1892c0d57a54be67ddd3e7875a18d14cba5a72"; +}; + doCheck = commonDoCheck; + format = "setuptools"; + buildInputs = commonBuildInputs ++ [ ]; + propagatedBuildInputs = [ ]; + meta = with pkgs.stdenv.lib; { + homepage = "http://sphinx-doc.org/"; + license = licenses.bsdOriginal; + description = "sphinxcontrib-qthelp is a sphinx extension which outputs QtHelp document."; + }; + }; + + "sphinxcontrib-serializinghtml" = python.mkDerivation { + name = "sphinxcontrib-serializinghtml-1.1.4"; + src = pkgs.fetchurl { + url = "https://files.pythonhosted.org/packages/ac/86/021876a9dd4eac9dae0b1d454d848acbd56d5574d350d0f835043b5ac2cd/sphinxcontrib-serializinghtml-1.1.4.tar.gz"; + sha256 = "eaa0eccc86e982a9b939b2b82d12cc5d013385ba5eadcc7e4fed23f4405f77bc"; +}; + doCheck = commonDoCheck; + format = "setuptools"; + buildInputs = commonBuildInputs ++ [ ]; + propagatedBuildInputs = [ ]; + meta = with pkgs.stdenv.lib; { + homepage = "http://sphinx-doc.org/"; + license = licenses.bsdOriginal; + description = "sphinxcontrib-serializinghtml is a sphinx extension which outputs "serialized" HTML files (json and pickle)."; + }; + }; + + "toml" = python.mkDerivation { + name = "toml-0.10.1"; + src = pkgs.fetchurl { + url = "https://files.pythonhosted.org/packages/da/24/84d5c108e818ca294efe7c1ce237b42118643ce58a14d2462b3b2e3800d5/toml-0.10.1.tar.gz"; + sha256 = "926b612be1e5ce0634a2ca03470f95169cf16f939018233a670519cb4ac58b0f"; +}; + doCheck = commonDoCheck; + format = "setuptools"; + buildInputs = commonBuildInputs ++ [ ]; + propagatedBuildInputs = [ ]; + meta = with pkgs.stdenv.lib; { + homepage = "https://github.com/uiri/toml"; + license = licenses.mit; + description = "Python Library for Tom's Obvious, Minimal Language"; + }; + }; + + "tornado" = python.mkDerivation { + name = "tornado-6.0.4"; + src = pkgs.fetchurl { + url = "https://files.pythonhosted.org/packages/95/84/119a46d494f008969bf0c775cb2c6b3579d3c4cc1bb1b41a022aa93ee242/tornado-6.0.4.tar.gz"; + sha256 = "0fe2d45ba43b00a41cd73f8be321a44936dc1aba233dee979f17a042b83eb6dc"; +}; + doCheck = commonDoCheck; + format = "setuptools"; + buildInputs = commonBuildInputs ++ [ ]; + propagatedBuildInputs = [ ]; + meta = with pkgs.stdenv.lib; { + homepage = "http://www.tornadoweb.org/"; + license = licenses.asl20; + description = "Tornado is a Python web framework and asynchronous networking library, originally developed at FriendFeed."; + }; + }; + + "urllib3" = python.mkDerivation { + name = "urllib3-1.25.9"; + src = pkgs.fetchurl { + url = "https://files.pythonhosted.org/packages/05/8c/40cd6949373e23081b3ea20d5594ae523e681b6f472e600fbc95ed046a36/urllib3-1.25.9.tar.gz"; + sha256 = "3018294ebefce6572a474f0604c2021e33b3fd8006ecd11d62107a5d2a963527"; +}; + doCheck = commonDoCheck; + format = "setuptools"; + buildInputs = commonBuildInputs ++ [ ]; + propagatedBuildInputs = [ ]; + meta = with pkgs.stdenv.lib; { + homepage = "https://urllib3.readthedocs.io/"; + license = licenses.mit; + description = "HTTP library with thread-safe connection pooling, file post, and more."; + }; + }; + + "wheel" = python.mkDerivation { + name = "wheel-0.34.2"; + src = pkgs.fetchurl { + url = "https://files.pythonhosted.org/packages/75/28/521c6dc7fef23a68368efefdcd682f5b3d1d58c2b90b06dc1d0b805b51ae/wheel-0.34.2.tar.gz"; + sha256 = "8788e9155fe14f54164c1b9eb0a319d98ef02c160725587ad60f14ddc57b6f96"; +}; + doCheck = commonDoCheck; + format = "setuptools"; + buildInputs = commonBuildInputs ++ [ + self."setuptools" + ]; + propagatedBuildInputs = [ ]; + meta = with pkgs.stdenv.lib; { + homepage = "https://github.com/pypa/wheel"; + license = licenses.mit; + description = "A built-package format for Python"; + }; + }; + + "zipp" = python.mkDerivation { + name = "zipp-3.1.0"; + src = pkgs.fetchurl { + url = "https://files.pythonhosted.org/packages/ce/8c/2c5f7dc1b418f659d36c04dec9446612fc7b45c8095cc7369dd772513055/zipp-3.1.0.tar.gz"; + sha256 = "c599e4d75c98f6798c509911d08a22e6c021d074469042177c8c86fb92eefd96"; +}; + doCheck = commonDoCheck; + format = "pyproject"; + buildInputs = commonBuildInputs ++ [ + self."setuptools" + self."setuptools-scm" + self."wheel" + ]; + propagatedBuildInputs = [ ]; + meta = with pkgs.stdenv.lib; { + homepage = "https://github.com/jaraco/zipp"; + license = licenses.mit; + description = "Backport of pathlib-compatible object wrapper for zip files"; + }; + }; + }; + localOverridesFile = ./requirements_override.nix; + localOverrides = import localOverridesFile { inherit pkgs python; }; + commonOverrides = [ + (let src = pkgs.fetchFromGitHub { owner = "nix-community"; repo = "pypi2nix-overrides"; rev = "100c15ec7dfe7d241402ecfb1e796328d0eaf1ec"; sha256 = "0akfkvdakcdxc1lrxznh1rz2811x4pafnsq3jnyr5pn3m30pc7db"; } ; in import "${src}/overrides.nix" { inherit pkgs python; }) + ]; + paramOverrides = [ + (overrides { inherit pkgs python; }) + ]; + allOverrides = + (if (builtins.pathExists localOverridesFile) + then [localOverrides] else [] ) ++ commonOverrides ++ paramOverrides; + +in python.withPackages + (fix' (pkgs.lib.fold + extends + generated + allOverrides + ) + ) \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index bc5b3668a87..7a3445d84e2 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,2 +1,5 @@ +# After updating run: +# nix-shell -p pypi2nix --run "pypi2nix -r requirements.txt" sphinx==3.0.3 Pallets-Sphinx-Themes==1.2.3 +livereload==2.6.1 \ No newline at end of file diff --git a/requirements_override.nix b/requirements_override.nix new file mode 100644 index 00000000000..3b704ef9316 --- /dev/null +++ b/requirements_override.nix @@ -0,0 +1,5 @@ +{ pkgs, python }: + +self: super: { + +} \ No newline at end of file diff --git a/source/contributing.rst b/source/contributing.rst deleted file mode 120000 index 798f2aa2fc5..00000000000 --- a/source/contributing.rst +++ /dev/null @@ -1 +0,0 @@ -../CONTRIBUTING.rst \ No newline at end of file diff --git a/source/index.rst b/source/index.rst index 2956599f4fb..4b8067bfa0b 100644 --- a/source/index.rst +++ b/source/index.rst @@ -1,31 +1,25 @@ -Welcome to Nix Community Cookbook's documentation! -================================================== +Welcome to nix.dev +================== -:Source code: `GitHub `_ -:Bug tracker: `GitHub issues `_ +:Source code / issues: `GitHub `_ :Generated: |today| -:Version: |version| .. topic:: Introduction - - Nix Community Cookbook presents topical, practical ways of using `Nix package manager `_ ecosystem. + + Welcome to documentation for developers wanting to get things done with Nix. The Cookbook supplements the official `Nix `_, `NixOS `_, - `Nixpkgs `_, `Hydra `_ and - `NixOps `_ manuals. - - To contribute to Nix Community Cookbook, please read :ref:`contributing`. + `Nixpkgs `_ and `NixOps `_ manuals. Table of Contents -================= +----------------- .. toctree:: :maxdepth: 3 + :glob: - installation.rst tutorials/index.rst nix-pills.rst faq.rst influences.rst - contributing.rst diff --git a/source/installation.rst b/source/installation.rst deleted file mode 100644 index 11e44375edc..00000000000 --- a/source/installation.rst +++ /dev/null @@ -1,2 +0,0 @@ -Installation -============ diff --git a/source/tutorials/contributing.rst b/source/tutorials/contributing.rst new file mode 100644 index 00000000000..cd8a297bd0b --- /dev/null +++ b/source/tutorials/contributing.rst @@ -0,0 +1,75 @@ +How to Contribute +================= + +This guide explains how you can contribute to Nix, Nix packages or +NixOS. + +Report an issue +--------------- + +We can only fix issues that we know of, so please report any issue you +encounter. + +Issues with the **package manager Nix** (including it's documentation) +are reported at https://github.com/NixOS/nix/issues. + +Issues with **specific packages or NixOS** (including it's modules and +documentation) are reported at https://github.com/NixOS/nixpkgs/issues. + +Make sure that there is not already an open issue for your problem. +Please follow the issue template and fill in all requested information +as they help us solve the problem. + +You need a `GitHub`_ account for that. + +Contribute to Nix +----------------- + +The package manager Nix is mostly written in C++. If you are a developer +and want to contribute to it's development, you can find information on +`how to setup a development environment`_ in the manual. + +You can find inspiration for things to improve in the `reported +issues`_. There are also some `issues tagged with easy`_ that are a good +start for new contributors. + +Feel free to join the `#nixos-dev IRC channel`_ on `Freenode`_ to get in +contact with other developers. + +Contribute to Nix packages +-------------------------- + +Packaging for Nix is simple when you have understood the basic concept. + +`The manual`_ explains step-by-step how to add new packages to the Nix +package collection. There are also `programming language specific +instructions`_. + +Contribute to NixOS +------------------- + +It’s pretty easy to contribute to NixOS compared to other linux +distributions. All the code is on GitHub in the repository `nixpkgs`_. +Everyone can propose an improvement and most of them get merged after a +review of the maintainers. You will get feedback in the pull request. + +See the `NixOS manual`_ to get started and find all the details. + +You can find inspiration for things to improve in the `reported +issues `__. There are also +`issues tagged with good-first-bug`_ that are a good start for new +contributors. + +Feel free to join the `#nixos-dev IRC channel`_ on Freenode< + +.. _GitHub: https://github.com/ +.. _how to setup a development environment: https://nixos.org/nix/manual/#chap-hacking +.. _reported issues: https://github.com/NixOS/nix/issues +.. _issues tagged with easy: https://github.com/NixOS/nix/labels/easy +.. _#nixos-dev IRC channel: irc://irc.freenode.net/nixos +.. _Freenode: https://freenode.net/ +.. _The manual: https://nixos.org/nixpkgs/manual/#chap-quick-start +.. _programming language specific instructions: https://nixos.org/nixpkgs/manual/#chap-language-support +.. _nixpkgs: https://github.com/NixOS/nixpkgs +.. _NixOS manual: https://nixos.org/nixos/manual/index.html#ch-development +.. _issues tagged with good-first-bug: https://github.com/NixOS/nixpkgs/labels/3.skill%3A%20good-first-bug \ No newline at end of file diff --git a/source/tutorials/dev-environment.rst b/source/tutorials/dev-environment.rst new file mode 100644 index 00000000000..692e78df3ba --- /dev/null +++ b/source/tutorials/dev-environment.rst @@ -0,0 +1,80 @@ +Setup a development environment +=============================== + +As an exercise, let us build a Python web application using the Flask +web framework. + +Create a new file ``default.nix``. This file is conventionally used for +specifying packages: + +.. code:: nix + + { pkgs ? import {} }: + + pkgs.python3Packages.buildPythonApplication { + pname = "myapp"; + src = ./.; + version = "0.1"; + propagatedBuildInputs = [ pkgs.python3Packages.flask ]; + } + +You will also need a simple Flask app as ``main.py``: + +.. code:: python + + #! /usr/bin/env python + + from flask import Flask + + app = Flask(__name__) + + @app.route("/") + def hello(): + return "Hello, Nix!" + + def run(): + app.run(host='0.0.0.0') + +and a ``setup.py`` script: + +.. code:: python + + from setuptools import setup + + setup( + name='myapp', + version='0.1', + py_modules=['myapp'], + entry_points={ + 'console_scripts': ['myapp = myapp:run'] + }, + ) + +Now build the package with: + +.. code:: bash + + nix-build + +This will create a symbolic link ``result`` to our package's path in the +Nix store, which looks like +``/nix/store/6i4l781jwk5vbia8as32637207kgkllj-myapp-0.1``. Look around +to see what is inside. + +You may notice we can run the application from the package like +``./result/bin/main.py``. We can still use the ``default.nix`` as a +shell environment to get the same result: + +.. code:: bash + + nix-shell default.nix + python3 main.py + +In this context, Nix takes on the role that you would otherwise use pip +or virtualenv for. Nix installs required dependencies and separates the +environment from others on your system. + +You can check this Nix configuration into version control and share it +with others to make sure you are all running the same software. +Especially with many dependencies this is a great way to prevent +configuration drift between different team members & contributors. \ No newline at end of file diff --git a/source/tutorials/first-shell.rst b/source/tutorials/first-shell.rst new file mode 100644 index 00000000000..7ea65083f41 --- /dev/null +++ b/source/tutorials/first-shell.rst @@ -0,0 +1,57 @@ +Your first shell +================ + +Nix can create reproducible environments given a declarative +configuration called a Nix expression. Reproducible means you can share +the configuration with others and guarantee that they are using the same +software as you. + +To get started, make a new folder and create a file called ``shell.nix`` +with the following contents: + +.. code:: nix + + { pkgs ? import {} }: + + pkgs.mkShell { + buildInputs = [ + pkgs.which + pkgs.htop + ]; + } + +Basically we import our package channel ``nixpkgs`` and make a shell +with ``which`` and ``htop`` as inputs. To enter this environment, type +in: + +.. code:: bash + + nix-shell + +The command will start downloading the missing packages from the cache. +This may take a few moments. When it is done, you are dropped into a new +shell. This shell provides the packages specified in ``shell.nix``. + +Run ``htop`` to confirm it is present. Quit the program again by hitting +Q. + +Now try ``which htop`` to check where the ``htop`` command is on-disk. +You should see something similar to this: + +.. code:: bash + + /nix/store/y3w2i8kfdbfj9rx287ad52rahjpgv423-htop-2.2.0/bin/htop + +This is the path to the binary in the Nix store. Nix installs all +packages into the store using a combination of its hash, name and +version. + +You can search for available packages using ``nix-env -qa``, for +example: + +.. code:: bash + + nix-env -qa python3 + nix-env -qa nodejs + nix-env -qa ghc + nix-env -qa cargo \ No newline at end of file diff --git a/source/tutorials/index.rst b/source/tutorials/index.rst index 1c3376213ba..f8a705e0de6 100644 --- a/source/tutorials/index.rst +++ b/source/tutorials/index.rst @@ -1,33 +1,10 @@ Tutorials ========= +.. toctree:: + :glob: -Hydra installation on NixOS ---------------------------- - -https://github.com/peti/hydra-tutorial/ - -Serving Nix binaries --------------------- - -Via HTTP -******** - - -Via SSH -******* - -https://github.com/edolstra/nix-serve - -Using precompiled packages within Nix -------------------------------------- - -Using Nix with --------------- - - -Docker -****** - -Travis-CI -********* + install-nix.rst + first-shell.rst + dev-environment.rst + contributing.rst diff --git a/source/tutorials/install-nix.rst b/source/tutorials/install-nix.rst new file mode 100644 index 00000000000..974cdc4ce73 --- /dev/null +++ b/source/tutorials/install-nix.rst @@ -0,0 +1,24 @@ +Install Nix +=========== + +While NixOS is a Linux distribution based on Nix, you can install Nix on +other Linux distributions, MacOS and Windows via WSL using the install +script from our website: + +.. code:: bash + + curl -L https://nixos.org/nix/install | sh + +(For security, you may want to `verify the script`_ using our GPG +signatures.) + +Check that the installation was successful by running + +.. code:: bash + + nix-channel --list + +This command displays the package distribution channel used by Nix. By +default, this is ``https://nixos.org/channels/nixpkgs-unstable`` + +.. _verify the script: %5B%root%%5Ddownload.html#nix-verify-installation \ No newline at end of file