nixpkgs/pkgs/tools/text/mrkd/default.nix
adisbladis e0816431a2 treewide: Pass self when overriding Python
Otherwise references to the Python interpreter inside the set are wrong, as demonstrated by:
``` nix
with import <nixpkgs> { };
let
  python' = python3.override {
    packageOverrides = final: prev: { requests = prev.requests.overridePythonAttrs(old: { version = "1337";  }); };
  };
in python'.pkgs.python.pkgs.requests
```
which returns the _non_ overriden requests.

And the same with `self`:
```
with import <nixpkgs> { };
let
  python' = python3.override {
    self = python';
    packageOverrides = final: prev: { requests = prev.requests.overridePythonAttrs(old: { version = "1337";  }); };
  };
in python'.pkgs.python.pkgs.requests
```
which returns the overriden requests.

This can manifest itself as file collisions when constructing environments or as subtly incorrect dependency graphs.
2024-08-03 12:18:56 +12:00

54 lines
1.2 KiB
Nix

{ lib
, python3
, fetchPypi
}:
let
python = python3.override {
self = python;
packageOverrides = self: super: {
# https://github.com/refi64/mrkd/pull/6
mistune = super.mistune.overridePythonAttrs (old: rec {
version = "0.8.4";
src = fetchPypi {
inherit (old) pname;
inherit version;
hash = "sha256-WaNCnbU8ULXGvMigf4hIywDX3IvbQxpKtBkg0gHUdW4=";
};
meta = old.meta // {
knownVulnerabilities = [
"CVE-2022-34749"
];
};
});
};
};
in python.pkgs.buildPythonApplication rec {
pname = "mrkd";
version = "0.2.0";
format = "setuptools";
src = fetchPypi {
inherit pname version;
sha256 = "456f8c1be99da268554b29c6b5383532e58119def5a65d85270bc6a0ecc26aaf";
};
propagatedBuildInputs = with python.pkgs; [
jinja2
mistune
pygments
setuptools
];
pythonImportsCheck = [ "mrkd" ];
meta = with lib; {
description = "Write man pages using Markdown, and convert them to Roff or HTML";
homepage = "https://github.com/refi64/mrkd";
license = licenses.bsd2;
mainProgram = "mrkd";
maintainers = with maintainers; [ prusnak ];
};
}