self:
with self;
  stdenv.mkDerivation rec {
    pname = "psos-docs";
    version = "0.0.1";
    buildInputs = [
      mdbook
      mdbook-pdf
    ];

    src = ../docs/..; # wut

    phases = ["buildPhase" "installPhase"];

    buildPhase = ''
      cp -r $src/doc ./doc
      cp $src/README.md ./README.md
      chmod ug+w -R .
      ls -la .
      mdbook build doc
    '';

    installPhase = ''
      mkdir -p $out/lib/
      cp -r doc/book $out/lib/html
    '';
  }