diff --git a/docs/docs.nix b/docs/docs.nix
index 03ac07df93e324c6f6d3b017bb51c242435b488b..67c0301c87a9808b4129ae1a316ff88d34f8e47e 100644
--- a/docs/docs.nix
+++ b/docs/docs.nix
@@ -1,6 +1,9 @@
-{ stdenv, lib, graphviz, plantuml, python3, sphinx }:
+{ pkgs, stdenv, lib, graphviz, plantuml, python3, sphinx }:
 let
-  pyenv = python3.withPackages (ps: [ ps.sphinx ps.sphinxcontrib_plantuml ]);
+  pyenv = pkgs.buildEnv {
+    name = "sphinx-env";
+    nativeBuildInputs = [ sphinx python3.pkgs.sphinxcontrib_plantuml ];
+  };
 in
 stdenv.mkDerivation rec {
   version = "0.0";
@@ -10,11 +13,10 @@ stdenv.mkDerivation rec {
   phases = [ "unpackPhase" "buildPhase" ];
 
   depsBuildBuild = [
-    graphviz
-    plantuml
+    pyenv
   ];
 
   buildPhase = ''
-    ${pyenv}/bin/sphinx-build -W docs/source $out/docs
+    sphinx-build -W docs/source $out/docs
   '';
 }