Commit Graph

126 Commits

Author SHA1 Message Date
Ihar Hrachyshka
cca3b04b44 treewide: clean up 'meta = with' pattern
This commit was created by a combination of scripts and tools:
- an ast-grep script to prefix things in meta with `lib.`,
- a modified nixf-diagnose / nixf combination to remove unused `with lib;`, and
- regular nixfmt.

Co-authored-by: Wolfgang Walther <walther@technowledgy.de>
2025-12-10 19:01:23 +01:00
Philip Taron
4160763d74 various: lib usage improvements - prefer elem over any for list inclusion conditions (#455789) 2025-10-27 13:21:20 +00:00
h7x4
7720a6246f pypy: lib.mapAttrsToList -> lib.attrsNames 2025-10-26 15:33:34 +09:00
h7x4
92aa43a0df pypy3: lib.mapAttrsToList -> lib.attrsNames 2025-10-26 15:33:34 +09:00
h7x4
ff17d6952f pypy: lib.any -> lib.elem 2025-10-26 15:31:35 +09:00
adisbladis
3e6a5988c7 pythonInterpreters: Add passthru.pythonABITags
As documented in https://packaging.python.org/en/latest/specifications/platform-compatibility-tags/#abi-tag.

This is useful to check whether a wheel is compatible with a certain interpreter. [Pyproject.nix](https://github.com/pyproject-nix/pyproject.nix) has [functions to perform wheel compatibility checking](https://pyproject-nix.github.io/pyproject.nix/lib/pypa.html#function-library-lib.pypa.isWheelFileCompatible) against a Python interpreter, and has computed interpreter ABI tags itself.
The recent addition of free threading (`python313FreeThreading`) complicates this by not being introspectable:
A GIL Python (non free-threaded) has an ABI tag `cp313` while the free-threaded Python has `cp313t`, but the package doesn't communicate whether `enableGIL` is true or false, leaving no way to compute the tag.
The same goes for if debugging support was added to the derivation: A `d` suffix would need to be added.

Additionally ABI tags has no defined format and can really only be accurately computed by having insight into how the ABI tags are used by a specific interpreter, meaning that the only correct place to compute ABI tags is within the context of a particular Python derivation.

While this has no immediate use within nixpkgs it could be used as a basis to provide compatibility assertions regarding wheel compat at eval time.
2025-09-22 16:36:36 +12:00
Sandro Jäckel
7b2776c904 pypy: create and install _sysconfigdata__*.py like _sysconfigdata__linux_x86_64-linux-gnu.py 2025-09-16 13:13:01 +02:00
Sandro Jäckel
cee6df3f9d pypy: fix optimizationLevel 1 erroring 2025-09-16 13:12:40 +02:00
qbisi
743ae5d20c pypy: fix installPhase 2025-09-16 00:38:54 +02:00
Sandro Jäckel
c71ffb21a9 pypy: fix eval 2025-09-16 00:38:53 +02:00
Sandro Jäckel
6c77e93a06 pypy: put NIX_CFLAGS_COMPILE under env to fix withCFlags 2025-09-14 19:39:46 +02:00
Max Wipfli
e33181bc62 pypy{27,310,311}: make CFFI builds find libsqlite3 2025-08-07 11:00:23 +02:00
Wolfgang Walther
5a0711127c treewide: run nixfmt 1.0.0 2025-07-24 13:55:40 +02:00
Sergei Trofimovich
dc251ab95c pythonInterpreters.pypy310_prebuilt: set mainProgram
Without the change the eval fails as:

    $ nix build --no-link -f. pythonInterpreters.pypy310_prebuilt.tests.test-packageOverrides
    error:
       … in the condition of the assert statement
         at pkgs/development/interpreters/python/tests.nix:212:11:
          211|           in
          212|           assert myPython.pkgs.foobar == myPython.pkgs.numpy;
             |           ^
          213|           myPython.withPackages (ps: with ps; [ foobar ]);

       … while evaluating the attribute 'outPath'
         at lib/customisation.nix:421:7:
          420|         drv.drvPath;
          421|       outPath =
             |       ^
          422|         assert condition;

       (stack trace truncated; use '--show-trace' to show the full, detailed trace)

       error: attribute 'mainProgram' missing
       at pkgs/by-name/me/meson/package.nix:75:52:
           74|           --replace-fail "PythonExternalProgram('python3', mesonlib.python_command)" \
           75|                          "PythonExternalProgram('${python3.meta.mainProgram}', mesonlib.python_command)"
             |                                                    ^
           76|         substituteInPlace mesonbuild/modules/python3.py \
2025-06-01 10:06:49 +01:00
FliegendeWurst
2d23255ff5 pypy{27,310}: 7.3.17 -> 7.3.19, pypy311: init at 7.3.19 2025-05-09 08:53:22 +02:00
Silvan Mosberger
374e6bcc40 treewide: Format all Nix files
Format all Nix files using the officially approved formatter,
making the CI check introduced in the previous commit succeed:

  nix-build ci -A fmt.check

This is the next step of the of the [implementation](https://github.com/NixOS/nixfmt/issues/153)
of the accepted [RFC 166](https://github.com/NixOS/rfcs/pull/166).

This commit will lead to merge conflicts for a number of PRs,
up to an estimated ~1100 (~33%) among the PRs with activity in the past 2
months, but that should be lower than what it would be without the previous
[partial treewide format](https://github.com/NixOS/nixpkgs/pull/322537).

Merge conflicts caused by this commit can now automatically be resolved while rebasing using the
[auto-rebase script](8616af08d9/maintainers/scripts/auto-rebase).

If you run into any problems regarding any of this, please reach out to the
[formatting team](https://nixos.org/community/teams/formatting/) by
pinging @NixOS/nix-formatting.
2025-04-01 20:10:43 +02:00
Wolfgang Walther
b19d0f6d3d treewide: replace substituteAll with replaceVars 2025-02-10 22:51:56 +01:00
Emily
d1e7262564 pypy{27,39,310}: drop darwin.libutil dependency 2024-11-07 00:39:35 +00:00
Olivér Falvai
e6b926034f pypy: fix darwin build after sdk rework
https://hydra.nixos.org/build/276111920/nixlog/6/tail
2024-10-28 08:12:22 +01:00
Francesco Gazzetta
68576df997 treewide: move tcl libraries under tclPackages 2024-10-26 16:23:15 +00:00
Artturin
e0464e4788 treewide: replace stdenv.is with stdenv.hostPlatform.is
In preparation for the deprecation of `stdenv.isX`.

These shorthands are not conducive to cross-compilation because they
hide the platforms.

Darwin might get cross-compilation for which the continued usage of `stdenv.isDarwin` will get in the way

One example of why this is bad and especially affects compiler packages
https://www.github.com/NixOS/nixpkgs/pull/343059

There are too many files to go through manually but a treewide should
get users thinking when they see a `hostPlatform.isX` in a place where it
doesn't make sense.

```
fd --type f "\.nix" | xargs sd --fixed-strings "stdenv.is" "stdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "stdenv'.is" "stdenv'.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "clangStdenv.is" "clangStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "gccStdenv.is" "gccStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "stdenvNoCC.is" "stdenvNoCC.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "inherit (stdenv) is" "inherit (stdenv.hostPlatform) is"
fd --type f "\.nix" | xargs sd --fixed-strings "buildStdenv.is" "buildStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "effectiveStdenv.is" "effectiveStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "originalStdenv.is" "originalStdenv.hostPlatform.is"
```
2024-09-25 00:04:37 +03:00
Michael Raskin
be3dadb563 pypy: drop pycparser dependency to fix build 2024-05-12 16:01:00 +02:00
Sandro Jäckel
b3b12c2d08 Revert "Fix venv creation in Python environments"
This commit reverts all python changes from 234bb31f61.
2024-04-11 08:26:39 -07:00
Domen Kožar
fb884172ab Merge pull request #297628 from cwp/python-env-venv
Fix venv creation in Python environments
2024-03-22 19:17:13 +07:00
Colin Putney
234bb31f61 Fix venv creation in Python environments
The way we build python environments is subtly broken. A python
environment should be semantically identical to a vanilla Python
installation in, say, /usr/local. The current implementation, however,
differs in two important ways. The first is that it's impossible to use
python packages from the environment in python virtual environments. The
second is that the nix-generated environment appears to be a venv, but
it's not.

This commit changes the way python environments are built:

  * When generating wrappers for python executables, we inherit argv[0]
    from the wrapper. This causes python to initialize its configuration
    in the environment with all the correct paths.
  * We remove the sitecustomize.py file from the base python package.
    This file was used tweak the python configuration after it was
    incorrectly initialized. That's no longer necessary.

The end result is that python environments no longer appear to be venvs,
and behave more like a vanilla python installation. In addition it's
possible to create a venv using an environment and use packages from
both the environment and the venv.
2024-03-21 19:26:57 -06:00
stuebinm
ff1a94e523 treewide: add meta.mainProgram to packages with a single binary
The nixpkgs-unstable channel's programs.sqlite was used to identify
packages producing exactly one binary, and these automatically added
to their package definitions wherever possible.
2024-03-19 03:14:51 +01:00
Sandro Jäckel
904e7ce05b pypy: add option to change optimization level, update homepage, cleanup 2023-12-10 03:10:47 +01:00
Vladimír Čunát
dee43206d8 pypy*: fixup build
https://hydra.nixos.org/build/215259697
This is most likely fallout from PR #209870
2023-04-09 11:06:49 +02:00
Martin Weinelt
6e78ac9785 Merge pull request #217558 from winterqt/pypy3-fix-site-packages
pypy3{8,9}: fix sitePackages
2023-02-26 23:39:27 +00:00
Martin Weinelt
2af27d6143 pypy: Use hash everywhere
Fixes the build after cpython switched to hash.
2023-02-26 13:11:30 +00:00
Winter
e4dd2b8ca0 pypy3{8,9}: fix sitePackages
When PyPy introduced Python 3.8 support with version 7.3.6, they also
migrated to using CPython's directory layout [0]:

> The 3.8 package now uses the same layout as CPython, and many of the
PyPy-specific changes to `sysconfig`, `distutils.sysconfig`, and
`distutils.commands.install.py` have been removed. The stdlib now is
located in `<base>/lib/pypy3.8` on `posix` systems...

When we upgraded past this version and added Python 3.8 support [1], the
`sitePackages` value was never updated, leading `bootstrapped-pip` to fail
to build, because wheel was trying to be located in `$out/site-packages`,
when it was actually installed to `$out/lib/pypy3.8/site-packages`.

[0]: https://www.pypy.org/posts/2021/10/pypy-v736-release.html
[1]: eec28b8cfd
2023-02-25 13:43:28 -05:00
Felix Buehler
cdb39a86e0 treewide: use optionalString 2023-02-13 21:52:34 +01:00
Thiago Kenji Okada
4b74c3c3d1 pypy39: fix pypy3 symlink 2023-01-08 19:34:59 +00:00
Thiago Kenji Okada
c04fc21156 pythonInterpreters.pypy39_prebuilt: remove global with lib 2023-01-08 19:34:59 +00:00
Thiago Kenji Okada
eddcc1c01c pythonInterpreters.pypy27_prebuilt: remove global with lib 2023-01-08 19:34:59 +00:00
Thiago Kenji Okada
a7ffcced44 pypy{27,38,39}: remove global with lib 2023-01-08 19:34:59 +00:00
Thiago Kenji Okada
92f0173213 pypy{27,38,39}: refactor derivation
- Remove code related to i686 archs (not supported anymore since #209100)
- Split non-install steps in installPhase in installCheckPhase/preFixup
- Add missing pre/post hooks
2023-01-08 19:34:59 +00:00
Weijia Wang
9d10b68a85 pypy27: unbreak on aarch64-darwin 2023-01-08 19:00:31 +01:00
Thiago Kenji Okada
2a19c135fc Merge pull request #209597 from wegank/pypy27-darwin
pythonInterpreters.pypy27_prebuilt: fix install check on darwin
2023-01-08 11:05:31 +00:00
Weijia Wang
fd6ddd9923 pythonInterpreters.pypy39_prebuilt: add darwin support 2023-01-08 02:04:15 +01:00
Weijia Wang
e380607d07 pythonInterpreters.pypy27_prebuilt: fix install check on darwin 2023-01-08 02:02:45 +01:00
Thiago Kenji Okada
aa0c474f4b pypy{27,38,39}: mark as broken in aarch64-darwin 2023-01-07 21:14:22 +00:00
Thiago Kenji Okada
997a09e612 pypy39: fix build in darwin 2023-01-07 21:11:49 +00:00
Thiago Kenji Okada
4645ec9de6 pypy{27,38,39}: remove i686-linux, add aarch64-darwin 2023-01-07 21:11:49 +00:00
Thiago Kenji Okada
40db51d563 pythonInterpreters.pypy27_prebuilt: add support to darwin 2023-01-07 21:11:49 +00:00
Thiago Kenji Okada
3d440c1c1e pythonInterpreters.pypy39_prebuilt: use autoPatchelfHook 2023-01-07 21:11:49 +00:00
Thiago Kenji Okada
c89380b0c4 pythonInterpreters.pypy27_prebuilt: use autoPatchelfHook 2023-01-07 21:11:48 +00:00
Thiago Kenji Okada
a49d01ce3f pythonInterpreters.pypy27_prebuilt: add support for aarch64-linux 2023-01-07 21:11:48 +00:00
Thiago Kenji Okada
284d9a1067 pypy27: 7.3.9 -> 7.3.11
Also build it with pythonInterpreters.pypy27_prebuilt instead of
python27, to avoid it being broken after #201859 is merged.

Keep in mind that the above change will make this derivation only work
with x86_64-linux for now (since pypy27_prebuilt is only packaged for
that platform). However support for newer platforms can be added later,
and a working package for one platform is better than a broken package
in 4 platforms.
2023-01-07 21:11:48 +00:00
Sergei Trofimovich
d968c6eded pypy2, pypy3: drop unused xlibsWrapper 2022-12-02 18:18:05 +00:00