about summary refs log tree commit diff
path: root/pkgs/by-name
diff options
context:
space:
mode:
authorRobert Schütz <nix@dotlambda.de>2024-02-11 18:45:16 +0000
committerGitHub <noreply@github.com>2024-02-11 18:45:16 +0000
commit8858d9c00ff0cd795f2694fc555c174d8fd4afbd (patch)
tree82acae910945e08dd09c50e479901e17ec3dea60 /pkgs/by-name
parentec060b9e04c593ebc7649db777494b4cbcb0e55a (diff)
parent97cbadde8a3b7c81f00f0c1d1715045051690ed9 (diff)
downloadnixlib-8858d9c00ff0cd795f2694fc555c174d8fd4afbd.tar
nixlib-8858d9c00ff0cd795f2694fc555c174d8fd4afbd.tar.gz
nixlib-8858d9c00ff0cd795f2694fc555c174d8fd4afbd.tar.bz2
nixlib-8858d9c00ff0cd795f2694fc555c174d8fd4afbd.tar.lz
nixlib-8858d9c00ff0cd795f2694fc555c174d8fd4afbd.tar.xz
nixlib-8858d9c00ff0cd795f2694fc555c174d8fd4afbd.tar.zst
nixlib-8858d9c00ff0cd795f2694fc555c174d8fd4afbd.zip
Merge pull request #287103 from dotlambda/mdformat-propagate
python311Packages.mdformat-*: propagate dependencies
Diffstat (limited to 'pkgs/by-name')
-rw-r--r--pkgs/by-name/md/mdformat/package.nix28
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: [ ])