about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/python-modules/mdformat-nix-alejandra/default.nix
blob: d59e09f999e0a83f2dd4f5848d777c2fd919d3b3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
{ lib
, alejandra
, buildPythonPackage
, fetchFromGitHub
, mdformat
, poetry-core
, pytestCheckHook
, pythonOlder
}:

buildPythonPackage rec {
  pname = "mdformat-nix-alejandra";
  version = "0.1.0";
  pyproject = true;

  disabled = pythonOlder "3.7";

  src = fetchFromGitHub {
    owner = "aldoborrero";
    repo = "mdformat-nix-alejandra";
    rev = "refs/tags/${version}";
    hash = "sha256-jUXApGsxCA+pRm4m4ZiHWlxmVkqCPx3A46oQdtyKz5g=";
  };

  postPatch = ''
    substituteInPlace mdformat_nix_alejandra/__init__.py \
      --replace-fail '"alejandra"' '"${lib.getExe alejandra}"'
  '';

  nativeBuildInputs = [
    poetry-core
  ];

  propagatedBuildInputs = [
    mdformat
  ];

  pythonImportsCheck = [
    "mdformat_nix_alejandra"
  ];

  nativeCheckInputs = [
    pytestCheckHook
  ];

  meta = with lib; {
    description = "Mdformat plugin format Nix code blocks with alejandra";
    homepage = "https://github.com/aldoborrero/mdformat-nix-alejandra";
    license = licenses.mit;
    maintainers = with maintainers; [ aldoborrero ];
  };
}