1{
2 lib,
3 alejandra,
4 buildPythonPackage,
5 fetchFromGitHub,
6 mdformat,
7 poetry-core,
8 pytestCheckHook,
9 pythonOlder,
10}:
11
12buildPythonPackage rec {
13 pname = "mdformat-nix-alejandra";
14 version = "0.1.0";
15 pyproject = true;
16
17 disabled = pythonOlder "3.7";
18
19 src = fetchFromGitHub {
20 owner = "aldoborrero";
21 repo = "mdformat-nix-alejandra";
22 tag = version;
23 hash = "sha256-jUXApGsxCA+pRm4m4ZiHWlxmVkqCPx3A46oQdtyKz5g=";
24 };
25
26 postPatch = ''
27 substituteInPlace mdformat_nix_alejandra/__init__.py \
28 --replace-fail '"alejandra"' '"${lib.getExe alejandra}"'
29 '';
30
31 nativeBuildInputs = [ poetry-core ];
32
33 propagatedBuildInputs = [ mdformat ];
34
35 pythonImportsCheck = [ "mdformat_nix_alejandra" ];
36
37 nativeCheckInputs = [ pytestCheckHook ];
38
39 meta = with lib; {
40 description = "Mdformat plugin format Nix code blocks with alejandra";
41 homepage = "https://github.com/aldoborrero/mdformat-nix-alejandra";
42 license = licenses.mit;
43 maintainers = with maintainers; [ aldoborrero ];
44 };
45}