Skip to content

Commit

Permalink
Merge 7b98f60 into 28c94a9
Browse files Browse the repository at this point in the history
  • Loading branch information
pull[bot] committed Jan 22, 2023
2 parents 28c94a9 + 7b98f60 commit d36727d
Show file tree
Hide file tree
Showing 6,500 changed files with 65,357 additions and 75,354 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
2 changes: 1 addition & 1 deletion .github/workflows/editorconfig.yml
Expand Up @@ -11,7 +11,7 @@ on:
jobs:
tests:
runs-on: ubuntu-latest
if: "github.repository_owner == 'NixOS' && !contains(github.event.pull_request.title, '[skip editorconfig]')"
if: "github.repository_owner == 'NixOS' && !contains(github.event.pull_request.title, '[skip treewide]')"
steps:
- name: Get list of changed files from PR
env:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/labels.yml
Expand Up @@ -16,7 +16,7 @@ permissions:
jobs:
labels:
runs-on: ubuntu-latest
if: github.repository_owner == 'NixOS'
if: "github.repository_owner == 'NixOS' && !contains(github.event.pull_request.title, '[skip treewide]')"
steps:
- uses: actions/labeler@v4
with:
Expand Down
13 changes: 10 additions & 3 deletions doc/build-aux/pandoc-filters/myst-reader/roles.lua
Expand Up @@ -17,9 +17,16 @@ function Inlines(inlines)
if correct_tags then
-- docutils supports alphanumeric strings separated by [-._:]
-- We are slightly more liberal for simplicity.
local role = first.text:match('^{([-._+:%w]+)}$')
if role ~= nil then
inlines:remove(i)
-- Allow preceding punctuation (eg '('), otherwise '({file}`...`)'
-- does not match. Also allow anything followed by a non-breaking space
-- since pandoc emits those after certain abbreviations (e.g. e.g.).
local prefix, role = first.text:match('^(.*){([-._+:%w]+)}$')
if role ~= nil and (prefix == '' or prefix:match("^.*[%p ]$") ~= nil) then
if prefix == '' then
inlines:remove(i)
else
first.text = prefix
end
second.attributes['role'] = role
second.classes:insert('interpreted-text')
end
Expand Down
2 changes: 1 addition & 1 deletion doc/hooks/postgresql-test-hook.section.md
Expand Up @@ -9,7 +9,7 @@ stdenv.mkDerivation {
# ...
checkInputs = [
nativeCheckInputs = [
postgresql
postgresqlTestHook
];
Expand Down
1,082 changes: 1,077 additions & 5 deletions doc/languages-frameworks/haskell.section.md

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions doc/languages-frameworks/javascript.section.md
Expand Up @@ -175,10 +175,11 @@ buildNpmPackage rec {
hash = "sha256-BR+ZGkBBfd0dSQqAvujsbgsEPFYw/ThrylxUbOksYxM=";
};
patches = [ ./remove-prepack-script.patch ];
npmDepsHash = "sha256-tuEfyePwlOy2/mOPdXbqJskO6IowvAP4DWg8xSZwbJw=";
# The prepack script runs the build script, which we'd rather do in the build phase.
npmPackFlags = [ "--ignore-scripts" ];
NODE_OPTIONS = "--openssl-legacy-provider";
meta = with lib; {
Expand Down
24 changes: 12 additions & 12 deletions doc/languages-frameworks/python.section.md
Expand Up @@ -436,7 +436,7 @@ arguments `buildInputs` and `propagatedBuildInputs` to specify dependencies. If
something is exclusively a build-time dependency, then the dependency should be
included in `buildInputs`, but if it is (also) a runtime dependency, then it
should be added to `propagatedBuildInputs`. Test dependencies are considered
build-time dependencies and passed to `checkInputs`.
build-time dependencies and passed to `nativeCheckInputs`.

The following example shows which arguments are given to `buildPythonPackage` in
order to build [`datashape`](https://github.com/blaze/datashape).
Expand All @@ -453,7 +453,7 @@ buildPythonPackage rec {
hash = "sha256-FLLvdm1MllKrgTGC6Gb0k0deZeVYvtCCLji/B7uhong=";
};
checkInputs = [ pytest ];
nativeCheckInputs = [ pytest ];
propagatedBuildInputs = [ numpy multipledispatch python-dateutil ];
meta = with lib; {
Expand All @@ -466,7 +466,7 @@ buildPythonPackage rec {
```

We can see several runtime dependencies, `numpy`, `multipledispatch`, and
`python-dateutil`. Furthermore, we have one `checkInputs`, i.e. `pytest`. `pytest` is a
`python-dateutil`. Furthermore, we have one `nativeCheckInputs`, i.e. `pytest`. `pytest` is a
test runner and is only used during the `checkPhase` and is therefore not added
to `propagatedBuildInputs`.

Expand Down Expand Up @@ -569,7 +569,7 @@ Pytest is the most common test runner for python repositories. A trivial
test run would be:

```
checkInputs = [ pytest ];
nativeCheckInputs = [ pytest ];
checkPhase = ''
runHook preCheck
Expand All @@ -585,7 +585,7 @@ sandbox, and will generally need many tests to be disabled.
To filter tests using pytest, one can do the following:

```
checkInputs = [ pytest ];
nativeCheckInputs = [ pytest ];
# avoid tests which need additional data or touch network
checkPhase = ''
runHook preCheck
Expand Down Expand Up @@ -618,7 +618,7 @@ when a package may need many items disabled to run the test suite.
Using the example above, the analogous `pytestCheckHook` usage would be:

```
checkInputs = [ pytestCheckHook ];
nativeCheckInputs = [ pytestCheckHook ];
# requires additional data
pytestFlagsArray = [ "tests/" "--ignore=tests/integration" ];
Expand Down Expand Up @@ -749,7 +749,7 @@ with the exception of `other` (see `format` in
`unittestCheckHook` is a hook which will substitute the setuptools `test` command for a `checkPhase` which runs `python -m unittest discover`:

```
checkInputs = [ unittestCheckHook ];
nativeCheckInputs = [ unittestCheckHook ];
unittestFlags = [ "-s" "tests" "-v" ];
```
Expand Down Expand Up @@ -1006,7 +1006,7 @@ buildPythonPackage rec {
rm testing/test_argcomplete.py
'';
checkInputs = [ hypothesis ];
nativeCheckInputs = [ hypothesis ];
nativeBuildInputs = [ setuptools-scm ];
propagatedBuildInputs = [ attrs py setuptools six pluggy ];
Expand All @@ -1028,7 +1028,7 @@ The `buildPythonPackage` mainly does four things:
* In the `installCheck` phase, `${python.interpreter} setup.py test` is run.

By default tests are run because `doCheck = true`. Test dependencies, like
e.g. the test runner, should be added to `checkInputs`.
e.g. the test runner, should be added to `nativeCheckInputs`.

By default `meta.platforms` is set to the same value
as the interpreter unless overridden otherwise.
Expand Down Expand Up @@ -1082,7 +1082,7 @@ because their behaviour is different:
* `buildInputs ? []`: Build and/or run-time dependencies that need to be
compiled for the host machine. Typically non-Python libraries which are being
linked.
* `checkInputs ? []`: Dependencies needed for running the `checkPhase`. These
* `nativeCheckInputs ? []`: Dependencies needed for running the `checkPhase`. These
are added to `nativeBuildInputs` when `doCheck = true`. Items listed in
`tests_require` go here.
* `propagatedBuildInputs ? []`: Aside from propagating dependencies,
Expand Down Expand Up @@ -1416,7 +1416,7 @@ example of such a situation is when `py.test` is used.
buildPythonPackage {
# ...
# assumes the tests are located in tests
checkInputs = [ pytest ];
nativeCheckInputs = [ pytest ];
checkPhase = ''
runHook preCheck
Expand Down Expand Up @@ -1768,7 +1768,7 @@ In a `setup.py` or `setup.cfg` it is common to declare dependencies:

* `setup_requires` corresponds to `nativeBuildInputs`
* `install_requires` corresponds to `propagatedBuildInputs`
* `tests_require` corresponds to `checkInputs`
* `tests_require` corresponds to `nativeCheckInputs`

## Contributing {#contributing}

Expand Down
74 changes: 4 additions & 70 deletions doc/languages-frameworks/qt.section.md
Expand Up @@ -2,14 +2,11 @@

Writing Nix expressions for Qt libraries and applications is largely similar as for other C++ software.
This section assumes some knowledge of the latter.
There are two problems that the Nixpkgs Qt infrastructure addresses,
which are not shared by other C++ software:

1. There are usually multiple supported versions of Qt in Nixpkgs.
All of a package's dependencies must be built with the same version of Qt.
This is similar to the version constraints imposed on interpreted languages like Python.
2. Qt makes extensive use of runtime dependency detection.
Runtime dependencies are made into build dependencies through wrappers.
The major caveat with Qt applications is that Qt uses a plugin system to load additional modules at runtime,
from a list of well-known locations. In Nixpkgs, we patch QtCore to instead use an environment variable,
and wrap Qt applications to set it to the right paths. This effectively makes the runtime dependencies
pure and explicit at build-time, at the cost of introducing an extra indirection.

## Nix expression for a Qt package (default.nix) {#qt-default-nix}

Expand Down Expand Up @@ -95,66 +92,3 @@ stdenv.mkDerivation {
This means that scripts won't be automatically wrapped so you'll need to manually wrap them as previously mentioned.
An example of when you'd always need to do this is with Python applications that use PyQt.
:::

## Adding a library to Nixpkgs {#adding-a-library-to-nixpkgs}

Add Qt libraries to `qt5-packages.nix` to make them available for every
supported Qt version.

### Example adding a Qt library {#qt-library-all-packages-nix}

The following represents the contents of `qt5-packages.nix`.

```nix
{
# ...
mylib = callPackage ../path/to/mylib {};
# ...
}
```

Libraries are built with every available version of Qt.
Use the `meta.broken` attribute to disable the package for unsupported Qt versions:

```nix
{ stdenv, lib, qtbase }:
stdenv.mkDerivation {
# ...
# Disable this library with Qt < 5.9.0
meta.broken = lib.versionOlder qtbase.version "5.9.0";
}
```

## Adding an application to Nixpkgs {#adding-an-application-to-nixpkgs}

Add Qt applications to `qt5-packages.nix`. Add an alias to `all-packages.nix`
to select the Qt 5 version used for the application.

### Example adding a Qt application {#qt-application-all-packages-nix}

The following represents the contents of `qt5-packages.nix`.

```nix
{
# ...
myapp = callPackage ../path/to/myapp {};
# ...
}
```

The following represents the contents of `all-packages.nix`.

```nix
{
# ...
myapp = libsForQt5.myapp;
# ...
}
```
5 changes: 4 additions & 1 deletion doc/manpage-urls.json
@@ -1,5 +1,8 @@
{
"nix.conf(5)": "https://nixos.org/manual/nix/stable/#sec-conf-file",
"gnunet.conf(5)": "https://docs.gnunet.org/users/configuration.html",
"mpd(1)": "https://mpd.readthedocs.io/en/latest/mpd.1.html",
"mpd.conf(5)": "https://mpd.readthedocs.io/en/latest/mpd.conf.5.html",
"nix.conf(5)": "https://nixos.org/manual/nix/stable/command-ref/conf-file.html",

"journald.conf(5)": "https://www.freedesktop.org/software/systemd/man/journald.conf.html",
"logind.conf(5)": "https://www.freedesktop.org/software/systemd/man/logind.conf.html",
Expand Down
2 changes: 1 addition & 1 deletion doc/stdenv/cross-compilation.chapter.md
Expand Up @@ -150,7 +150,7 @@ depsBuildBuild = [ buildPackages.stdenv.cc ];
Add the following to your `mkDerivation` invocation.

```nix
doCheck = stdenv.hostPlatform == stdenv.buildPlatform;
doCheck = stdenv.buildPlatform.canExecute stdenv.hostPlatform;
```

#### Package using Meson needs to run binaries for the host platform during build. {#cross-meson-runs-host-code}
Expand Down
38 changes: 36 additions & 2 deletions doc/stdenv/stdenv.chapter.md
Expand Up @@ -654,7 +654,11 @@ A list of strings passed as additional flags to `make`. Like `makeFlags` and `ma

##### `checkInputs` {#var-stdenv-checkInputs}

A list of dependencies used by the phase. This gets included in `nativeBuildInputs` when `doCheck` is set.
A list of host dependencies used by the phase, usually libraries linked into executables built during tests. This gets included in `buildInputs` when `doCheck` is set.

##### `nativeCheckInputs` {#var-stdenv-nativeCheckInputs}

A list of native dependencies used by the phase, notably tools needed on `$PATH`. This gets included in `nativeBuildInputs` when `doCheck` is set.

##### `preCheck` {#var-stdenv-preCheck}

Expand Down Expand Up @@ -821,7 +825,11 @@ A list of strings passed as additional flags to `make`. Like `makeFlags` and `ma

##### `installCheckInputs` {#var-stdenv-installCheckInputs}

A list of dependencies used by the phase. This gets included in `nativeBuildInputs` when `doInstallCheck` is set.
A list of host dependencies used by the phase, usually libraries linked into executables built during tests. This gets included in `buildInputs` when `doInstallCheck` is set.

##### `nativeInstallCheckInputs` {#var-stdenv-nativeInstallCheckInputs}

A list of native dependencies used by the phase, notably tools needed on `$PATH`. This gets included in `nativeBuildInputs` when `doInstallCheck` is set.

##### `preInstallCheck` {#var-stdenv-preInstallCheck}

Expand Down Expand Up @@ -994,6 +1002,32 @@ Convenience function for `makeWrapper` that replaces `<\executable\>` with a wra

If you will apply it multiple times, it will overwrite the wrapper file and you will end up with double wrapping, which should be avoided.

### `prependToVar` \<variableName\> \<elements...\> {#fun-prependToVar}

Prepend elements to a variable.

Example:

```shellSession
$ configureFlags="--disable-static"
$ prependToVar configureFlags --disable-dependency-tracking --enable-foo
$ echo $configureFlags
--disable-dependency-tracking --enable-foo --disable-static
```

### `appendToVar` \<variableName\> \<elements...\> {#fun-appendToVar}

Append elements to a variable.

Example:

```shellSession
$ configureFlags="--disable-static"
$ appendToVar configureFlags --disable-dependency-tracking --enable-foo
$ echo $configureFlags
--disable-static --disable-dependency-tracking --enable-foo
```

## Package setup hooks {#ssec-setup-hooks}

Nix itself considers a build-time dependency as merely something that should previously be built and accessible at build time—packages themselves are on their own to perform any additional setup. In most cases, that is fine, and the downstream derivation can deal with its own dependencies. But for a few common tasks, that would result in almost every package doing the same sort of setup work—depending not on the package itself, but entirely on which dependencies were used.
Expand Down
4 changes: 2 additions & 2 deletions lib/fixed-points.nix
Expand Up @@ -107,7 +107,7 @@ rec {
# Same as `makeExtensible` but the name of the extending attribute is
# customized.
makeExtensibleWithCustomName = extenderName: rattrs:
fix' rattrs // {
fix' (self: (rattrs self) // {
${extenderName} = f: makeExtensibleWithCustomName extenderName (extends f rattrs);
};
});
}
3 changes: 3 additions & 0 deletions lib/systems/doubles.nix
Expand Up @@ -68,13 +68,15 @@ in {
none = [];

arm = filterDoubles predicates.isAarch32;
armv7 = filterDoubles predicates.isArmv7;
aarch64 = filterDoubles predicates.isAarch64;
x86 = filterDoubles predicates.isx86;
i686 = filterDoubles predicates.isi686;
x86_64 = filterDoubles predicates.isx86_64;
microblaze = filterDoubles predicates.isMicroBlaze;
mips = filterDoubles predicates.isMips;
mmix = filterDoubles predicates.isMmix;
power = filterDoubles predicates.isPower;
riscv = filterDoubles predicates.isRiscV;
riscv32 = filterDoubles predicates.isRiscV32;
riscv64 = filterDoubles predicates.isRiscV64;
Expand All @@ -83,6 +85,7 @@ in {
or1k = filterDoubles predicates.isOr1k;
m68k = filterDoubles predicates.isM68k;
s390 = filterDoubles predicates.isS390;
s390x = filterDoubles predicates.isS390x;
js = filterDoubles predicates.isJavaScript;

bigEndian = filterDoubles predicates.isBigEndian;
Expand Down
6 changes: 5 additions & 1 deletion lib/systems/inspect.nix
Expand Up @@ -22,6 +22,9 @@ rec {
];
isx86 = { cpu = { family = "x86"; }; };
isAarch32 = { cpu = { family = "arm"; bits = 32; }; };
isArmv7 = map ({ arch, ... }: { cpu = { inherit arch; }; })
(lib.filter (cpu: lib.hasPrefix "armv7" cpu.arch or "")
(lib.attrValues cpuTypes));
isAarch64 = { cpu = { family = "arm"; bits = 64; }; };
isAarch = { cpu = { family = "arm"; }; };
isMicroBlaze = { cpu = { family = "microblaze"; }; };
Expand All @@ -44,6 +47,7 @@ rec {
isOr1k = { cpu = { family = "or1k"; }; };
isM68k = { cpu = { family = "m68k"; }; };
isS390 = { cpu = { family = "s390"; }; };
isS390x = { cpu = { family = "s390"; bits = 64; }; };
isJavaScript = { cpu = cpuTypes.js; };

is32bit = { cpu = { bits = 32; }; };
Expand Down Expand Up @@ -78,7 +82,7 @@ rec {
isUClibc = with abis; map (a: { abi = a; }) [ uclibc uclibceabi uclibceabihf ];

isEfi = map (family: { cpu.family = family; })
[ "x86" "arm" "aarch64" ];
[ "x86" "arm" "aarch64" "riscv" ];
};

matchAnyAttrs = patterns:
Expand Down

0 comments on commit d36727d

Please sign in to comment.