0

Here's the nix expression I'm trying to build:

{ python3Packages, fetchFromGitHub }:

let
  inherit (python3Packages) buildPythonPackage fetchPypi;
  attrs20 = buildPythonPackage rec {
    pname = "attrs";
    version = "20.3.0";
    src = fetchPypi {
      inherit pname; inherit version;
      sha256 = "007pchhxk2nh6m2rgflkkij9xjwysq3fl7xr72cy8i4pw76s6al3";
    };
    doCheck = false;
  };
  click = buildPythonPackage rec {
    pname = "click";
    version = "7.1";
    src = fetchPypi {
      inherit pname; inherit version;
      sha256 = "1qk0x1bh6pmn2al9kq6cbgvm7pchnzl6ahf4zzpbjljl5lpmabs8";
    };
  };
  jupytext = buildPythonPackage rec {
    pname = "jupytext";
    version = "1.10.3";
    src = fetchPypi {
      inherit pname; inherit version;
      sha256 = "09f0ra3ndq4sxb0q3pjx713pfyc731y6fkzx93481mc7qm2cym5x";
    };
    propagatedBuildInputs = with python3Packages; [
      toml
      pyyaml
      markdown-it-py
    ];
  };
  markdown-it-py = buildPythonPackage rec {
    pname = "markdown-it-py";
    version = "1.1.0";
    src = fetchFromGitHub {
      owner = "executablebooks";
      repo = "markdown-it-py";
      rev = "1d27af1da41fd3b00da8307040e6e274925437b2";
      sha256 = "priZH3ZbJxLm4drYt5Br5BWe+OSf4ZM0tpU7zPKw+UA=";
    };
    propagatedBuildInputs = [
      attrs20 python3Packages.mdit-py-plugins
    ];
    doCheck = false;
  };
  sphinxExternalTOC = buildPythonPackage rec {
    # https://pypi.org/project/sphinx-comments/
    pname = "sphinx-external-toc";
    version = "0.2.2";
    src = fetchPypi {
      pname = "sphinx_external_toc";
      inherit version;
      sha256 = "a72c5861f670f1c7a1b92f2159fc9c7c5370e079cad1e3a7be4b269fa8048e8a";
    };
    propagatedBuildInputs = [
      python3Packages.sphinx
      attrs20
      python3Packages.click
      python3Packages.pyyaml
      click
    ];
  };
  sphinxComments = buildPythonPackage rec {
    # https://pypi.org/project/sphinx-comments/
    pname = "sphinx-comments";
    version = "0.0.3";
    src = fetchPypi {
      inherit version; inherit pname;
      sha256 = "00170afff27019fad08e421da1ae49c681831fb2759786f07c826e89ac94cf21";
    };
    propagatedBuildInputs = with python3Packages; [
      sphinx
    ];
  };
in buildPythonPackage rec {
  pname = "jupyter-book";
  version = "0.11.2";
  src = fetchPypi {
    inherit version; inherit pname;
    sha256 = "e32298e03c19f514c745062891143693c5e001a098bae9d59d2e4434b2099c54";
  };
  propagatedBuildInputs = [
    # click
    attrs20
    python3Packages.linkify-it-py
    python3Packages.sphinx
    sphinxComments
    sphinxExternalTOC
    jupytext
  ];
}

And here's the flake that calls it:

{
  description = "Introduction to Computational Literary Analysis, a Textbook";

  outputs = { self, nixpkgs }: let
    system = "x86_64-linux";
    pkgs = import nixpkgs { inherit system; };
  in {
    jupyterBook = pkgs.callPackage ./jupyter-book.nix {};

    myPython = (nixpkgs.legacyPackages.${system}.python3.withPackages
      (ps: with ps; [
        # pip
        jupyter
        jupyterlab
        self.jupyterBook
        pandas
        nltk
        # spacy
      ]));

    defaultPackage.${system} = self.myPython;
  };
}

When I try to build it, it gives:

error: builder for '/nix/store/a0asbwxdkg04mh06caqv3dyvnza8vprm-python3.8-markdown-it-py-1.1.0.drv' failed with exit code 1;                                                                             
       last 10 log lines:
       > /build/source/dist /build/source
       > Processing ./markdown_it_py-1.1.0-py3-none-any.whl
       > Requirement already satisfied: attrs<22,>=19 in /nix/store/1xz5i9nznqv00n0gy0sz1sl71jpmk6ky-python3.8-attrs-20.3.0/lib/python3.8/site-packages (from markdown-it-py==1.1.0) (20.3.0)
       > Installing collected packages: markdown-it-py
       >   Attempting uninstall: markdown-it-py
       >     Found existing installation: markdown-it-py 1.0.0
       >     Uninstalling markdown-it-py-1.0.0:
       > ERROR: Could not install packages due to an OSError: [Errno 13] Permission denied: '/nix/store/v7lzi6nc4v3glskn3p03rz33qxjyf09m-python3.8-markdown-it-py-1.0.0/bin/markdown-it'
       > Consider using the `--user` option or check the permissions.
       > 
       For full logs, run 'nix log /nix/store/a0asbwxdkg04mh06caqv3dyvnza8vprm-python3.8-markdown-it-py-1.1.0.drv'.               
error: 1 dependencies of derivation '/nix/store/7cjf512wx4yrhbvr2mnfph5xpppiksxm-python3-3.8.9-env.drv' failed to build                                                                                      

What's causing this? And how might I fix it?

Jonathan
  • 10,571
  • 13
  • 67
  • 103
  • Looks like your [previous question](https://stackoverflow.com/questions/68786520/how-can-i-fix-errno-13-permission-denied-cmp-pyi-in-my-python-nix-flake/68787109#68787109). It would seem that `markdown-it-py` could be part of `mdit-py-plugins` and therefore shouldn't be an input to your own `markdown-it-py`. Did you try to apply the previous solution? – Robert Hensing Aug 15 '21 at 19:01
  • The previous solution was to add `doCheck = false`, which is in `markdown-it-py`. That build fails if I don't include `mdit-py-plugins`, since the build requires it. Should it not be an input? – Jonathan Aug 16 '21 at 23:34
  • It should not be an input. Nixpkgs can build `markdown-it-py` without `mdit-py-plugins`. – Robert Hensing Aug 17 '21 at 09:47
  • It can't build `markdown-it-py` without `mdit-py-plugins~=0.2.1`. Try it yourself. You get: `ERROR: Could not find a version that satisfies the requirement mdit-py-plugins~=0.2.1 (from markdown-it-py) > ERROR: No matching distribution found for mdit-py-plugins~=0.2.1 For full logs, run 'nix log /nix/store/dhiipwwf8pdkyld0dbk5ib62k7n76x4p-python3.8-markdown-it-py-0.6.2.drv'.` – Jonathan Aug 17 '21 at 14:46

0 Answers0