docs: Adding conda environment for readthedocs.

Signed-off-by: Tim 'mithro' Ansell <me@mith.ro>
diff --git a/.readthedocs.yml b/.readthedocs.yml
new file mode 100644
index 0000000..93b8e44
--- /dev/null
+++ b/.readthedocs.yml
@@ -0,0 +1,16 @@
+# .readthedocs.yml
+# Read the Docs configuration file
+# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
+
+# Required
+version: 2
+
+# Build documentation in the docs/ directory with Sphinx
+sphinx:
+  configuration: docs/conf.py
+
+formats:
+ - htmlzip
+
+conda:
+  environment: docs/environment.yml
diff --git a/docs/.gitignore b/docs/.gitignore
index 04a69d7..c97efb9 100644
--- a/docs/.gitignore
+++ b/docs/.gitignore
@@ -1,4 +1,4 @@
-venv
+env
 _build
 tests/**/*.md
 tests/**/*.svg
diff --git a/docs/Makefile b/docs/Makefile
index b9eb204..64f9ba2 100644
--- a/docs/Makefile
+++ b/docs/Makefile
@@ -5,8 +5,8 @@
 
 # You can set these variables from the command line.
 SPHINXOPTS      =
-SPHINXBUILD     = [ -e venv/bin/activate ] && source venv/bin/activate; sphinx-build
-SPHINXAUTOBUILD = [ -e venv/bin/activate ] && source venv/bin/activate; sphinx-autobuild
+SPHINXBUILD     = [ -e env/bin/activate ] && source env/bin/activate; sphinx-build
+SPHINXAUTOBUILD = [ -e env/bin/activate ] && source env/bin/activate; sphinx-autobuild
 SPHINXPROJ      = SymbiFlowV2X
 SOURCEDIR       = .
 BUILDDIR        = _build
@@ -20,12 +20,21 @@
 
 .PHONY: help livehtml Makefile
 
-venv:
-	rm -rf venv
-	virtualenv --python=python3 venv
-	source venv/bin/activate; pip install -r requirements.txt
 
-.PHONY: venv
+env/Miniconda3-latest-Linux-x86_64.sh:
+	mkdir env
+	wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O env/Miniconda3-latest-Linux-x86_64.sh
+	chmod a+x env/Miniconda3-latest-Linux-x86_64.sh
+
+env:
+	rm -rf env
+	make env/Miniconda3-latest-Linux-x86_64.sh
+	./env/Miniconda3-latest-Linux-x86_64.sh -p $(PWD)/env -b -f
+	source env/bin/activate; conda config --system --add envs_dirs $(PWD)/env/envs
+	source env/bin/activate; conda config --system --add pkgs_dirs $(PWD)/env/pkgs
+	source env/bin/activate; conda env update --name base --file ./environment.yml
+
+.PHONY: env
 
 # Update fuzzer / minitest markdown links.
 tests-links:
diff --git a/docs/conf.py b/docs/conf.py
index 2f67c60..d442280 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -44,6 +44,7 @@
     'sphinx.ext.todo',
     'sphinx_markdown_tables',
     'symbolator_sphinx',
+    'sphinxcontrib_verilog_diagrams',
 ]
 
 # Add any paths that contain templates here, relative to this directory.
@@ -101,7 +102,7 @@
 # List of patterns, relative to source directory, that match files and
 # directories to ignore when looking for source files.
 # This patterns also effect to html_static_path and html_extra_path
-exclude_patterns = ['_build', 'venv', 'Thumbs.db', '.DS_Store']
+exclude_patterns = ['_build', 'env', 'Thumbs.db', '.DS_Store']
 
 # The name of the Pygments (syntax highlighting) style to use.
 pygments_style = 'default'
diff --git a/docs/environment.yml b/docs/environment.yml
new file mode 100644
index 0000000..e1b271c
--- /dev/null
+++ b/docs/environment.yml
@@ -0,0 +1,15 @@
+name: v2x-docs
+channels:
+- SymbiFlow
+- conda-forge
+- defaults
+dependencies:
+- python=3.7
+- pip
+- pycairo
+- pango
+- pygobject
+- yosys
+- netlistsvg
+- pip:                            # Packages installed from PyPI
+  - -r file:requirements.txt
diff --git a/docs/requirements.txt b/docs/requirements.txt
index 1785ecc..24bda82 100644
--- a/docs/requirements.txt
+++ b/docs/requirements.txt
@@ -10,8 +10,12 @@
 sphinxcontrib-napoleon
 
 # Markdown cross-reference solver library
-git+https://github.com/SymbiFlow/sphinxcontrib-markdown-symlinks
+git+https://github.com/SymbiFlow/sphinxcontrib-markdown-symlinks.git#egg=markdown_code_symlinks
 
+# Verilog diagrams using Yosys + netlistsvg
+git+https://github.com/SymbiFlow/sphinxcontrib-verilog-diagrams.git#egg=sphinxcontrib-verilog-diagrams
+
+# Module diagrams
 symbolator
 
 pycairo