Something went wrong. Try again.
What happens if I push all of nixpkgs
Something went wrong. Try again.
1.7 kB · 64 lines
Nix
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465# To build this derivation, run `nix-build -A nixpkgs-manual.pythonInterpreterTable`{ lib, writeText, pkgs, pythonInterpreters,}:let isPythonInterpreter = name: /* NB: Package names that don't follow the regular expression: - `python-cosmopolitan` is not part of `pkgs.pythonInterpreters`. - `_prebuilt` interpreters are used for bootstrapping internally. - `python3Minimal` contains python packages, left behind conservatively. - `rustpython` lacks `pythonVersion` and `implementation`. */ (lib.strings.match "(pypy|python)([[:digit:]]*)" name) != null;
interpreterName = pname: let cuteName = { cpython = "CPython"; pypy = "PyPy"; }; interpreter = pkgs.${pname}; in "${cuteName.${interpreter.implementation}} ${interpreter.pythonVersion}";
interpreters = lib.reverseList ( lib.naturalSort (lib.filter isPythonInterpreter (lib.attrNames pythonInterpreters)) );
aliases = pname: lib.attrNames ( lib.filterAttrs ( name: value: isPythonInterpreter name && name != pname && interpreterName name == interpreterName pname ) pkgs );
result = map (pname: { inherit pname; aliases = aliases pname; interpreter = interpreterName pname; }) interpreters;
toMarkdown = data: let line = package: '' | ${package.pname} | ${lib.concatStringsSep ", " package.aliases or [ ]} | ${package.interpreter} | ''; in lib.concatStringsSep "" (map line data);
inwriteText "python-interpreter-table.md" '' | Package | Aliases | Interpeter | |---------|---------|------------| ${toMarkdown result}''