Skip to content

Commit

Permalink
develop (#2)
Browse files Browse the repository at this point in the history
* flaresolverr: init at 3.3.21

* nixos/flaresolverr: initial commit

* minio: 2024-07-04T14-25-45Z -> 2024-07-16T23-46-41Z

* cargo-make: 0.37.13 -> 0.37.14

* vscode-extensions.nefrob.vscode-just-syntax: 0.3.0 -> 0.5.1

* python312Packages.tencentcloud-sdk-python: 3.0.1190 -> 3.0.1192

Diff: TencentCloud/tencentcloud-sdk-python@refs/tags/3.0.1190...3.0.1192

Changelog: https://github.com/TencentCloud/tencentcloud-sdk-python/blob/3.0.1192/CHANGELOG.md

* python312Packages.tencentcloud-sdk-python: 3.0.1192 -> 3.0.1193

Diff: TencentCloud/tencentcloud-sdk-python@refs/tags/3.0.1192...3.0.1193

Changelog: https://github.com/TencentCloud/tencentcloud-sdk-python/blob/3.0.1193/CHANGELOG.md

* python312Packages.boto3-stubs: 1.34.144 -> 1.34.145

* python312Packages.botocore-stubs: 1.34.144 -> 1.34.145

* phraze: Add updateScript and version test

* files-cli: 2.13.85 -> 2.13.96

* lbreakouthd: 1.1.8 -> 1.1.9

* kdePackages.kio: 6.4.0 -> 6.4.1

* kdePackages.kwidgetsaddons: 6.4.0 -> 6.4.1

* home-assistant-custom-lovelace-modules.android-tv-card: 3.8.1 -> 3.8.2

Diff: Nerwyn/android-tv-card@3.8.1...3.8.2

* strictdoc: 0.0.57 -> 0.0.58

* nh: 3.5.18 -> 3.5.19

* steampipe: 0.23.2 -> 0.23.3

* numix-icon-theme-circle: 24.04.22 -> 24.07.19

* srm-cuarzo: 0.6.1-1 -> 0.6.3-1

* python312Packages.gpytorch: 1.11 -> 1.12

* haven-cli: 4.0.0 -> 4.0.2

* android-studio: 2024.1.1.11 -> 2024.1.1.12

* androidStudioPackages.canary: 2024.1.2.8 -> 2024.1.3.1

* ntpd-rs: 1.2.0 -> 1.2.2

* go: support FreeBSD

* python312Packages.app-model: 0.2.7 -> 0.2.8

* python312Packages.lmfit: 1.3.1 -> 1.3.2

* kustomize: 5.4.2 -> 5.4.3

* cargo-modules: 0.16.3 -> 0.16.6

* safeeyes: add missing setuptools dependency

Fixes:

    Traceback (most recent call last):
      File "/nix/store/km8nzjccd4r0g704is31q18qzl101g89-safeeyes-2.1.9/bin/.safeeyes-wrapped", line 6, in <module>
        from safeeyes.__main__ import main
      File "/nix/store/km8nzjccd4r0g704is31q18qzl101g89-safeeyes-2.1.9/lib/python3.12/site-packages/safeeyes/__main__.py", line 32, in <module>
        from safeeyes import utility
      File "/nix/store/km8nzjccd4r0g704is31q18qzl101g89-safeeyes-2.1.9/lib/python3.12/site-packages/safeeyes/utility.py", line 35, in <module>
        from distutils.version import LooseVersion
    ModuleNotFoundError: No module named 'distutils'

* python312Packages.holidays: 0.52 -> 0.53

https://github.com/vacanza/python-holidays/releases/tag/v0.53

* python312Packages.pytedee-async: 0.2.17 -> 0.2.20

Diff: zweckj/aiotedee@refs/tags/v0.2.17...v0.2.20

Changelog: https://github.com/zweckj/pytedee_async/releases/tag/v0.2.20

* python312Packages.python-kasa: 0.7.0.3 -> 0.7.0.5

Diff: python-kasa/python-kasa@refs/tags/0.7.0.3...0.7.0.5

Changelog: https://github.com/python-kasa/python-kasa/blob/0.7.0.5/CHANGELOG.md

Co-Authored-By: Martin Weinelt <[email protected]>

* python312Packages.upb-lib: 0.5.7 -> 0.5.8

Diff: gwww/upb-lib@refs/tags/0.5.7...0.5.8

Changelog: https://github.com/gwww/upb-lib/releases/tag/0.5.8

* obs-studio-plugins.obs-move-transition: 3.0.1 -> 3.0.2

* home-assistant: 2024.7.2 -> 2024.7.3

https://github.com/home-assistant/core/releases/tag/2024.7.3

* python312Packages.homeassistant-stubs: 2024.7.2 -> 2024.7.3

https://github.com/KapJI/homeassistant-stubs/releases/tag/2024.7.3

* mark: 9.12.0 -> 9.13.0

* ntpd-rs: disable testsuite, too flaky

* python312Packages.yfinance: 0.2.40 -> 0.2.41

* emacsPackages.ott-mode: trivialBuild -> melpaBuild

Also fix homepage and license.

* python312Packages.distributed: 2024.7.0 -> 2024.7.1

* python312Packages.rotary-embedding-torch: 0.6.2 -> 0.6.4

* beanhub-cli: 1.2.2 -> 1.2.3

* open-scq30: add CoreBluetooth framework on Darwin

* doc: Remove indefinite article and ending period from example meta.description

so that meta.description examples shown in the documentation
align with recommendations given in the "Meta attributes" section
in pkgs/README.md.

The changes were made with the following commands:
nix run nixpkgs#silver-searcher -- -l0 'description\s*=\s*"([Aa]n?|[Tt]he)\s' doc \
  | xargs -0 nix run nixpkgs#gnused -- -i '' -Ee '/description/s/"([Aa]n?|[Tt]he)\s(.)/"\U\2/'
nix run nixpkgs#silver-searcher -- -l0 'description\s*=\s*".*\."' doc \
  | xargs -0 nix run nixpkgs#gnused -- -i '' -Ee '/description/s/\."/"/'

* python312Packages.gtts: 2.5.1 -> 2.5.2

* virtiofsd: 1.11.0 -> 1.11.1

* llvm: fix broken llvm-config-native for canExecute

Since a0b4b85 ("llvm: Avoid cross compiling if the build platform
can execute host binaries"), the flags to get a working
llvm-config-native are not used when the build platform can execute
host binaries, resulting in a broken llvm-config-native, and therefore
a broken mesa, but since build can execute host, we don't need a
separate llvm-config-native at all — we can just use the normal
llvm-config.

Fixes: a0b4b85 ("llvm: Avoid cross compiling if the build platform can execute host binaries")

* linuxPackages_latest.rust-out-of-tree-module.updateScript: init

Added a version to the package to make the update script happy.

* linuxPackages_latest.rust-out-of-tree-module: 0-unstable-2023-08-29 -> 0-unstable-2024-05-06

Updated for breaking changes in Linux 6.10.

* androidStudioPackages.beta: 2024.1.1.10 -> 2024.1.2.9

* python312Packages.quaternion: 2023.0.3 -> 2023.0.4

* erigon: 2.60.2 -> 2.60.4

* python312Packages.cohere: 5.6.0 -> 5.6.1

* osu-lazer-bin: 2024.718.0 -> 2024.718.1

* vscode-extensions.42crunch.vscode-openapi: 4.25.3 -> 4.27.0

- Changelog: https://github.com/42Crunch/vscode-openapi/blob/master/CHANGELOG.md#version-4270-june-27-2024
- Comparing changes: 42Crunch/vscode-openapi@v4.25.3...v4.27.0

* osu-lazer: 2024.718.0 -> 2024.718.1

* silice: 0-unstable-2024-06-23 -> 0-unstable-2024-07-15

* cudaPackages.writeGpuTestPython: allow a selector for `libraries` to accommodate different python versions

* bemenu: 0.6.22 -> 0.6.23

* cudaPackages.writeGpuTestPython: sync the attr and the filesystem paths

* python312Packages.python-smarttub: 0.0.36 -> 0.0.37

* gnome-font-viewer: fix build with clang 16

* cudaPackages.writeGpuTestPython: accept makeWrapperArgs

* python311Packages.torch.tests.tester-*Available: unbreak for non-default python package sets

* python3Packages.torch.tests.*compile*: init

* bustle: use gettext from nixpkgs

The vendored gettext fails to build with clang 16 on Darwin. The gettext in nixpkgs works.

* incus: fix OVMF path backward compatibility

incus 6.3.0 changed the OVMF path, but our module needs to support LTS
as well. Also move the newer OCI deps to be conditional on version.

* vscodium: 1.90.2.24171 -> 1.91.1.24193

* nixos/wrappers: use normal mount for /run/wrappers

We want to get rid of specialFileSystems / earlyMountScript eventually and
there is no need to run this before systemd anymore now that
the wrappers themselves are set up in a systemd unit since NixOS#263203

Also this is needed to make soft-reboot work. We want to make sure
that we remount /run/wrappers with the nosuid bit removed on soft-reboot
but because @earlyMountScript@ happens in initrd, this wouldn't happen

* xdg-desktop-portal-xapp: 1.0.7 -> 1.0.8

* cinnamon.pix: 3.4.1 -> 3.4.2

Also enable optional brasero / colord support.

linuxmint/pix@3.4.1...3.4.2

* cinnamon.cinnamon-session: 6.2.0 -> 6.2.1

* applet-window-buttons6: init at 0.13.0

* python312Packages.formulae: 0.5.3 -> 0.5.4

* python312Packages.tplink-omada-client: 1.4.0 -> 1.4.1

* tui-journal: 0.9.0 -> 0.9.1

* wstunnel: 9.7.2 -> 9.7.4

* iosevka: 30.3.2 -> 30.3.3

---------

Co-authored-by: Pavel Sobolev <[email protected]>
Co-authored-by: Peder Bergebakken Sundt <[email protected]>
Co-authored-by: Emily <[email protected]>
Co-authored-by: Martin Weinelt <[email protected]>
Co-authored-by: R. Ryantm <[email protected]>
Co-authored-by: Robert Scott <[email protected]>
Co-authored-by: Johannes Jöns <[email protected]>
Co-authored-by: nixpkgs-merge-bot[bot] <148217876+nixpkgs-merge-bot[bot]@users.noreply.github.com>
Co-authored-by: abysssol <[email protected]>
Co-authored-by: uncenter <[email protected]>
Co-authored-by: Fabian Affolter <[email protected]>
Co-authored-by: Fabian Affolter <[email protected]>
Co-authored-by: Jörg Thalheim <[email protected]>
Co-authored-by: José Romildo Malaquias <[email protected]>
Co-authored-by: x123 <[email protected]>
Co-authored-by: Thomas Gerbet <[email protected]>
Co-authored-by: Artturin <[email protected]>
Co-authored-by: K900 <[email protected]>
Co-authored-by: Adam C. Stephens <[email protected]>
Co-authored-by: Nick Cao <[email protected]>
Co-authored-by: Emily Trau <[email protected]>
Co-authored-by: Weijia Wang <[email protected]>
Co-authored-by: Yt <[email protected]>
Co-authored-by: Lin Jian <[email protected]>
Co-authored-by: Franz Pletz <[email protected]>
Co-authored-by: Audrey Dutcher <[email protected]>
Co-authored-by: Cole Helbling <[email protected]>
Co-authored-by: Martin Weinelt <[email protected]>
Co-authored-by: Robert Schütz <[email protected]>
Co-authored-by: Marcus Ramberg <[email protected]>
Co-authored-by: Randy Eckenrode <[email protected]>
Co-authored-by: Pol Dellaiera <[email protected]>
Co-authored-by: Alexis Hildebrandt <[email protected]>
Co-authored-by: lassulus <[email protected]>
Co-authored-by: Robert Schütz <[email protected]>
Co-authored-by: Alyssa Ross <[email protected]>
Co-authored-by: Masum Reza <[email protected]>
Co-authored-by: Thiago Kenji Okada <[email protected]>
Co-authored-by: Sandro <[email protected]>
Co-authored-by: Gutyina Gergő <[email protected]>
Co-authored-by: Benedikt Hiemer <[email protected]>
Co-authored-by: Maximilian Bosch <[email protected]>
Co-authored-by: Aleksana <[email protected]>
Co-authored-by: Guillaume Girol <[email protected]>
Co-authored-by: Someone Serge <[email protected]>
Co-authored-by: ❄️ <[email protected]>
Co-authored-by: Yorick <[email protected]>
Co-authored-by: Adam Stephens <[email protected]>
Co-authored-by: Leona Maroni <[email protected]>
Co-authored-by: Arian van Putten <[email protected]>
Co-authored-by: A1ca7raz <[email protected]>
Co-authored-by: John Ericson <[email protected]>
Co-authored-by: Bobby Rong <[email protected]>
Co-authored-by: Someone <[email protected]>
  • Loading branch information
Show file tree
Hide file tree
Showing 3,496 changed files with 71,501 additions and 72,062 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
3 changes: 3 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
Expand Up @@ -138,3 +138,6 @@ acd0e3898feb321cb9a71a0fd376f1157d0f4553

# azure-cli: move to by-name, nixfmt #325950
96cd538b68bd1d0a0a37979356d669abbba32ebc

# poptracker: format with nixfmt-rfc-style (#326697)
ff5c8f6cc3d1f2e017e86d50965c14b71f00567b
3 changes: 1 addition & 2 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
# CI
/.github/workflows @NixOS/Security @Mic92 @zowoq
/.github/workflows/check-nix-format.yml @infinisil
/ci @infinisil
/ci @infinisil @NixOS/Security

# Develompent support
/.editorconfig @Mic92 @zowoq
Expand Down Expand Up @@ -371,7 +371,6 @@ nixos/tests/lxd/ @adamcstephens
pkgs/by-name/in/incus/ @adamcstephens
pkgs/by-name/lx/lxc* @adamcstephens
pkgs/by-name/lx/lxd* @adamcstephens
pkgs/os-specific/linux/lxc/ @adamcstephens

# ExpidusOS, Flutter
/pkgs/development/compilers/flutter @RossComputerGuy
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/backport.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Create backport PRs
uses: korthout/backport-action@ef20d86abccbac3ee3a73cb2efbdc06344c390e5 # v2.5.0
uses: korthout/backport-action@bd410d37cdcae80be6d969823ff5a225fe5c833f # v3.0.2
with:
# Config README: https://github.com/korthout/backport-action#backport-action
copy_labels_pattern: 'severity:\ssecurity'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/update-terraform-providers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ jobs:
run: |
git clean -f
- name: create PR
uses: peter-evans/create-pull-request@9153d834b60caba6d51c9b9510b087acf9f33f83 # v6.0.4
uses: peter-evans/create-pull-request@c5a7806660adbe173f04e3e038b0ccdcd758773c # v6.1.0
with:
body: |
Automatic update by [update-terraform-providers](https://github.com/NixOS/nixpkgs/blob/master/.github/workflows/update-terraform-providers.yml) action.
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
.idea/
.nixos-test-history
.vscode/
.helix/
outputs/
result-*
result
Expand Down
4 changes: 2 additions & 2 deletions ci/pinned-nixpkgs.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"rev": "cfb89a95f19bea461fc37228dc4d07b22fe617c2",
"sha256": "1yhsacvry6j8r02lk70p9dphjpi8lpzgq2qay8hiy4nqlys0mrch"
"rev": "521d48afa9ae596930a95325529df27fa7135ff5",
"sha256": "0a1pa5azw990narsfipdli1wng4nc3vhvrp00hb8v1qfchcq7dc9"
}
3 changes: 2 additions & 1 deletion ci/update-pinned-nixpkgs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ repo=https://github.com/nixos/nixpkgs
branch=nixpkgs-unstable
file=$SCRIPT_DIR/pinned-nixpkgs.json

rev=$(git ls-remote "$repo" refs/heads/"$branch" | cut -f1)
defaultRev=$(git ls-remote "$repo" refs/heads/"$branch" | cut -f1)
rev=${1:-$defaultRev}
sha256=$(nix-prefetch-url --unpack "$repo/archive/$rev.tar.gz" --name source)

jq -n --arg rev "$rev" --arg sha256 "$sha256" '$ARGS.named' | tee /dev/stderr > $file
4 changes: 2 additions & 2 deletions doc/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ let
$epubPath
echo "application/epub+zip" > mimetype
zip -0Xq "$out" mimetype
cd scratch && zip -Xr9D "$out" *
zip -0Xq -b "$TMPDIR" "$out" mimetype
cd scratch && zip -Xr9D -b "$TMPDIR" "$out" *
'';

# NB: This file describes the Nixpkgs manual, which happens to use module
Expand Down
14 changes: 13 additions & 1 deletion doc/hooks/installShellFiles.section.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ This hook helps with installing manpages and shell completion files. It exposes

The `installManPage` function takes one or more paths to manpages to install. The manpages must have a section suffix, and may optionally be compressed (with `.gz` suffix). This function will place them into the correct `share/man/man<section>/` directory, in [`outputMan`](#outputman).

The `installShellCompletion` function takes one or more paths to shell completion files. By default it will autodetect the shell type from the completion file extension, but you may also specify it by passing one of `--bash`, `--fish`, or `--zsh`. These flags apply to all paths listed after them (up until another shell flag is given). Each path may also have a custom installation name provided by providing a flag `--name NAME` before the path. If this flag is not provided, zsh completions will be renamed automatically such that `foobar.zsh` becomes `_foobar`. A root name may be provided for all paths using the flag `--cmd NAME`; this synthesizes the appropriate name depending on the shell (e.g. `--cmd foo` will synthesize the name `foo.bash` for bash and `_foo` for zsh). The path may also be a fifo or named fd (such as produced by `<(cmd)`), in which case the shell and name must be provided.
The `installShellCompletion` function takes one or more paths to shell completion files. By default it will autodetect the shell type from the completion file extension, but you may also specify it by passing one of `--bash`, `--fish`, or `--zsh`. These flags apply to all paths listed after them (up until another shell flag is given). Each path may also have a custom installation name provided by providing a flag `--name NAME` before the path. If this flag is not provided, zsh completions will be renamed automatically such that `foobar.zsh` becomes `_foobar`. A root name may be provided for all paths using the flag `--cmd NAME`; this synthesizes the appropriate name depending on the shell (e.g. `--cmd foo` will synthesize the name `foo.bash` for bash and `_foo` for zsh).

```nix
{
Expand All @@ -17,6 +17,18 @@ The `installShellCompletion` function takes one or more paths to shell completio
installShellCompletion --zsh --name _foobar share/completions.zsh
# implicit behavior
installShellCompletion share/completions/foobar.{bash,fish,zsh}
'';
}
```

The path may also be a fifo or named fd (such as produced by `<(cmd)`), in which case the shell and name must be provided (see below).

If the destination shell completion file is not actually present or consists of zero bytes after calling `installShellCompletion` this is treated as a build failure. In particular, if completion files are not vendored but are generated by running an executable, this is likely to fail in cross compilation scenarios. The result will be a zero byte completion file and hence a build failure. To prevent this, guard the completion commands against this, e.g.

```nix
{
nativeBuildInputs = [ installShellFiles ];
postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
# using named fd
installShellCompletion --cmd foobar \
--bash <($out/bin/foobar --bash-completion) \
Expand Down
2 changes: 1 addition & 1 deletion doc/languages-frameworks/coq.section.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ mkCoqDerivation {
[ mathcomp.ssreflect mathcomp.algebra mathcomp-finmap mathcomp-bigenough ];
meta = {
description = "A Coq/SSReflect Library for Monoidal Rings and Multinomials";
description = "Coq/SSReflect Library for Monoidal Rings and Multinomials";
license = lib.licenses.cecill-c;
};
}
Expand Down
189 changes: 189 additions & 0 deletions doc/languages-frameworks/gradle.section.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,189 @@
# Gradle {#gradle}

Gradle is a popular build tool for Java/Kotlin. Gradle itself doesn't
currently provide tools to make dependency resolution reproducible, so
nixpkgs has a proxy designed for intercepting Gradle web requests to
record dependencies so they can be restored in a reproducible fashion.

## Building a Gradle package {#building-a-gradle-package}

Here's how a typical derivation will look like:

```nix
stdenv.mkDerivation (finalAttrs: {
pname = "pdftk";
version = "3.3.3";
src = fetchFromGitLab {
owner = "pdftk-java";
repo = "pdftk";
rev = "v${finalAttrs.version}";
hash = "sha256-ciKotTHSEcITfQYKFZ6sY2LZnXGChBJy0+eno8B3YHY=";
};
nativeBuildInputs = [ gradle ];
# if the package has dependencies, mitmCache must be set
mitmCache = gradle.fetchDeps {
inherit (finalAttrs) pname;
data = ./deps.json;
};
# this is required for using mitm-cache on Darwin
__darwinAllowLocalNetworking = true;
gradleFlags = [ "-Dfile.encoding=utf-8" ];
# defaults to "assemble"
gradleBuildTask = "shadowJar";
# will run the gradleCheckTask (defaults to "test")
doCheck = true;
installPhase = ''
mkdir -p $out/{bin,share/pdftk}
cp build/libs/pdftk-all.jar $out/share/pdftk
makeWrapper ${jre}/bin/java $out/bin/pdftk \
--add-flags "-jar $out/share/pdftk/pdftk-all.jar"
cp ${finalAttrs.src}/pdftk.1 $out/share/man/man1
'';
meta.sourceProvenance = with lib.sourceTypes; [
fromSource
binaryBytecode # mitm cache
];
})
```

To update (or initialize) dependencies, run the update script via
something like `$(nix-build -A <pname>.mitmCache.updateScript)`
(`nix-build` builds the `updateScript`, `$(...)` runs the script at the
path printed by `nix-build`).

If your package can't be evaluated using a simple `pkgs.<pname>`
expression (for example, if your package isn't located in nixpkgs, or if
you want to override some of its attributes), you will usually have to
pass `pkg` instead of `pname` to `gradle.fetchDeps`. There are two ways
of doing it.

The first is to add the derivation arguments required for getting the
package. Using the pdftk example above:

```nix
{ lib
, stdenv
# ...
, pdftk
}:
stdenv.mkDerivation (finalAttrs: {
# ...
mitmCache = gradle.fetchDeps {
pkg = pdftk;
data = ./deps.json;
};
})
```

This allows you to `override` any arguments of the `pkg` used for
the update script (for example, `pkg = pdftk.override { enableSomeFlag =
true };`), so this is the preferred way.

The second is to create a `let` binding for the package, like this:

```nix
let self = stdenv.mkDerivation {
# ...
mitmCache = gradle.fetchDeps {
pkg = self;
data = ./deps.json;
};
}; in self
```

This is useful if you can't easily pass the derivation as its own
argument, or if your `mkDerivation` call is responsible for building
multiple packages.

In the former case, the update script will stay the same even if the
derivation is called with different arguments. In the latter case, the
update script will change depending on the derivation arguments. It's up
to you to decide which one would work best for your derivation.

## Update Script {#gradle-update-script}

The update script does the following:

- Build the derivation's source via `pkgs.srcOnly`
- Enter a `nix-shell` for the derivation in a `bwrap` sandbox (the
sandbox is only used on Linux)
- Set the `IN_GRADLE_UPDATE_DEPS` environment variable to `1`
- Run the derivation's `unpackPhase`, `patchPhase`, `configurePhase`
- Run the derivation's `gradleUpdateScript` (the Gradle setup hook sets
a default value for it, which runs `preBuild`, `preGradleUpdate`
hooks, fetches the dependencies using `gradleUpdateTask`, and finally
runs the `postGradleUpdate` hook)
- Finally, store all of the fetched files' hashes in the lockfile. They
may be `.jar`/`.pom` files from Maven repositories, or they may be
files otherwise used for building the package.

`fetchDeps` takes the following arguments:

- `attrPath` - the path to the package in nixpkgs (for example,
`"javaPackages.openjfx22"`). Used for update script metadata.
- `pname` - an alias for `attrPath` for convenience. This is what you
will generally use instead of `pkg` or `attrPath`.
- `pkg` - the package to be used for fetching the dependencies. Defaults
to `getAttrFromPath (splitString "." attrPath) pkgs`.
- `bwrapFlags` - allows you to override bwrap flags (only relevant for
downstream, non-nixpkgs projects)
- `data` - path to the dependencies lockfile (can be relative to the
package, can be absolute). In nixpkgs, it's discouraged to have the
lockfiles be named anything other `deps.json`, consider creating
subdirectories if your package requires multiple `deps.json` files.

## Environment {#gradle-environment}

The Gradle setup hook accepts the following environment variables:

- `mitmCache` - the MITM proxy cache imported using `gradle.fetchDeps`
- `gradleFlags` - command-line flags to be used for every Gradle
invocation (this simply registers a function that uses the necessary
flags).
- You can't use `gradleFlags` for flags that contain spaces, in that
case you must add `gradleFlagsArray+=("-flag with spaces")` to the
derivation's bash code instead.
- If you want to build the package using a specific Java version, you
can pass `"-Dorg.gradle.java.home=${jdk}"` as one of the flags.
- `gradleBuildTask` - the Gradle task (or tasks) to be used for building
the package. Defaults to `assemble`.
- `gradleCheckTask` - the Gradle task (or tasks) to be used for checking
the package if `doCheck` is set to `true`. Defaults to `test`.
- `gradleUpdateTask` - the Gradle task (or tasks) to be used for
fetching all of the package's dependencies in
`mitmCache.updateScript`. Defaults to `nixDownloadDeps`.
- `gradleUpdateScript` - the code to run for fetching all of the
package's dependencies in `mitmCache.updateScript`. Defaults to
running the `preBuild` and `preGradleUpdate` hooks, running the
`gradleUpdateTask`, and finally running the `postGradleUpdate` hook.
- `gradleInitScript` - path to the `--init-script` to pass to Gradle. By
default, a simple init script that enables reproducible archive
creation is used.
- Note that reproducible archives might break some builds. One example
of an error caused by it is `Could not create task ':jar'. Replacing
an existing task that may have already been used by other plugins is
not supported`. If you get such an error, the easiest "fix" is
disabling reproducible archives altogether by setting
`gradleInitScript` to something like `writeText
"empty-init-script.gradle" ""`
- `enableParallelBuilding` / `enableParallelChecking` /
`enableParallelUpdating` - pass `--parallel` to Gradle in the
build/check phase or in the update script. Defaults to true. If the
build fails for mysterious reasons, consider setting this to false.
- `dontUseGradleConfigure` / `dontUseGradleBuild` / `dontUseGradleCheck`
\- force disable the Gradle setup hook for certain phases.
- Note that if you disable the configure hook, you may face issues
such as `Failed to load native library 'libnative-platform.so'`,
because the configure hook is responsible for initializing Gradle.
68 changes: 67 additions & 1 deletion doc/languages-frameworks/javascript.section.md
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ buildNpmPackage rec {
NODE_OPTIONS = "--openssl-legacy-provider";

meta = {
description = "A modern web UI for various torrent clients with a Node.js backend and React frontend";
description = "Modern web UI for various torrent clients with a Node.js backend and React frontend";
homepage = "https://flood.js.org";
license = lib.licenses.gpl3Only;
maintainers = with lib.maintainers; [ winter ];
Expand Down Expand Up @@ -375,8 +375,74 @@ Assuming the following directory structure, we can define `sourceRoot` and `pnpm
pnpmRoot = "frontend";
```

### Yarn {#javascript-yarn}

Yarn based projects use a `yarn.lock` file instead of a `package-lock.json` to pin dependencies. Nixpkgs provides the Nix function `fetchYarnDeps` which fetches an offline cache suitable for running `yarn install` before building the project. In addition, Nixpkgs provides the hooks:

- `yarnConfigHook`: Fetches the dependencies from the offline cache and installs them into `node_modules`.
- `yarnBuildHook`: Runs `yarn build` or a specified `yarn` command that builds the project.

An example usage of the above attributes is:

```nix
{
lib,
stdenv,
fetchFromGitHub,
fetchYarnDeps,
yarnConfigHook,
yarnBuildHook,
nodejs,
npmHooks,
}:
stdenv.mkDerivation (finalAttrs: {
pname = "...";
version = "...";
src = fetchFromGitHub {
owner = "...";
repo = "...";
rev = "v${finalAttrs.version}";
hash = "sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=";
};
yarnOfflineCache = fetchYarnDeps {
yarnLock = finalAttrs.src + "/yarn.lock";
hash = "sha256-mo8urQaWIHu33+r0Y7mL9mJ/aSe/5CihuIetTeDHEUQ=";
};
nativeBuildInputs = [
yarnConfigHook
yarnBuildHook
# Needed for executing package.json scripts
nodejs
npmHooks.npmInstallHook
];
meta = {
# ...
};
})
```

Note that there is no setup hook for installing yarn based packages - `npmHooks.npmInstallHook` should fit most cases, but sometimes you may need to override the `installPhase` completely.

#### `yarnConfigHook` arguments {#javascript-yarnconfighook}

By default, `yarnConfigHook` relies upon the attribute `${yarnOfflineCache}` (or `${offlineCache}` if the former is not set) to find the location of the offline cache produced by `fetchYarnDeps`. To disable this phase, you can set `dontYarnInstallDeps = true` or override the `configurePhase`.

#### `yarnBuildHook` arguments {#javascript-yarnbuildhook}

This script by default runs `yarn --offline build`, and it relies upon the project's dependencies installed at `node_modules`. Below is a list of additional `mkDerivation` arguments read by this hook:

- `yarnBuildScript`: Sets a different `yarn --offline` subcommand (defaults to `build`).
- `yarnBuildFlags`: Single string list of additional flags to pass the above command, or a Nix list of such additional flags.

### yarn2nix {#javascript-yarn2nix}

WARNING: The `yarn2nix` functions have been deprecated in favor of the new `yarnConfigHook` and `yarnBuildHook`. Documentation for them still appears here for the sake of the packages that still use them. See also a tracking issue [#324246](https://github.com/NixOS/nixpkgs/issues/324246).

#### Preparation {#javascript-yarn2nix-preparation}

You will need at least a `yarn.lock` file. If upstream does not have one you need to generate it and reference it in your package definition.
Expand Down
2 changes: 1 addition & 1 deletion doc/languages-frameworks/ocaml.section.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ buildDunePackage rec {
meta = {
homepage = "https://github.com/flowtype/ocaml-wtf8";
description = "WTF-8 is a superset of UTF-8 that allows unpaired surrogates.";
description = "WTF-8 is a superset of UTF-8 that allows unpaired surrogates";
license = lib.licenses.mit;
maintainers = [ lib.maintainers.eqyiel ];
};
Expand Down
Loading

0 comments on commit f095491

Please sign in to comment.