Skip to content

Commit

Permalink
Merge branch staging-next into haskell-updates
Browse files Browse the repository at this point in the history
  • Loading branch information
sternenseemann committed Dec 9, 2024
2 parents 44eac54 + 0de86d8 commit 06886d3
Show file tree
Hide file tree
Showing 738 changed files with 12,117 additions and 20,832 deletions.
60 changes: 29 additions & 31 deletions doc/languages-frameworks/python.section.md
Original file line number Diff line number Diff line change
Expand Up @@ -551,9 +551,9 @@ are used in [`buildPythonPackage`](#buildpythonpackage-function).

Several versions of the Python interpreter are available on Nix, as well as a
high amount of packages. The attribute `python3` refers to the default
interpreter, which is currently CPython 3.11. The attribute `python` refers to
interpreter, which is currently CPython 3.12. The attribute `python` refers to
CPython 2.7 for backwards-compatibility. It is also possible to refer to
specific versions, e.g. `python311` refers to CPython 3.11, and `pypy` refers to
specific versions, e.g. `python312` refers to CPython 3.12, and `pypy` refers to
the default PyPy interpreter.

Python is used a lot, and in different ways. This affects also how it is
Expand All @@ -569,10 +569,10 @@ however, are in separate sets, with one set per interpreter version.
The interpreters have several common attributes. One of these attributes is
`pkgs`, which is a package set of Python libraries for this specific
interpreter. E.g., the `toolz` package corresponding to the default interpreter
is `python3.pkgs.toolz`, and the CPython 3.11 version is `python311.pkgs.toolz`.
is `python3.pkgs.toolz`, and the CPython 3.12 version is `python312.pkgs.toolz`.
The main package set contains aliases to these package sets, e.g.
`pythonPackages` refers to `python.pkgs` and `python311Packages` to
`python311.pkgs`.
`pythonPackages` refers to `python.pkgs` and `python312Packages` to
`python312.pkgs`.

#### Installing Python and packages {#installing-python-and-packages}

Expand All @@ -597,7 +597,7 @@ with [`python.buildEnv`](#python.buildenv-function) or [`python.withPackages`](#
executables are wrapped to be able to find each other and all of the modules.

In the following examples we will start by creating a simple, ad-hoc environment
with a nix-shell that has `numpy` and `toolz` in Python 3.11; then we will create
with a nix-shell that has `numpy` and `toolz` in Python 3.12; then we will create
a re-usable environment in a single-file Python script; then we will create a
full Python environment for development with this same environment.

Expand All @@ -613,18 +613,18 @@ temporary shell session with a Python and a *precise* list of packages (plus
their runtime dependencies), with no other Python packages in the Python
interpreter's scope.

To create a Python 3.11 session with `numpy` and `toolz` available, run:
To create a Python 3.12 session with `numpy` and `toolz` available, run:

```sh
$ nix-shell -p 'python311.withPackages(ps: with ps; [ numpy toolz ])'
$ nix-shell -p 'python312.withPackages(ps: with ps; [ numpy toolz ])'
```

By default `nix-shell` will start a `bash` session with this interpreter in our
`PATH`, so if we then run:

```Python console
[nix-shell:~/src/nixpkgs]$ python3
Python 3.11.3 (main, Apr 4 2023, 22:36:41) [GCC 12.2.0] on linux
Python 3.12.4 (main, Jun 6 2024, 18:26:44) [GCC 13.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy; import toolz
```
Expand All @@ -644,12 +644,8 @@ will still get 1 wrapped Python interpreter. We can start the interpreter
directly like so:

```sh
$ nix-shell -p "python311.withPackages (ps: with ps; [ numpy toolz requests ])" --run python3
this derivation will be built:
/nix/store/r19yf5qgfiakqlhkgjahbg3zg79549n4-python3-3.11.2-env.drv
building '/nix/store/r19yf5qgfiakqlhkgjahbg3zg79549n4-python3-3.11.2-env.drv'...
created 273 symlinks in user environment
Python 3.11.2 (main, Feb 7 2023, 13:52:42) [GCC 12.2.0] on linux
$ nix-shell -p "python312.withPackages (ps: with ps; [ numpy toolz requests ])" --run python3
Python 3.12.4 (main, Jun 6 2024, 18:26:44) [GCC 13.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import requests
>>>
Expand Down Expand Up @@ -689,7 +685,7 @@ Executing this script requires a `python3` that has `numpy`. Using what we learn
in the previous section, we could startup a shell and just run it like so:

```ShellSession
$ nix-shell -p 'python311.withPackages (ps: with ps; [ numpy ])' --run 'python3 foo.py'
$ nix-shell -p 'python312.withPackages (ps: with ps; [ numpy ])' --run 'python3 foo.py'
The dot product of [1 2] and [3 4] is: 11
```

Expand Down Expand Up @@ -752,12 +748,12 @@ create a single script with Python dependencies, but in the course of normal
development we're usually working in an entire package repository.

As explained [in the `nix-shell` section](https://nixos.org/manual/nix/stable/command-ref/nix-shell) of the Nix manual, `nix-shell` can also load an expression from a `.nix` file.
Say we want to have Python 3.11, `numpy` and `toolz`, like before,
Say we want to have Python 3.12, `numpy` and `toolz`, like before,
in an environment. We can add a `shell.nix` file describing our dependencies:

```nix
with import <nixpkgs> {};
(python311.withPackages (ps: with ps; [
(python312.withPackages (ps: with ps; [
numpy
toolz
])).env
Expand All @@ -774,7 +770,7 @@ What's happening here?
imports the `<nixpkgs>` function, `{}` calls it and the `with` statement
brings all attributes of `nixpkgs` in the local scope. These attributes form
the main package set.
2. Then we create a Python 3.11 environment with the [`withPackages`](#python.withpackages-function) function, as before.
2. Then we create a Python 3.12 environment with the [`withPackages`](#python.withpackages-function) function, as before.
3. The [`withPackages`](#python.withpackages-function) function expects us to provide a function as an argument
that takes the set of all Python packages and returns a list of packages to
include in the environment. Here, we select the packages `numpy` and `toolz`
Expand All @@ -785,7 +781,7 @@ To combine this with `mkShell` you can:
```nix
with import <nixpkgs> {};
let
pythonEnv = python311.withPackages (ps: [
pythonEnv = python312.withPackages (ps: [
ps.numpy
ps.toolz
]);
Expand Down Expand Up @@ -939,8 +935,8 @@ information. The output of the function is a derivation.

An expression for `toolz` can be found in the Nixpkgs repository. As explained
in the introduction of this Python section, a derivation of `toolz` is available
for each interpreter version, e.g. `python311.pkgs.toolz` refers to the `toolz`
derivation corresponding to the CPython 3.11 interpreter.
for each interpreter version, e.g. `python312.pkgs.toolz` refers to the `toolz`
derivation corresponding to the CPython 3.12 interpreter.

The above example works when you're directly working on
`pkgs/top-level/python-packages.nix` in the Nixpkgs repository. Often though,
Expand All @@ -953,7 +949,7 @@ and adds it along with a `numpy` package to a Python environment.
with import <nixpkgs> {};
( let
my_toolz = python311.pkgs.buildPythonPackage rec {
my_toolz = python312.pkgs.buildPythonPackage rec {
pname = "toolz";
version = "0.10.0";
pyproject = true;
Expand All @@ -964,7 +960,7 @@ with import <nixpkgs> {};
};
build-system = [
python311.pkgs.setuptools
python312.pkgs.setuptools
];
# has no tests
Expand All @@ -977,15 +973,15 @@ with import <nixpkgs> {};
};
};
in python311.withPackages (ps: with ps; [
in python312.withPackages (ps: with ps; [
numpy
my_toolz
])
).env
```

Executing `nix-shell` will result in an environment in which you can use
Python 3.11 and the `toolz` package. As you can see we had to explicitly mention
Python 3.12 and the `toolz` package. As you can see we had to explicitly mention
for which Python version we want to build a package.

So, what did we do here? Well, we took the Nix expression that we used earlier
Expand Down Expand Up @@ -1991,7 +1987,7 @@ has security implications and is relevant for those using Python in a

When the environment variable `DETERMINISTIC_BUILD` is set, all bytecode will
have timestamp 1. The [`buildPythonPackage`](#buildpythonpackage-function) function sets `DETERMINISTIC_BUILD=1`
and [PYTHONHASHSEED=0](https://docs.python.org/3.11/using/cmdline.html#envvar-PYTHONHASHSEED).
and [PYTHONHASHSEED=0](https://docs.python.org/3.12/using/cmdline.html#envvar-PYTHONHASHSEED).
Both are also exported in `nix-shell`.

### How to provide automatic tests to Python packages? {#automatic-tests}
Expand Down Expand Up @@ -2062,10 +2058,12 @@ The following rules are desired to be respected:
* `meta.platforms` takes the default value in many cases.
It does not need to be set explicitly unless the package requires a specific platform.
* The file is formatted with `nixfmt-rfc-style`.
* Commit names of Python libraries should reflect that they are Python
libraries, so write for example `python311Packages.numpy: 1.11 -> 1.12`.
It is highly recommended to specify the current default version to enable
automatic build by ofborg.
* Commit names of Python libraries must reflect that they are Python
libraries (e.g. `python312Packages.numpy: 1.11 -> 1.12` rather than `numpy: 1.11 -> 1.12`).
* The current default version of python should be included
in commit messages to enable automatic builds by ofborg.
For example `python312Packages.numpy: 1.11 -> 1.12` should be used rather
than `python3Packages.numpy: 1.11 -> 1.12`.
Note that `pythonPackages` is an alias for `python27Packages`.
* Attribute names in `python-packages.nix` as well as `pname`s should match the
library's name on PyPI, but be normalized according to [PEP
Expand Down
2 changes: 1 addition & 1 deletion lib/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ let
# these are the only ones that are currently not
inherit (builtins) addErrorContext isPath trace typeOf unsafeGetAttrPos;
inherit (self.trivial) id const pipe concat or and xor bitAnd bitOr bitXor
bitNot boolToString mergeAttrs flip mapNullable inNixShell isFloat min max
bitNot boolToString mergeAttrs flip defaultTo mapNullable inNixShell isFloat min max
importJSON importTOML warn warnIf warnIfNot throwIf throwIfNot checkListOfEnum
info showWarnings nixpkgsVersion version isInOldestRelease oldestSupportedReleaseIsAtLeast
mod compare splitByAndCompare seq deepSeq lessThan add sub
Expand Down
34 changes: 34 additions & 0 deletions lib/trivial.nix
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,40 @@ in {
*/
flip = f: a: b: f b a;

/**
Return `maybeValue` if not null, otherwise return `default`.
# Inputs
`default`
: 1\. Function argument
`maybeValue`
: 2\. Function argument
# Examples
:::{.example}
## `lib.trivial.defaultTo` usage example
```nix
defaultTo "default" null
=> "default"
defaultTo "default" "foo"
=> "foo"
defaultTo "default" false
=> false
```
:::
*/
defaultTo = default: maybeValue:
if maybeValue != null then maybeValue
else default;

/**
Apply function if the supplied argument is non-null.
Expand Down
32 changes: 30 additions & 2 deletions maintainers/maintainer-list.nix
Original file line number Diff line number Diff line change
Expand Up @@ -15452,6 +15452,12 @@
githubId = 93013864;
name = "nat-418";
};
nateeag = {
github = "NateEag";
githubId = 837719;
name = "Nate Eagleson";
email = "[email protected]";
};
nathan-gs = {
email = "[email protected]";
github = "nathan-gs";
Expand Down Expand Up @@ -15712,6 +15718,12 @@
githubId = 7845120;
name = "Alex Martens";
};
nezia = {
email = "[email protected]";
github = "nezia1";
githubId = 43719748;
name = "Anthony Rodriguez";
};
ngerstle = {
name = "Nicholas Gerstle";
email = "[email protected]";
Expand Down Expand Up @@ -17904,7 +17916,10 @@
github = "JarvisCraft";
githubId = 7693005;
name = "Petr Portnov";
keys = [ { fingerprint = "884B 08D2 8DFF 6209 1857 C1C7 7E8F C8F7 D1BB 84A3"; } ];
keys = [
{ fingerprint = "884B 08D2 8DFF 6209 1857 C1C7 7E8F C8F7 D1BB 84A3"; }
{ fingerprint = "AA96 35AA F392 52BF 0E60 825E 1192 2217 F828 8484"; }
];
};
progval = {
email = "[email protected]";
Expand Down Expand Up @@ -18104,6 +18119,13 @@
githubId = 4579165;
name = "Danny Bautista";
};
pyrotelekinetic = {
name = "Clover";
email = "[email protected]";
github = "pyrotelekinetic";
githubId = 29682759;
keys = [ { fingerprint = "5963 78DB 25AA 608D 2743 D466 5D6A D9AE 71B3 F983"; } ];
};
pyrox0 = {
name = "Pyrox";
email = "[email protected]";
Expand Down Expand Up @@ -22795,7 +22817,7 @@
githubId = 332418;
};
tsandrini = {
email = "[email protected]";
email = "[email protected]";
name = "Tomáš Sandrini";
github = "tsandrini";
githubId = 21975189;
Expand Down Expand Up @@ -24288,6 +24310,12 @@
githubId = 145775305;
name = "Sergei Zimmerman";
};
xosnrdev = {
email = "[email protected]";
github = "xosnrdev";
githubId = 106241330;
name = "Success Kingsley";
};
xrelkd = {
github = "xrelkd";
githubId = 46590321;
Expand Down
2 changes: 1 addition & 1 deletion nixos/doc/manual/configuration/user-mgmt.chapter.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ The primary benefit of this is to remove a dependency on perl.
This is experimental.
:::

Like systemd-sysusers, Userborn adoesn't depend on Perl but offers some more
Like systemd-sysusers, Userborn doesn't depend on Perl but offers some more
advantages over systemd-sysusers:

1. It can create "normal" users (with a GID >= 1000).
Expand Down
16 changes: 16 additions & 0 deletions nixos/doc/manual/release-notes/rl-2505.section.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@

<!-- To avoid merge conflicts, consider adding your item at an arbitrary place in the list instead. -->

- [Bazecor](https://github.com/Dygmalab/Bazecor), the graphical configurator for Dygma Products.

- [Kimai](https://www.kimai.org/), a web-based multi-user time-tracking application. Available as [services.kimai](options.html#opt-services.kimai).

- [Omnom](https://github.com/asciimoo/omnom), a webpage bookmarking and snapshotting service. Available as [services.omnom](options.html#opt-services.omnom.enable).
Expand All @@ -37,6 +39,8 @@

- [Buffyboard](https://gitlab.postmarketos.org/postmarketOS/buffybox/-/tree/master/buffyboard), a framebuffer on-screen keyboard. Available as [services.buffyboard](option.html#opt-services.buffyboard).

- [KanBoard](https://github.com/kanboard/kanboard), a project management tool that focuses on the Kanban methodology. Available as [services.kanboard](#opt-services.kanboard.enable).

<!-- To avoid merge conflicts, consider adding your item at an arbitrary place in the list instead. -->

## Backward Incompatibilities {#sec-release-25.05-incompatibilities}
Expand All @@ -59,6 +63,8 @@

- `zammad` has had its support for MySQL removed, since it was never working correctly and is now deprecated upstream. Check the [migration guide](https://docs.zammad.org/en/latest/appendix/migrate-to-postgresql.html) for how to convert your database to PostgreSQL.

- `nodePackages.create-react-native-app` has been removed, as it is deprecated. Upstream suggests using a framework for React Native apps instead.

- `nodePackages.insect` has been removed, as it's deprecated by upstream. The suggested replacement is `numbat`.

- `nodePackages.webpack-dev-server` has been removed, as it should be installed in projects that use it instead.
Expand All @@ -75,6 +81,9 @@
See the release notes of
[v1.7.0](https://github.com/jtroo/kanata/releases/tag/v1.7.0)
for more information.

- `nodePackages.expo-cli` has been removed, as it was deprecated by upstream. The suggested replacement is the `npx expo` command.

- `vscode-utils.buildVscodeExtension` now requires pname as an argument

- `nerdfonts` has been separated into individual font packages under the namespace `nerd-fonts`. The directories for font
Expand All @@ -100,6 +109,11 @@
add `vimPlugins.notmuch-vim` to your (Neo)vim configuration if you want the
vim plugin.

- `prisma` and `prisma-engines` have been updated to version 6.0.1, which
introduces several breaking changes. See the
[Prisma ORM upgrade guide](https://www.prisma.io/docs/orm/more/upgrade-guides/upgrading-versions/upgrading-to-prisma-6)
for more information.

<!-- To avoid merge conflicts, consider adding your item at an arbitrary place in the list instead. -->

## Other Notable Changes {#sec-release-25.05-notable-changes}
Expand All @@ -108,6 +122,8 @@

- Cinnamon has been updated to 6.4.

- `networking.wireguard` now has an optional networkd backend. It is enabled by default when `networking.useNetworkd` is enabled, and it can be enabled alongside scripted networking with `networking.wireguard.useNetworkd`. Some `networking.wireguard` options have slightly different behavior with the networkd and script-based backends, documented in each option. Before upgrading, make sure the `privateKeyFile` and `presharedKeyFile` paths are readable by the `systemd-network` user if using the networkd backend.

- `services.avahi.ipv6` now defaults to true.

- `bind.cacheNetworks` now only controls access for recursive queries, where it previously controlled access for all queries.
Expand Down
2 changes: 1 addition & 1 deletion nixos/lib/make-squashfs.nix
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ stdenv.mkDerivation {
# Generate the squashfs image.
mksquashfs nix-path-registration $(cat $closureInfo/store-paths) $imgPath ${pseudoFilesArgs} \
-no-hardlinks ${lib.optionalString noStrip "-no-strip"} -keep-as-directory -all-root -b 1048576 ${compFlag} \
-processors $NIX_BUILD_CORES
-processors $NIX_BUILD_CORES -root-mode 0755
'' + lib.optionalString hydraBuildProduct ''
mkdir -p $out/nix-support
Expand Down
Loading

0 comments on commit 06886d3

Please sign in to comment.