From 7e98027d7b00f9a32f90ca8d58e4ecc882f491cf Mon Sep 17 00:00:00 2001 From: Niko Strijbol Date: Thu, 23 May 2024 15:29:31 +0200 Subject: [PATCH] Fix flake --- flake.nix | 40 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-) diff --git a/flake.nix b/flake.nix index 538fc449..af5fd754 100644 --- a/flake.nix +++ b/flake.nix @@ -38,7 +38,7 @@ }; nativeBuildInputs = - [ python.pkgs.pdm-pep517 python.pkgs.pdm-backend ]; + [ prev.pdm-pep517 prev.pdm-backend ]; doCheck = false; @@ -48,8 +48,46 @@ maintainers = [ ]; }; }; + # We need PyYAML with C support, but poetry2nix does not do that apparently... + # Taken from nixpkgs. + pyyaml = prev.buildPythonPackage rec { + pname = "pyyaml"; + version = "6.0.1"; + + format = "pyproject"; + + src = pkgs.fetchFromGitHub { + owner = "yaml"; + repo = "pyyaml"; + rev = version; + hash = "sha256-YjWMyMVDByLsN5vEecaYjHpR1sbBey1L/khn4oH9SPA="; + }; + + nativeBuildInputs = [ + prev.cython_0 + prev.setuptools + ]; + + buildInputs = [ pkgs.libyaml ]; + + checkPhase = '' + runHook preCheck + PYTHONPATH="tests/lib:$PYTHONPATH" ${python.interpreter} -m test_all + runHook postCheck + ''; + + pythonImportsCheck = [ "yaml" ]; + + meta = with pkgs.lib; { + description = "The next generation YAML parser and emitter for Python"; + homepage = "https://github.com/yaml/pyyaml"; + license = licenses.mit; + maintainers = with maintainers; [ ]; + }; + }; }; + # This one isn't in Nix, so do it manually. ast = pkgs.buildNpmPackage rec { pname = "abstract-syntax-tree";