diff options
author | Robert Schütz <nix@dotlambda.de> | 2024-02-07 16:56:29 -0800 |
---|---|---|
committer | Robert Schütz <nix@dotlambda.de> | 2024-02-07 17:12:49 -0800 |
commit | f7205efda36e6cc54c4e791a346a0e44cfd59f69 (patch) | |
tree | 4c105af484eb4e48ac81fc65c56ebeeb9259dd1a /pkgs/by-name | |
parent | f8a2e6f1ff39f02a9a54f80a735ea0048ec20d21 (diff) | |
download | nixlib-f7205efda36e6cc54c4e791a346a0e44cfd59f69.tar nixlib-f7205efda36e6cc54c4e791a346a0e44cfd59f69.tar.gz nixlib-f7205efda36e6cc54c4e791a346a0e44cfd59f69.tar.bz2 nixlib-f7205efda36e6cc54c4e791a346a0e44cfd59f69.tar.lz nixlib-f7205efda36e6cc54c4e791a346a0e44cfd59f69.tar.xz nixlib-f7205efda36e6cc54c4e791a346a0e44cfd59f69.tar.zst nixlib-f7205efda36e6cc54c4e791a346a0e44cfd59f69.zip |
mdformat: move withPlugins to top-level attribute
Diffstat (limited to 'pkgs/by-name')
-rw-r--r-- | pkgs/by-name/md/mdformat/package.nix | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/pkgs/by-name/md/mdformat/package.nix b/pkgs/by-name/md/mdformat/package.nix new file mode 100644 index 000000000000..24cbd66d864c --- /dev/null +++ b/pkgs/by-name/md/mdformat/package.nix @@ -0,0 +1,28 @@ +{ lib +, python3 +, runCommand +}: + +let + python = python3; + + # selector is a function mapping pythonPackages to a list of plugins + # e.g. `mdformat.withPlugins (ps: with ps; [ mdformat-footnote ])` + withPlugins = selector: runCommand "mdformat-wrapped" { + inherit (python.pkgs.mdformat) pname version meta; + + nativeBuildInputs = [ + python.pkgs.wrapPython + ]; + + plugins = selector python.pkgs; + + passthru = { + inherit withPlugins; + }; + } '' + buildPythonPath $plugins + makeWrapper ${lib.getExe python.pkgs.mdformat} $out/bin/mdformat \ + --suffix PYTHONPATH : "$program_PYTHONPATH" + ''; +in withPlugins (ps: [ ]) |