Skip to content

Commit

Permalink
Merge #303527: staging-next 2024-04-12
Browse files Browse the repository at this point in the history
  • Loading branch information
vcunat committed Apr 19, 2024
2 parents 6875763 + 11b87cb commit 739cfd4
Show file tree
Hide file tree
Showing 434 changed files with 3,936 additions and 4,223 deletions.
76 changes: 1 addition & 75 deletions doc/languages-frameworks/python.section.md
Original file line number Diff line number Diff line change
Expand Up @@ -497,40 +497,6 @@ are used in [`buildPythonPackage`](#buildpythonpackage-function).
with the `pipInstallHook`.
- `unittestCheckHook` will run tests with `python -m unittest discover`. See [example usage](#using-unittestcheckhook).

### Development mode {#development-mode}

Development or editable mode is supported. To develop Python packages
[`buildPythonPackage`](#buildpythonpackage-function) has additional logic inside `shellPhase` to run `pip
install -e . --prefix $TMPDIR/`for the package.

Warning: `shellPhase` is executed only if `setup.py` exists.

Given a `default.nix`:

```nix
with import <nixpkgs> {};
python3Packages.buildPythonPackage {
name = "myproject";
buildInputs = with python3Packages; [ pyramid ];
src = ./.;
}
```

Running `nix-shell` with no arguments should give you the environment in which
the package would be built with `nix-build`.

Shortcut to setup environments with C headers/libraries and Python packages:

```shell
nix-shell -p python3Packages.pyramid zlib libjpeg git
```

::: {.note}
There is a boolean value `lib.inNixShell` set to `true` if nix-shell is invoked.
:::

## User Guide {#user-guide}

### Using Python {#using-python}
Expand Down Expand Up @@ -867,8 +833,7 @@ Above, we were mostly just focused on use cases and what to do to get started
creating working Python environments in nix.

Now that you know the basics to be up and running, it is time to take a step
back and take a deeper look at how Python packages are packaged on Nix. Then,
we will look at how you can use development mode with your code.
back and take a deeper look at how Python packages are packaged on Nix.

#### Python library packages in Nixpkgs {#python-library-packages-in-nixpkgs}

Expand Down Expand Up @@ -1481,45 +1446,6 @@ documentation source root.
The hook is also available to packages outside the python ecosystem by
referencing it using `sphinxHook` from top-level.

### Develop local package {#develop-local-package}

As a Python developer you're likely aware of [development mode](http://setuptools.readthedocs.io/en/latest/setuptools.html#development-mode)
(`python setup.py develop`); instead of installing the package this command
creates a special link to the project code. That way, you can run updated code
without having to reinstall after each and every change you make. Development
mode is also available. Let's see how you can use it.

In the previous Nix expression the source was fetched from a url. We can also
refer to a local source instead using `src = ./path/to/source/tree;`

If we create a `shell.nix` file which calls [`buildPythonPackage`](#buildpythonpackage-function), and if `src`
is a local source, and if the local source has a `setup.py`, then development
mode is activated.

In the following example, we create a simple environment that has a Python 3.11
version of our package in it, as well as its dependencies and other packages we
like to have in the environment, all specified with `dependencies`.

```nix
with import <nixpkgs> {};
with python311Packages;
buildPythonPackage rec {
name = "mypackage";
src = ./path/to/package/source;
dependencies = [
pytest
numpy
];
propagatedBuildInputs = [
pkgs.libsndfile
];
}
```

It is important to note that due to how development mode is implemented on Nix
it is not possible to have multiple packages simultaneously in development mode.

### Organising your packages {#organising-your-packages}

So far we discussed how you can use Python on Nix, and how you can develop with
Expand Down
2 changes: 1 addition & 1 deletion lib/fileset/default.nix
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
<!-- This anchor is here for backwards compatibity -->
<!-- This anchor is here for backwards compatibility -->
[]{#sec-fileset}
The [`lib.fileset`](#sec-functions-library-fileset) library allows you to work with _file sets_.
Expand Down
7 changes: 7 additions & 0 deletions maintainers/maintainer-list.nix
Original file line number Diff line number Diff line change
Expand Up @@ -16931,6 +16931,13 @@
githubId = 12279531;
name = "Ricardo Guevara";
};
rhelmot = {
name = "Audrey Dutcher";
github = "rhelmot";
githubId = 2498805;
email = "[email protected]";
matrix = "@rhelmot:matrix.org";
};
rhendric = {
name = "Ryan Hendrickson";
github = "rhendric";
Expand Down
4 changes: 2 additions & 2 deletions pkgs/applications/audio/fluidsynth/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@

stdenv.mkDerivation rec {
pname = "fluidsynth";
version = "2.3.4";
version = "2.3.5";

src = fetchFromGitHub {
owner = "FluidSynth";
repo = "fluidsynth";
rev = "v${version}";
hash = "sha256-3qLmo9Ibl44v6Jj5Ix17ixwqfPt3ITTXUqBETF5pzE4=";
hash = "sha256-CzKfvQzhF4Mz2WZaJM/Nt6XjF6ThlX4jyQSaXfZukG8=";
};

outputs = [ "out" "dev" "man" ];
Expand Down
8 changes: 7 additions & 1 deletion pkgs/applications/audio/miniplayer/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@ buildPythonApplication rec {
hash = "sha256-iUUsVIDLQAiaMomfA2LvvJZ2ePhgADtC6GCwIpRC1MA=";
};

propagatedBuildInputs = [
build-system = [
setuptools
];

dependencies = [
colorthief
ffmpeg-python
mpd2
Expand All @@ -25,6 +29,8 @@ buildPythonApplication rec {
ueberzug
];

doCheck = false; # no tests

# pythonImportsCheck is disabled because this package doesn't expose any modules.

meta = with lib; {
Expand Down
19 changes: 17 additions & 2 deletions pkgs/applications/audio/mpg123/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,18 @@
, jack
, withConplay ? !stdenv.hostPlatform.isWindows
, perl
, writeScript
}:

assert withConplay -> !libOnly;

stdenv.mkDerivation rec {
pname = "${lib.optionalString libOnly "lib"}mpg123";
version = "1.32.5";
version = "1.32.6";

src = fetchurl {
url = "mirror://sourceforge/mpg123/mpg123-${version}.tar.bz2";
hash = "sha256-r5CM32zbZUS5e8cGp5n3mJTmlGivWIG/RUoOu5Fx7WM=";
hash = "sha256-zN0dCrwx1z2LQ1/GWMeQSdCpBbMGabakKgOtFp3GCeY=";
};

outputs = [ "out" "dev" "man" ] ++ lib.optional withConplay "conplay";
Expand Down Expand Up @@ -69,6 +70,20 @@ stdenv.mkDerivation rec {
--prefix PATH : $out/bin
'';

passthru = {
updateScript = writeScript "update-mpg123" ''
#!/usr/bin/env nix-shell
#!nix-shell -i bash -p curl pcre common-updater-scripts
set -eu -o pipefail
# Expect the text in format of '<a href="download/mpg123-1.32.6.tar.bz2">'
new_version="$(curl -s https://mpg123.org/download.shtml |
pcregrep -o1 '<a href="download/mpg123-([0-9.]+).tar.bz2">')"
update-source-version ${pname} "$new_version"
'';
};

meta = with lib; {
description = "Fast console MPEG Audio Player and decoder library";
homepage = "https://mpg123.org";
Expand Down
8 changes: 6 additions & 2 deletions pkgs/applications/editors/neovim/default.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{ lib, stdenv, fetchFromGitHub, cmake, gettext, msgpack-c, libtermkey, libiconv
{ lib, stdenv, fetchFromGitHub, removeReferencesTo, cmake, gettext, msgpack-c, libtermkey, libiconv
, libuv, lua, ncurses, pkg-config
, unibilium, gperf
, libvterm-neovim
Expand Down Expand Up @@ -121,6 +121,7 @@ in {
cmake
gettext
pkg-config
removeReferencesTo
];

# extra programs test via `make functionaltest`
Expand All @@ -141,8 +142,11 @@ in {
sed -i src/nvim/po/CMakeLists.txt \
-e "s|\$<TARGET_FILE:nvim|\${stdenv.hostPlatform.emulator buildPackages} &|g"
'';
postInstall = ''
find "$out" -type f -exec remove-references-to -t ${stdenv.cc} '{}' +
'';
# check that the above patching actually works
disallowedReferences = [ stdenv.cc ] ++ lib.optional (lua != codegenLua) codegenLua;
disallowedRequisites = [ stdenv.cc ] ++ lib.optional (lua != codegenLua) codegenLua;

cmakeFlags = [
# Don't use downloaded dependencies. At the end of the configurePhase one
Expand Down
4 changes: 2 additions & 2 deletions pkgs/applications/editors/vim/common.nix
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{ lib, fetchFromGitHub }:
rec {
version = "9.1.0148";
version = "9.1.0200";

outputs = [ "out" "xxd" ];

src = fetchFromGitHub {
owner = "vim";
repo = "vim";
rev = "v${version}";
hash = "sha256-lBs9PwNE3GoxtMka9oftYx3gegjCv6D3sEyAWK6RZzM=";
hash = "sha256-MAMd+k4GpFUwEZzQTWtzSpYY6AEez+FMiqexozYK3Y4=";
};

enableParallelBuilding = true;
Expand Down
2 changes: 1 addition & 1 deletion pkgs/applications/editors/vim/plugins/vim-gen-doc-hook.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ vimPluginGenTags() {
echo "$addonInfo" > $target/addon-info.json
fi

echo "Finished executing vimPluginInstallPhase"
echo "Finished executing vimPluginGenTags"
}

preFixupHooks+=(vimPluginGenTags)
Expand Down
5 changes: 4 additions & 1 deletion pkgs/applications/misc/electron-cash/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ python3Packages.buildPythonApplication rec {
sha256 = "sha256-xOyj5XerOwgfvI0qj7+7oshDvd18h5IeZvcJTis8nWo=";
};

build-system = with python3Packages; [
cython
];

propagatedBuildInputs = with python3Packages; [
# requirements
pyaes
Expand All @@ -36,7 +40,6 @@ python3Packages.buildPythonApplication rec {
cryptography

# requirements-hw
cython
trezor
keepkey
btchip-python
Expand Down
3 changes: 2 additions & 1 deletion pkgs/applications/misc/opencpn/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -108,12 +108,13 @@ stdenv.mkDerivation (finalAttrs: {
wxGTK32
] ++ lib.optionals stdenv.isLinux [
alsa-utils
elfutils
libselinux
libsepol
util-linux
xorg.libXdmcp
xorg.libXtst
] ++ lib.optionals (lib.meta.availableOn stdenv.hostPlatform elfutils) [
elfutils
] ++ lib.optionals stdenv.isDarwin [
lame
];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ stdenv.mkDerivation rec {
--prefix PATH : ${lib.makeBinPath [ coreutils glib.dev pciutils procps util-linux ]} \
--prefix LD_LIBRARY_PATH ":" ${libs}
# Backwards compatiblity: we used to call it zoom-us
# Backwards compatibility: we used to call it zoom-us
ln -s $out/bin/{zoom,zoom-us}
'';

Expand Down
4 changes: 4 additions & 0 deletions pkgs/applications/networking/sync/rsync/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ stdenv.mkDerivation rec {
] ++ lib.optionals (stdenv.hostPlatform.isMusl && stdenv.hostPlatform.isx86_64) [
# fix `multiversioning needs 'ifunc' which is not supported on this target` error
"--disable-roll-simd"
] ++ lib.optionals (!enableZstd) [
"--disable-zstd"
] ++ lib.optionals (!enableXXHash) [
"--disable-xxhash"
];

enableParallelBuilding = true;
Expand Down
2 changes: 1 addition & 1 deletion pkgs/applications/science/biology/macs2/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ python3.pkgs.buildPythonPackage rec {
];

nativeBuildInputs = with python3.pkgs; [
cython
cython_0
numpy
setuptools
wheel
Expand Down
2 changes: 1 addition & 1 deletion pkgs/applications/science/electronics/nvc/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ stdenv.mkDerivation rec {
llvm
zlib
zstd
] ++ lib.optionals stdenv.isLinux [
] ++ lib.optionals (lib.meta.availableOn stdenv.hostPlatform elfutils) [
elfutils
];

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{ lib
, buildPythonPackage
, sage-src
, cython_3
, cython
, jinja2
, pkgconfig # the python module, not the pkg-config alias
}:
Expand All @@ -11,7 +11,7 @@ buildPythonPackage rec {
pname = "sage-setup";
src = sage-src;

nativeBuildInputs = [ cython_3 ];
nativeBuildInputs = [ cython ];
buildInputs = [ pkgconfig ];
propagatedBuildInputs = [ jinja2 ];

Expand Down
4 changes: 2 additions & 2 deletions pkgs/applications/science/math/sage/sagelib.nix
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
, cvxopt
, cypari2
, cysignals
, cython_3
, cython
, fpylll
, gmpy2
, importlib-metadata
Expand Down Expand Up @@ -153,7 +153,7 @@ buildPythonPackage rec {
cvxopt
cypari2
cysignals
cython_3
cython
fpylll
gmpy2
importlib-metadata
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ python3.pkgs.buildPythonApplication rec {
pytest-freezer
pytest-mock
pytest-regressions
(pytestCheckHook.override { pytest = pytest_7; })
pytest7CheckHook
];

doCheck = true;
Expand Down
2 changes: 1 addition & 1 deletion pkgs/applications/version-management/git-up/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ pythonPackages.buildPythonApplication rec {

nativeCheckInputs = [
git
pythonPackages.pytestCheckHook
pythonPackages.pytest7CheckHook
];

# 1. git fails to run as it cannot detect the email address, so we set it
Expand Down
2 changes: 1 addition & 1 deletion pkgs/applications/virtualization/virt-manager/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ python3.pkgs.buildPythonApplication rec {
'';

nativeCheckInputs = with python3.pkgs; [
pytestCheckHook
pytest7CheckHook
cpio
cdrtools
xorriso
Expand Down
4 changes: 2 additions & 2 deletions pkgs/by-name/cm/cmake/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,11 @@ stdenv.mkDerivation (finalAttrs: {
+ lib.optionalString isMinimalBuild "-minimal"
+ lib.optionalString cursesUI "-cursesUI"
+ lib.optionalString qt5UI "-qt5UI";
version = "3.28.3";
version = "3.29.1";

src = fetchurl {
url = "https://cmake.org/files/v${lib.versions.majorMinor finalAttrs.version}/cmake-${finalAttrs.version}.tar.gz";
hash = "sha256-crdXDlyFk95qxKtDO3PqsYxfsyiIBGDIbOMmCBQa1cE=";
hash = "sha256-f7Auj1e2Kzmqa0z3HoIBSLoaI3JIiElHNQIeMqsO78w=";
};

patches = [
Expand Down
Loading

0 comments on commit 739cfd4

Please sign in to comment.