diff --git a/doc/README.md b/doc/README.md index 4fafb9f575b8..84f2519d35ef 100644 --- a/doc/README.md +++ b/doc/README.md @@ -36,7 +36,7 @@ If the build succeeds, the manual will be in `./result/share/doc/nixpkgs/manual. ### Development environment -In order to reduce repetition, consider using tools from the provided development environment: +To reduce repetition, consider using tools from the provided development environment: Load it from the Nixpkgs documentation directory with diff --git a/doc/doc-support/package.nix b/doc/doc-support/package.nix index 3cc6daa32863..f2c37df39132 100644 --- a/doc/doc-support/package.nix +++ b/doc/doc-support/package.nix @@ -73,6 +73,7 @@ stdenvNoCC.mkDerivation ( ../anchor.min.js ../manpage-urls.json ../redirects.json + ../nav.json ] ); }; @@ -116,8 +117,8 @@ stdenvNoCC.mkDerivation ( --script ./highlightjs/loader.js \ --script ./anchor.min.js \ --script ./anchor-use.js \ - --toc-depth 1 \ - --section-toc-depth 1 \ + --sidebar-depth 3 \ + --nav ./nav.json \ manual.md \ out/index.html diff --git a/doc/languages-frameworks/beam.section.md b/doc/languages-frameworks/beam.section.md index 70ad1591be01..aec724999b66 100644 --- a/doc/languages-frameworks/beam.section.md +++ b/doc/languages-frameworks/beam.section.md @@ -125,7 +125,7 @@ There are 2 ways to package backend dependencies: either per-dependency mix2nix When writing an elixir project targeting `mixRelease`, you can also consider using [deps_nix](https://github.com/code-supply/deps_nix) with `mixNixDeps`. `deps_nix` supports git dependencies, but is intended to be added to the project's `mix.exs` directly. -###### mix2nix {#mix2nix} +##### mix2nix {#mix2nix} `mix2nix` is a cli tool available in Nixpkgs. It will generate a Nix expression from a `mix.lock` file. It is quite standard in the 2nix tool series. @@ -175,7 +175,7 @@ If there are git dependencies. You will need to run the build process once to fix the hash to correspond to your new git src. -###### FOD {#fixed-output-derivation} +##### FOD {#fixed-output-derivation} A fixed output derivation will download mix dependencies from the internet. To ensure reproducibility, a hash will be supplied. Note that mix is relatively reproducible. An FOD generating a different hash on each run hasn't been observed (as opposed to npm where the chances are relatively high). See [akkoma](https://github.com/NixOS/nixpkgs/blob/master/pkgs/by-name/ak/akkoma/package.nix) for a usage example of FOD. @@ -255,7 +255,7 @@ Setup will require the following steps: #### Example of creating a service for an Elixir - Phoenix project {#example-of-creating-a-service-for-an-elixir---phoenix-project} -In order to create a service with your release, you could add a `service.nix` +To create a service with your release, you could add a `service.nix` in your project with the following ```nix diff --git a/doc/languages-frameworks/haskell.section.md b/doc/languages-frameworks/haskell.section.md index f81c1b77d84e..9af8fe72b0e5 100644 --- a/doc/languages-frameworks/haskell.section.md +++ b/doc/languages-frameworks/haskell.section.md @@ -679,7 +679,7 @@ Defaults to `false`. `genericBuilderArgsModifier` : This argument accepts a function allowing you to modify the arguments passed -to `mkDerivation` in order to create the development environment. For example, +to `mkDerivation` to create the development environment. For example, `args: { doCheck = false; }` would cause the environment to not include any test dependencies. Defaults to `lib.id`. diff --git a/doc/languages-frameworks/maven.section.md b/doc/languages-frameworks/maven.section.md index e769b38ee744..b61c256ff322 100644 --- a/doc/languages-frameworks/maven.section.md +++ b/doc/languages-frameworks/maven.section.md @@ -341,7 +341,7 @@ The double invocation is a _simple_ way to get around the problem that `nix-buil It treats the entire Maven repository as a single source to be downloaded, relying on Maven's dependency resolution to satisfy the output hash. This is similar to fetchers like `fetchgit`, except it has to run a Maven build to determine what to download. -The first step will be to build the Maven project as a fixed-output derivation in order to collect the Maven repository -- below is an [example](https://github.com/fzakaria/nixos-maven-example/blob/main/double-invocation-repository.nix). +The first step will be to build the Maven project as a fixed-output derivation to collect the Maven repository -- below is an [example](https://github.com/fzakaria/nixos-maven-example/blob/main/double-invocation-repository.nix). ::: {.note} Traditionally the Maven repository is at `~/.m2/repository`. We will override this to be the `$out` directory. @@ -469,7 +469,7 @@ The previous example builds a `jar` file but that's not a file one can run. You need to use it with `java -jar $out/share/java/output.jar` and make sure to provide the required dependencies on the classpath. -The following explains how to use `makeWrapper` in order to make the derivation produce an executable that will run the JAR file you created. +The following explains how to use `makeWrapper` to make the derivation produce an executable that will run the JAR file you created. We will use the same repository we built above (either _double invocation_ or _buildMaven_) to setup a CLASSPATH for our JAR. diff --git a/doc/languages-frameworks/neovim.section.md b/doc/languages-frameworks/neovim.section.md index 78e9bf714013..5846417eb0a0 100644 --- a/doc/languages-frameworks/neovim.section.md +++ b/doc/languages-frameworks/neovim.section.md @@ -152,7 +152,7 @@ For example, if upstream documents that a plugin uses the Vim license but GitHub ## LuaRocks based plugins {#neovim-luarocks-based-plugins} -In order to automatically handle plugin dependencies, several Neovim plugins +To automatically handle plugin dependencies, several Neovim plugins upload their package to [LuaRocks](https://www.luarocks.org). This means less work for nixpkgs maintainers in the long term as dependencies get updated automatically. This means several Neovim plugins are first packaged as nixpkgs [lua packages](#packaging-a-library-on-luarocks), and converted via `buildNeovimPlugin` in diff --git a/doc/languages-frameworks/python.section.md b/doc/languages-frameworks/python.section.md index 809f397407a7..0a69d93bb745 100644 --- a/doc/languages-frameworks/python.section.md +++ b/doc/languages-frameworks/python.section.md @@ -1614,7 +1614,7 @@ looked at how you can create environments in which specified packages are available. At some point you'll likely have multiple packages which you would -like to be able to use in different projects. In order to minimise unnecessary +like to be able to use in different projects. To minimise unnecessary duplication we now look at how you can maintain a repository with your own packages. The important functions here are `import` and `callPackage`. @@ -1861,7 +1861,7 @@ pkgs.mkShell rec { pythonPackages.numpy pythonPackages.requests - # In this particular example, in order to compile any binary extensions they may + # In this particular example, to compile any binary extensions they may # require, the Python modules listed in the hypothetical requirements.txt need # the following packages to be installed locally: taglib @@ -2092,7 +2092,7 @@ See also [contributing section](#contributing). ### Are Python interpreters built deterministically? {#deterministic-builds} The Python interpreters are now built deterministically. Minor modifications had -to be made to the interpreters in order to generate deterministic bytecode. This +to be made to the interpreters to generate deterministic bytecode. This has security implications and is relevant for those using Python in a `nix-shell`. diff --git a/doc/languages-frameworks/rocq.section.md b/doc/languages-frameworks/rocq.section.md index af83d1e3790b..f2ba50312807 100644 --- a/doc/languages-frameworks/rocq.section.md +++ b/doc/languages-frameworks/rocq.section.md @@ -51,7 +51,7 @@ The recommended way of defining a derivation for a Rocq library, is to use the ` * if it is a string of the form `owner:branch` then it tries to download the `branch` of owner `owner` for a project of the same name using the same vcs, and the `version` attribute of the resulting derivation is set to `"dev"`, additionally if the owner is not provided (i.e. if the `owner:` prefix is missing), it defaults to the original owner of the package (see below), * if it is a string of the form `"#N"`, and the domain is github, then it tries to download the current head of the pull request `#N` from github, * `defaultVersion` (optional). Rocq libraries may be compatible with some specific versions of Rocq only. The `defaultVersion` attribute is used when no `version` is provided (or if `version = null`) to select the version of the library to use by default, depending on the context. This selection will mainly depend on a `rocq-core` version number but also possibly on other packages versions (e.g. `mathcomp`). If its value ends up to be `null`, the package is marked for removal in end-user `rocqPackages` attribute set. -* `release` (optional, defaults to `{}`), lists all the known releases of the library and for each of them provides an attribute set with at least a `hash` attribute (you may put the empty string `""` in order to automatically insert a fake hash, this will trigger an error which will allow you to find the correct hash), each attribute set of the list of releases also takes optional overloading arguments for the fetcher as below (i.e.`domain`, `owner`, `repo`, `rev`, `artifact` assuming the default fetcher is used) and optional overrides for the result of the fetcher (i.e. `version` and `src`). +* `release` (optional, defaults to `{}`), lists all the known releases of the library and for each of them provides an attribute set with at least a `hash` attribute (you may put the empty string `""` to automatically insert a fake hash, this will trigger an error which will allow you to find the correct hash), each attribute set of the list of releases also takes optional overloading arguments for the fetcher as below (i.e.`domain`, `owner`, `repo`, `rev`, `artifact` assuming the default fetcher is used) and optional overrides for the result of the fetcher (i.e. `version` and `src`). * `fetcher` (optional, defaults to a generic fetching mechanism supporting github or gitlab based infrastructures), is a function that takes at least an `owner`, a `repo`, a `rev`, and a `hash` and returns an attribute set with a `version` and `src`. * `repo` (optional, defaults to the value of `pname`), * `owner` (optional, defaults to `"rocq-community"`). @@ -153,7 +153,7 @@ For example, assuming you have a special `mathcomp` dependency you want to use, multinomials.override { mathcomp = my-special-mathcomp; } ``` -In Nixpkgs, all Rocq derivations take a `version` argument. This can be overridden in order to easily use a different version: +In Nixpkgs, all Rocq derivations take a `version` argument. This can be overridden to easily use a different version: ```nix rocqPackages.multinomials.override { version = "1.5.1"; } diff --git a/doc/languages-frameworks/ruby.section.md b/doc/languages-frameworks/ruby.section.md index cf2062845426..25407a074a3c 100644 --- a/doc/languages-frameworks/ruby.section.md +++ b/doc/languages-frameworks/ruby.section.md @@ -125,7 +125,7 @@ With this file in your directory, you can run `nix-shell` to build and use the g The `bundlerEnv` is a wrapper over all the gems in your gemset. This means that all the `/lib` and `/bin` directories will be available, and the executables of all gems (even of indirect dependencies) will end up in your `$PATH`. The `wrappedRuby` provides you with all executables that come with Ruby itself, but wrapped so they can easily find the gems in your gemset. -One common issue that you might have is that you have Ruby, but also `bundler` in your gemset. That leads to a conflict for `/bin/bundle` and `/bin/bundler`. You can resolve this by wrapping either your Ruby or your gems in a `lowPrio` call. So in order to give the `bundler` from your gemset priority, it would be used like this: +One common issue that you might have is that you have Ruby, but also `bundler` in your gemset. That leads to a conflict for `/bin/bundle` and `/bin/bundler`. You can resolve this by wrapping either your Ruby or your gems in a `lowPrio` call. So to give the `bundler` from your gemset priority, it would be used like this: ```nix # ... @@ -265,7 +265,7 @@ Now that you know how to get a working Ruby environment with Nix, it's time to g All gems in the standard set are automatically generated from a single `Gemfile`. The dependency resolution is done with `bundler` and makes it more likely that all gems are compatible with each other. -In order to add a new gem to nixpkgs, you can put it into the `/pkgs/development/ruby-modules/with-packages/Gemfile` and run `./maintainers/scripts/update-ruby-packages`. +To add a new gem to nixpkgs, you can put it into the `/pkgs/development/ruby-modules/with-packages/Gemfile` and run `./maintainers/scripts/update-ruby-packages`. To test that it works, you can then try using the gem with: diff --git a/doc/languages-frameworks/swift.section.md b/doc/languages-frameworks/swift.section.md index bb4599aa4fc3..76e4962fe9e3 100644 --- a/doc/languages-frameworks/swift.section.md +++ b/doc/languages-frameworks/swift.section.md @@ -160,7 +160,7 @@ This essentially runs: `swift test -c release` In some cases, it may be necessary to patch a SwiftPM dependency. SwiftPM dependencies are located in `.build/checkouts`, but the `swiftpm2nix` helper -provides these as symlinks to read-only `/nix/store` paths. In order to patch +provides these as symlinks to read-only `/nix/store` paths. To patch them, we need to make them writable. A special function `swiftpmMakeMutable` is available to replace the symlink diff --git a/doc/languages-frameworks/vim.section.md b/doc/languages-frameworks/vim.section.md index 2f3790d38547..91b59e3f0cab 100644 --- a/doc/languages-frameworks/vim.section.md +++ b/doc/languages-frameworks/vim.section.md @@ -153,7 +153,7 @@ Nix expressions for Vim plugins are stored in [pkgs/applications/editors/vim/plu When the vim updater detects an nvim-treesitter update, it also runs [`nvim-treesitter/update.py $(nix-build -A vimPlugins.nvim-treesitter)`](https://github.com/NixOS/nixpkgs/blob/master/pkgs/applications/editors/vim/plugins/utils/update.py) to update the tree sitter grammars for `nvim-treesitter`. -Some plugins require overrides in order to function properly. Overrides are placed in [overrides.nix](https://github.com/NixOS/nixpkgs/blob/master/pkgs/applications/editors/vim/plugins/overrides.nix). Overrides are most often required when a plugin requires some dependencies, or extra steps are required during the build process. For example `deoplete-fish` requires both `deoplete-nvim` and `vim-fish`, and so the following override was added: +Some plugins require overrides to function properly. Overrides are placed in [overrides.nix](https://github.com/NixOS/nixpkgs/blob/master/pkgs/applications/editors/vim/plugins/overrides.nix). Overrides are most often required when a plugin requires some dependencies, or extra steps are required during the build process. For example `deoplete-fish` requires both `deoplete-nvim` and `vim-fish`, and so the following override was added: ```nix { diff --git a/doc/nav.json b/doc/nav.json new file mode 100644 index 000000000000..15d4926421cf --- /dev/null +++ b/doc/nav.json @@ -0,0 +1,3 @@ +{ + "open": [] +} diff --git a/doc/packages/citrix.section.md b/doc/packages/citrix.section.md index f8530f4517a0..fe59f083a0b1 100644 --- a/doc/packages/citrix.section.md +++ b/doc/packages/citrix.section.md @@ -10,7 +10,7 @@ The tarball archive needs to be downloaded manually, as the license agreements o The [self-service](https://support.citrix.com/article/CTX200337) is an application for managing Citrix desktops and applications. Please note that this feature only works with at least `citrix_workspace_20_06_0` and later versions. -In order to set this up, you first have to [download the `.cr` file from the Netscaler Gateway](https://its.uiowa.edu/support/article/102186). After that, you can configure the `selfservice` like this: +To set this up, you first have to [download the `.cr` file from the Netscaler Gateway](https://its.uiowa.edu/support/article/102186). After that, you can configure the `selfservice` like this: ```ShellSession $ storebrowse -C ~/Downloads/receiverconfig.cr @@ -19,7 +19,7 @@ $ selfservice ## Custom certificates {#sec-citrix-custom-certs} -The `Citrix Workspace App` in `nixpkgs` trusts several certificates [from the Mozilla database](https://curl.haxx.se/docs/caextract.html) by default. However, several companies using Citrix might require their own corporate certificate. On distros with imperative packaging, these certs can be stored easily in [`$ICAROOT`](https://citrix.github.io/receiver-for-linux-command-reference/), however, this directory is a store path in `nixpkgs`. In order to work around this issue, the package provides a simple mechanism to add custom certificates without rebuilding the entire package using `symlinkJoin`: +The `Citrix Workspace App` in `nixpkgs` trusts several certificates [from the Mozilla database](https://curl.haxx.se/docs/caextract.html) by default. However, several companies using Citrix might require their own corporate certificate. On distros with imperative packaging, these certs can be stored easily in [`$ICAROOT`](https://citrix.github.io/receiver-for-linux-command-reference/), however, this directory is a store path in `nixpkgs`. To work around this issue, the package provides a simple mechanism to add custom certificates without rebuilding the entire package using `symlinkJoin`: ```nix with import { config.allowUnfree = true; }; diff --git a/doc/packages/urxvt.section.md b/doc/packages/urxvt.section.md index 6fc33190b58b..4170e6b0c63e 100644 --- a/doc/packages/urxvt.section.md +++ b/doc/packages/urxvt.section.md @@ -22,7 +22,7 @@ rxvt-unicode.override { If the `configure` function returns an attrset without the `plugins` attribute, `availablePlugins` will be used automatically. -In order to add plugins but also keep all default plugins installed, it is possible to use the following method: +To add plugins but also keep all default plugins installed, it is possible to use the following method: ```nix rxvt-unicode.override { diff --git a/doc/packages/weechat.section.md b/doc/packages/weechat.section.md index b134dc35dc1f..cdc9ccba5a96 100644 --- a/doc/packages/weechat.section.md +++ b/doc/packages/weechat.section.md @@ -39,7 +39,7 @@ weechat.override { } ``` -In order to also keep all default plugins installed, it is possible to use the following method: +To also keep all default plugins installed, it is possible to use the following method: ```nix weechat.override { diff --git a/doc/stdenv/stdenv.chapter.md b/doc/stdenv/stdenv.chapter.md index afcc6cf807c1..d470f69d033d 100644 --- a/doc/stdenv/stdenv.chapter.md +++ b/doc/stdenv/stdenv.chapter.md @@ -776,7 +776,7 @@ By default, the flag `--disable-dependency-tracking` is added to the configure f ##### `dontFixLibtool` {#var-stdenv-dontFixLibtool} -By default, the configure phase applies some special hackery to all files called `ltmain.sh` before running the configure script in order to improve the purity of Libtool-based packages [^footnote-stdenv-sys-lib-search-path] . If this is undesirable, set this variable to true. +By default, the configure phase applies some special hackery to all files called `ltmain.sh` before running the configure script to improve the purity of Libtool-based packages [^footnote-stdenv-sys-lib-search-path] . If this is undesirable, set this variable to true. ##### `dontDisableStatic` {#var-stdenv-dontDisableStatic} @@ -939,7 +939,7 @@ The fixup phase performs (Nix-specific) post-processing actions on the files ins - It moves the `man/`, `doc/` and `info/` subdirectories of `$out` to `share/`. - It strips libraries and executables of debug information. -- On Linux, it applies the `patchelf` command to ELF executables and libraries to remove unused directories from the `RPATH` in order to prevent unnecessary runtime dependencies. +- On Linux, it applies the `patchelf` command to ELF executables and libraries to remove unused directories from the `RPATH` to prevent unnecessary runtime dependencies. - It rewrites the interpreter paths of shell scripts to paths found in `PATH`. E.g., `/usr/bin/perl` will be rewritten to `/nix/store/some-perl/bin/perl` found in `PATH`. See [](#patch-shebangs.sh) for details. #### Variables controlling the fixup phase {#variables-controlling-the-fixup-phase} @@ -1345,7 +1345,7 @@ $ echo $configureFlags 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. -In order to alleviate this burden, the setup hook mechanism was written, where any package can include a shell script that \[by convention rather than enforcement by Nix\], any downstream reverse-dependency will source as part of its build process. That allows the downstream dependency to merely specify its dependencies, and lets those dependencies effectively initialize themselves. No boilerplate mirroring the list of dependencies is needed. +To alleviate this burden, the setup hook mechanism was written, where any package can include a shell script that \[by convention rather than enforcement by Nix\], any downstream reverse-dependency will source as part of its build process. That allows the downstream dependency to merely specify its dependencies, and lets those dependencies effectively initialize themselves. No boilerplate mirroring the list of dependencies is needed. The setup hook mechanism is a bit of a sledgehammer though: a powerful feature with a broad and indiscriminate area of effect. The combination of its power and implicit use may be expedient, but isn’t without costs. Nix itself is unchanged, but the spirit of added dependencies being effect-free is violated even if the latter isn’t. For example, if a derivation path is mentioned more than once, Nix itself doesn’t care and makes sure the dependency derivation is already built just the same—depending is just needing something to exist, and needing is idempotent. However, a dependency specified twice will have its setup hook run twice, and that could easily change the build environment (though a well-written setup hook will therefore strive to be idempotent so this is in fact not observable). More broadly, setup hooks are anti-modular in that multiple dependencies, whether the same or different, should not interfere and yet their setup hooks may well do so. diff --git a/doc/style.css b/doc/style.css index c3c58e88637d..ac052c81511c 100644 --- a/doc/style.css +++ b/doc/style.css @@ -131,6 +131,32 @@ body { padding-left: 1rem; padding-right: 1rem; } + + /* + See: https://developer.mozilla.org/en-US/docs/Web/API/Popover_API + + - :popover-open pseudo-class matches a popover element when it is in the showing state + - ::backdrop full-screen element placed directly behind popover + */ + nav.toc-sidebar:popover-open { + position: fixed; + inset: 0 auto 0 0; + width: min(20rem, 85vw); + height: 100dvh; + max-height: none; + margin: 0; + padding: 1rem; + overflow-y: auto; + overscroll-behavior: contain; + background: var(--background); + border: 0; + border-right: 0.0625rem solid #d8d8d8; + box-shadow: 0 0 1.5rem rgb(0 0 0 / 0.35); + } + + nav.toc-sidebar::backdrop { + background: rgb(0 0 0 / 0.5); + } } a { @@ -387,15 +413,6 @@ div.appendix dt { margin-top: 1em; } -div.book .toc dt, -div.appendix .toc dt { - margin-top: 0; -} - -.list-of-examples dt { - margin-top: 0; -} - div.book code, div.appendix code { padding: 0; @@ -408,17 +425,6 @@ div.appendix code { hyphens: none; } -div.book div.toc, -div.appendix div.toc { - margin-bottom: 3em; - border-bottom: 0.0625rem solid #d8d8d8; -} - -div.book div.toc dd, -div.appendix div.toc dd { - margin-left: 2em; -} - div.book span.command, div.appendix span.command { font-family: monospace; @@ -506,21 +512,48 @@ div.appendix .variablelist .term { nav.toc-sidebar { height: 100%; - overflow-y: none; padding: 0 1rem 2rem; - border-bottom: 0.0625rem solid #d8d8d8; +} + +/* menu button, shown on mobile, hidden on desktop */ +.toc-toggle { + display: inline-flex; + align-items: center; + margin: 0.75rem 0 0; + padding: 0.4rem 0.8rem; + border: 0.0625rem solid #d8d8d8; + border-radius: 0.25rem; + background: var(--background); + color: var(--main-text-color); + font: inherit; + cursor: pointer; + position: fixed; + top: 0.5rem; + left: 0.8rem; + z-index: 2; } nav.toc-sidebar .toc { margin-bottom: 0; } -nav.toc-sidebar .toc dl { +nav.toc-sidebar ol.toc, +nav.toc-sidebar ol.toc ol { + list-style: none; + margin: 0; + padding-left: 0; +} + +nav.toc-sidebar ol.toc ol { + padding-left: 1em; +} + +nav.toc-sidebar li { margin: 0; } -nav.toc-sidebar .toc dd { - margin-left: 1em; +nav.toc-sidebar summary { + cursor: pointer; } @media screen and (min-width: 768px) { @@ -542,14 +575,25 @@ nav.toc-sidebar .toc dd { } nav.toc-sidebar { + /* un-pop the drawer */ + display: block; + position: static; + inset: auto; + /* */ + margin: 0; grid-column: 1; grid-row: 2; max-height: none; overflow-y: auto; - border-bottom: none; + border: none; border-right: 0.0625rem solid #d8d8d8; } + /* Hide the toggle button on desktop */ + .toc-toggle { + display: none; + } + main.content { grid-column: 1 / -1; grid-row: 2; diff --git a/maintainers/maintainer-list.nix b/maintainers/maintainer-list.nix index ae63778dcd31..d31941103932 100644 --- a/maintainers/maintainer-list.nix +++ b/maintainers/maintainer-list.nix @@ -19998,6 +19998,11 @@ name = "Jakub Kądziołka"; keys = [ { fingerprint = "E576 BFB2 CF6E B13D F571 33B9 E315 A758 4613 1564"; } ]; }; + nielmin = { + name = "Daniel Hwang"; + github = "nielmin"; + githubId = 81798555; + }; nielsegberts = { email = "nix@nielsegberts.nl"; github = "nielsegberts"; diff --git a/nixos/doc/manual/default.nix b/nixos/doc/manual/default.nix index c8afe6167a7d..cf5c28358097 100644 --- a/nixos/doc/manual/default.nix +++ b/nixos/doc/manual/default.nix @@ -201,8 +201,7 @@ rec { --script ./highlightjs/loader.js \ --script ./anchor.min.js \ --script ./anchor-use.js \ - --toc-depth 1 \ - --chunk-toc-depth 1 \ + --sidebar-depth 2 \ ./manual.md \ $dst/${common.indexPath} diff --git a/nixos/modules/installer/sd-card/sd-image-aarch64.nix b/nixos/modules/installer/sd-card/sd-image-aarch64.nix index 2f6db6ed8abf..107879c188f1 100644 --- a/nixos/modules/installer/sd-card/sd-image-aarch64.nix +++ b/nixos/modules/installer/sd-card/sd-image-aarch64.nix @@ -31,17 +31,25 @@ populateFirmwareCommands = let configTxt = pkgs.writeText "config.txt" '' - [pi3] - kernel=u-boot-rpi3.bin + kernel=u-boot.bin + # Boot in 64-bit mode. + arm_64bit=1 + + # U-Boot needs this to work, regardless of whether UART is actually used or not. + # Look in arch/arm/mach-bcm283x/Kconfig in the U-Boot tree to see if this is still + # a requirement in the future. + enable_uart=1 + + # Prevent the firmware from smashing the framebuffer setup done by the mainline kernel + # when attempting to show low-voltage or overtemperature warnings. + avoid_warnings=1 + + [pi3] # Otherwise the serial output will be garbled. core_freq=250 - [pi02] - kernel=u-boot-rpi3.bin - [pi4] - kernel=u-boot-rpi4.bin enable_gic=1 armstub=armstub8-gic.bin @@ -58,28 +66,24 @@ # (e.g. for USB device mode) or if USB support is not required. otg_mode=1 - [all] - # Boot in 64-bit mode. - arm_64bit=1 + [cm5] + dtoverlay=dwc2,dr_mode=host - # U-Boot needs this to work, regardless of whether UART is actually used or not. - # Look in arch/arm/mach-bcm283x/Kconfig in the U-Boot tree to see if this is still - # a requirement in the future. - enable_uart=1 - - # Prevent the firmware from smashing the framebuffer setup done by the mainline kernel - # when attempting to show low-voltage or overtemperature warnings. - avoid_warnings=1 + [pi5] + # On some revisions of the RPi5, U-Boot interprets picks up + # ghost inputs from the uart, interrupting the boot process. + # https://bugzilla.opensuse.org/show_bug.cgi?id=1251192 + enable_uart=0 ''; in '' (cd ${pkgs.raspberrypifw}/share/raspberrypi/boot && cp bootcode.bin fixup*.dat start*.elf $NIX_BUILD_TOP/firmware/) + cp ${pkgs.ubootRaspberryPiAarch64}/u-boot.bin firmware/u-boot.bin # Add the config cp ${configTxt} firmware/config.txt # Add pi3 specific files - cp ${pkgs.ubootRaspberryPi3_64bit}/u-boot.bin firmware/u-boot-rpi3.bin cp ${pkgs.raspberrypifw}/share/raspberrypi/boot/bcm2710-rpi-2-b.dtb firmware/ cp ${pkgs.raspberrypifw}/share/raspberrypi/boot/bcm2710-rpi-3-b.dtb firmware/ cp ${pkgs.raspberrypifw}/share/raspberrypi/boot/bcm2710-rpi-3-b-plus.dtb firmware/ @@ -88,12 +92,20 @@ cp ${pkgs.raspberrypifw}/share/raspberrypi/boot/bcm2710-rpi-zero-2-w.dtb firmware/ # Add pi4 specific files - cp ${pkgs.ubootRaspberryPi4_64bit}/u-boot.bin firmware/u-boot-rpi4.bin cp ${pkgs.raspberrypi-armstubs}/armstub8-gic.bin firmware/armstub8-gic.bin cp ${pkgs.raspberrypifw}/share/raspberrypi/boot/bcm2711-rpi-4-b.dtb firmware/ cp ${pkgs.raspberrypifw}/share/raspberrypi/boot/bcm2711-rpi-400.dtb firmware/ cp ${pkgs.raspberrypifw}/share/raspberrypi/boot/bcm2711-rpi-cm4.dtb firmware/ cp ${pkgs.raspberrypifw}/share/raspberrypi/boot/bcm2711-rpi-cm4s.dtb firmware/ + + # Add pi5 specific files + cp ${pkgs.raspberrypifw}/share/raspberrypi/boot/bcm2712-d-rpi-5-b.dtb firmware/ + cp ${pkgs.raspberrypifw}/share/raspberrypi/boot/bcm2712-rpi-5-b.dtb firmware/ + cp ${pkgs.raspberrypifw}/share/raspberrypi/boot/bcm2712-rpi-500.dtb firmware/ + cp ${pkgs.raspberrypifw}/share/raspberrypi/boot/bcm2712-rpi-cm5-cm4io.dtb firmware/ + cp ${pkgs.raspberrypifw}/share/raspberrypi/boot/bcm2712-rpi-cm5-cm5io.dtb firmware/ + cp ${pkgs.raspberrypifw}/share/raspberrypi/boot/bcm2712-rpi-cm5l-cm4io.dtb firmware/ + cp ${pkgs.raspberrypifw}/share/raspberrypi/boot/bcm2712-rpi-cm5l-cm5io.dtb firmware/ ''; populateRootCommands = '' mkdir -p ./files/boot diff --git a/nixos/modules/services/misc/ollama.nix b/nixos/modules/services/misc/ollama.nix index 4ba0ccb6db7d..547f4e0799e4 100644 --- a/nixos/modules/services/misc/ollama.nix +++ b/nixos/modules/services/misc/ollama.nix @@ -37,6 +37,18 @@ in "ollama" "acceleration" ] "Set `services.ollama.package` to one of `pkgs.ollama[,-vulkan,-rocm,-cuda,-cpu]` instead.") + (lib.mkRenamedOptionModule + [ + "services" + "ollama" + "models" + ] + [ + "services" + "ollama" + "modelsDir" + ] + ) ]; options = { @@ -91,7 +103,7 @@ in The home directory that the ollama service is started in. ''; }; - models = lib.mkOption { + modelsDir = lib.mkOption { type = types.str; default = "${cfg.home}/models"; defaultText = "\${config.services.ollama.home}/models"; @@ -207,7 +219,7 @@ in cfg.environmentVariables // { HOME = cfg.home; - OLLAMA_MODELS = cfg.models; + OLLAMA_MODELS = cfg.modelsDir; OLLAMA_HOST = "${cfg.host}:${toString cfg.port}"; } // lib.optionalAttrs (cfg.rocmOverrideGfx != null) { @@ -226,7 +238,7 @@ in StateDirectory = [ "ollama" ]; ReadWritePaths = [ cfg.home - cfg.models + cfg.modelsDir ]; CapabilityBoundingSet = [ "" ]; diff --git a/nixos/tests/mattermost/default.nix b/nixos/tests/mattermost/default.nix index 075781583c00..1fd46f19abfa 100644 --- a/nixos/tests/mattermost/default.nix +++ b/nixos/tests/mattermost/default.nix @@ -66,12 +66,7 @@ import ../make-test-python.nix ( # Upgrade to the latest Mattermost. specialisation.latest.configuration = { - services.mattermost.package = lib.mkForce ( - pkgs.mattermostLatest.override { - removeFreeBadge = true; - removeUserLimit = true; - } - ); + services.mattermost.package = lib.mkForce pkgs.mattermostLatest; system.stateVersion = lib.mkVMOverride (lib.versions.majorMinor lib.version); }; } diff --git a/pkgs/applications/networking/instant-messengers/telegram/kotatogram-desktop/cstring-includes.patch b/pkgs/applications/networking/instant-messengers/telegram/kotatogram-desktop/cstring-includes.patch deleted file mode 100644 index e334777ac14f..000000000000 --- a/pkgs/applications/networking/instant-messengers/telegram/kotatogram-desktop/cstring-includes.patch +++ /dev/null @@ -1,74 +0,0 @@ -diff --git a/src/api/video/nv12_buffer.cc b/src/api/video/nv12_buffer.cc -index ca9dcd867..89d28f23c 100644 ---- a/src/api/video/nv12_buffer.cc -+++ b/src/api/video/nv12_buffer.cc -@@ -16,6 +16,8 @@ - #include "third_party/libyuv/include/libyuv/convert.h" - #include "third_party/libyuv/include/libyuv/scale.h" - -+#include -+ - namespace webrtc { - - namespace { -diff --git a/src/audio/utility/channel_mixer.cc b/src/audio/utility/channel_mixer.cc -index 0f1e66387..33b771b0c 100644 ---- a/src/audio/utility/channel_mixer.cc -+++ b/src/audio/utility/channel_mixer.cc -@@ -15,6 +15,8 @@ - #include "rtc_base/logging.h" - #include "rtc_base/numerics/safe_conversions.h" - -+#include -+ - namespace webrtc { - - ChannelMixer::ChannelMixer(ChannelLayout input_layout, -diff --git a/src/modules/audio_processing/aec3/alignment_mixer.cc b/src/modules/audio_processing/aec3/alignment_mixer.cc -index 7f076dea8..ffd7242b5 100644 ---- a/src/modules/audio_processing/aec3/alignment_mixer.cc -+++ b/src/modules/audio_processing/aec3/alignment_mixer.cc -@@ -10,6 +10,7 @@ - #include "modules/audio_processing/aec3/alignment_mixer.h" - - #include -+#include - - #include "rtc_base/checks.h" - -diff --git a/src/modules/desktop_capture/linux/wayland/shared_screencast_stream.cc b/src/modules/desktop_capture/linux/wayland/shared_screencast_stream.cc -index 7ef1a030e..5b9ab7137 100644 ---- a/src/modules/desktop_capture/linux/wayland/shared_screencast_stream.cc -+++ b/src/modules/desktop_capture/linux/wayland/shared_screencast_stream.cc -@@ -18,6 +18,7 @@ - #include - #include - -+#include - #include - - #include "absl/memory/memory.h" -diff --git a/src/modules/video_coding/utility/ivf_file_reader.cc b/src/modules/video_coding/utility/ivf_file_reader.cc -index 4c08ca613..f82f2bfcb 100644 ---- a/src/modules/video_coding/utility/ivf_file_reader.cc -+++ b/src/modules/video_coding/utility/ivf_file_reader.cc -@@ -10,6 +10,7 @@ - - #include "modules/video_coding/utility/ivf_file_reader.h" - -+#include - #include - #include - -diff --git a/src/net/dcsctp/packet/bounded_byte_writer.h b/src/net/dcsctp/packet/bounded_byte_writer.h -index d754549e4..bf5e3ed42 100644 ---- a/src/net/dcsctp/packet/bounded_byte_writer.h -+++ b/src/net/dcsctp/packet/bounded_byte_writer.h -@@ -12,6 +12,7 @@ - #define NET_DCSCTP_PACKET_BOUNDED_BYTE_WRITER_H_ - - #include -+#include - - #include "api/array_view.h" - \ No newline at end of file diff --git a/pkgs/applications/networking/instant-messengers/telegram/kotatogram-desktop/default.nix b/pkgs/applications/networking/instant-messengers/telegram/kotatogram-desktop/default.nix index da4652dca501..f4402d9798d8 100644 --- a/pkgs/applications/networking/instant-messengers/telegram/kotatogram-desktop/default.nix +++ b/pkgs/applications/networking/instant-messengers/telegram/kotatogram-desktop/default.nix @@ -1,97 +1,28 @@ { lib, - stdenv, fetchFromGitHub, - fetchpatch, - libsForQt5, - yasm, - alsa-lib, - jemalloc, - libopus, - libpulseaudio, + telegram-desktop, withWebkit ? true, }: let - telegram-desktop = libsForQt5.callPackage ../telegram-desktop { - inherit stdenv; - # N/A on Qt5 - kimageformats = null; - unwrapped = libsForQt5.callPackage ../telegram-desktop/unwrapped.nix { - inherit stdenv; - kcoreaddons = null; - qtshadertools = null; - }; - }; version = "1.4.9"; - tg_owt = telegram-desktop.tg_owt.overrideAttrs (oldAttrs: { - version = "0-unstable-2024-06-15"; - - src = fetchFromGitHub { - owner = "desktop-app"; - repo = "tg_owt"; - rev = "c9cc4390ab951f2cbc103ff783a11f398b27660b"; - hash = "sha256-FfWmSYaeryTDbsGJT3R7YK1oiyJcrR7YKKBOF+9PmpY="; - fetchSubmodules = true; - }; - - patches = [ - # fix build with latest glibc - # upstream PR: https://github.com/desktop-app/tg_owt/pull/172 - ./cstring-includes.patch - (fetchpatch { - url = "https://webrtc.googlesource.com/src/+/e7d10047096880feb5e9846375f2da54aef91202%5E%21/?format=TEXT"; - decode = "base64 -d"; - stripLen = 1; - extraPrefix = "src/"; - hash = "sha256-goxnuRRbwcdfIk1jFaKGiKCTCYn2saEj7En1Iyglzko="; - }) - ]; - - nativeBuildInputs = oldAttrs.nativeBuildInputs ++ [ yasm ]; - - env.NIX_CFLAGS_COMPILE = lib.optionalString stdenv.cc.isClang "-Wno-c++11-narrowing"; - }); in telegram-desktop.override { pname = "kotatogram-desktop"; inherit withWebkit; - unwrapped = (telegram-desktop.unwrapped.override { inherit tg_owt; }).overrideAttrs (old: { + unwrapped = telegram-desktop.unwrapped.overrideAttrs (old: { pname = "kotatogram-desktop-unwrapped"; - version = "${version}-unstable-2024-09-27"; + version = "${version}-unstable-2026-07-03"; src = fetchFromGitHub { owner = "kotatogram"; repo = "kotatogram-desktop"; - rev = "0581eb6219343b3cfcbb81124b372df1039b7568"; - hash = "sha256-rvn8GZmHdMkVutLUe/LmUNIawlb9VgU3sYhPwZ2MWsI="; + rev = "7263a1b53c9e6b45a416532644fff7a4c7f90d54"; + hash = "sha256-xOfHZ7oUJKk65j7o/AgxtFfc5NqsAoA9E+8U6rHlSmc="; fetchSubmodules = true; }; - patches = [ - ./macos-qt5.patch - ./glib-2.86.patch - (fetchpatch { - url = "https://gitlab.com/mnauw/cppgir/-/commit/c8bb1c6017a6f7f2e47bd10543aea6b3ec69a966.patch"; - stripLen = 1; - extraPrefix = "cmake/external/glib/cppgir/"; - hash = "sha256-8B4h3BTG8dIlt3+uVgBI569E9eCebcor9uohtsrZpnI="; - }) - ]; - - buildInputs = - (old.buildInputs or [ ]) - ++ [ - libopus - ] - ++ lib.optionals stdenv.hostPlatform.isLinux [ - alsa-lib - jemalloc - libpulseaudio - ]; - - env.NIX_CFLAGS_COMPILE = lib.optionalString stdenv.cc.isClang "-Wno-missing-template-arg-list-after-template-kw"; - meta = { description = "Kotatogram – experimental Telegram Desktop fork"; longDescription = '' @@ -104,7 +35,7 @@ telegram-desktop.override { homepage = "https://kotatogram.github.io"; changelog = "https://github.com/kotatogram/kotatogram-desktop/releases/tag/k${version}"; maintainers = with lib.maintainers; [ ilya-fedin ]; - mainProgram = if stdenv.hostPlatform.isLinux then "kotatogram-desktop" else "Kotatogram"; + mainProgram = "Kotatogram"; }; }); } diff --git a/pkgs/applications/networking/instant-messengers/telegram/kotatogram-desktop/glib-2.86.patch b/pkgs/applications/networking/instant-messengers/telegram/kotatogram-desktop/glib-2.86.patch deleted file mode 100644 index 5e7f5dc698ae..000000000000 --- a/pkgs/applications/networking/instant-messengers/telegram/kotatogram-desktop/glib-2.86.patch +++ /dev/null @@ -1,37 +0,0 @@ -Submodule Telegram/lib_base contains modified content -diff --git a/Telegram/lib_base/base/platform/linux/base_url_scheme_linux.cpp b/Telegram/lib_base/base/platform/linux/base_url_scheme_linux.cpp -index 4197367..f79d2fa 100644 ---- a/Telegram/lib_base/base/platform/linux/base_url_scheme_linux.cpp -+++ b/Telegram/lib_base/base/platform/linux/base_url_scheme_linux.cpp -@@ -15,7 +15,7 @@ - #include - #include - --#include -+#include - #include - - namespace base::Platform { -@@ -125,7 +125,7 @@ void RegisterUrlScheme(const UrlSchemeDescriptor &descriptor) { - - const auto appId = QGuiApplication::desktopFileName().toStdString(); - if (!appId.empty()) { -- Gio::AppInfo appInfo = Gio::DesktopAppInfo::new_(appId + ".desktop"); -+ Gio::AppInfo appInfo = GioUnix::DesktopAppInfo::new_(appId + ".desktop"); - if (appInfo) { - if (appInfo.get_commandline() == commandlineForCreator + " %u") { - appInfo.set_as_default_for_type(handlerType); -Submodule cmake contains modified content -diff --git a/cmake/external/glib/CMakeLists.txt b/cmake/external/glib/CMakeLists.txt -index 3c6fe4b..6f73dc5 100644 ---- a/cmake/external/glib/CMakeLists.txt -+++ b/cmake/external/glib/CMakeLists.txt -@@ -16,7 +16,7 @@ endfunction() - add_cppgir() - - include(generate_cppgir.cmake) --generate_cppgir(external_glib Gio-2.0) -+generate_cppgir(external_glib GioUnix-2.0) - - find_package(PkgConfig REQUIRED) - pkg_check_modules(GLIB2 REQUIRED IMPORTED_TARGET glib-2.0 gobject-2.0 gio-2.0 gio-unix-2.0) diff --git a/pkgs/applications/networking/instant-messengers/telegram/kotatogram-desktop/macos-qt5.patch b/pkgs/applications/networking/instant-messengers/telegram/kotatogram-desktop/macos-qt5.patch deleted file mode 100644 index 55beb31a7a4d..000000000000 --- a/pkgs/applications/networking/instant-messengers/telegram/kotatogram-desktop/macos-qt5.patch +++ /dev/null @@ -1,75 +0,0 @@ -diff --git a/Telegram/SourceFiles/platform/mac/main_window_mac.h b/Telegram/SourceFiles/platform/mac/main_window_mac.h -index 2a3a59b9cf..16b7b6cdde 100644 ---- a/Telegram/SourceFiles/platform/mac/main_window_mac.h -+++ b/Telegram/SourceFiles/platform/mac/main_window_mac.h -@@ -10,6 +10,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL - #include "platform/platform_main_window.h" - #include "platform/mac/specific_mac_p.h" - #include "base/timer.h" -+#include "base/qt/qt_common_adapters.h" - - #include - #include -@@ -52,7 +53,7 @@ private: - bool nativeEvent( - const QByteArray &eventType, - void *message, -- qintptr *result) override; -+ base::NativeEventResult *result) override; - - void hideAndDeactivate(); - void updateDockCounter(); -diff --git a/Telegram/SourceFiles/platform/mac/main_window_mac.mm b/Telegram/SourceFiles/platform/mac/main_window_mac.mm -index e95ef79f16..c3381926a9 100644 ---- a/Telegram/SourceFiles/platform/mac/main_window_mac.mm -+++ b/Telegram/SourceFiles/platform/mac/main_window_mac.mm -@@ -305,7 +305,7 @@ void MainWindow::updateWindowIcon() { - bool MainWindow::nativeEvent( - const QByteArray &eventType, - void *message, -- qintptr *result) { -+ base::NativeEventResult *result) { - if (message && eventType == "NSEvent") { - const auto event = static_cast(message); - if (PossiblyTextTypingEvent(event)) { -diff --git a/Telegram/SourceFiles/platform/mac/notifications_manager_mac.mm b/Telegram/SourceFiles/platform/mac/notifications_manager_mac.mm -index de28809077..2521428567 100644 ---- a/Telegram/SourceFiles/platform/mac/notifications_manager_mac.mm -+++ b/Telegram/SourceFiles/platform/mac/notifications_manager_mac.mm -@@ -502,11 +502,11 @@ void Manager::Private::invokeIfNotFocused(Fn callback) { - } else { - if (!_processesInited) { - _processesInited = true; -- QObject::connect(&_dnd, &QProcess::finished, [=] { -+ QObject::connect(&_dnd, QOverload::of(&QProcess::finished), [=] { - _waitingDnd = false; - checkFocusState(); - }); -- QObject::connect(&_focus, &QProcess::finished, [=] { -+ QObject::connect(&_focus, QOverload::of(&QProcess::finished), [=] { - _waitingFocus = false; - checkFocusState(); - }); -@@ -536,7 +536,7 @@ void Manager::Private::checkFocusState() { - } - const auto istrue = [](QProcess &process) { - const auto output = process.readAllStandardOutput(); -- DEBUG_LOG(("Focus Check: %1").arg(output)); -+ DEBUG_LOG(("Focus Check: %1").arg(QString::fromUtf8(output))); - const auto result = (output.trimmed() == u"true"_q); - return result; - }; -Submodule Telegram/lib_ui contains modified content -diff --git a/Telegram/lib_ui/ui/rp_widget.cpp b/Telegram/lib_ui/ui/rp_widget.cpp -index 0b57704..0d2ca01 100644 ---- a/Telegram/lib_ui/ui/rp_widget.cpp -+++ b/Telegram/lib_ui/ui/rp_widget.cpp -@@ -62,7 +62,7 @@ TWidget::TWidget(QWidget *parent) - auto format = QSurfaceFormat::defaultFormat(); - format.setSwapInterval(0); - #ifdef Q_OS_MAC -- format.setColorSpace(QColorSpace::SRgb); -+ format.setColorSpace(QSurfaceFormat::sRGBColorSpace); - #endif // Q_OS_MAC - QSurfaceFormat::setDefaultFormat(format); - return true; diff --git a/pkgs/applications/office/softmaker/freeoffice.nix b/pkgs/applications/office/softmaker/freeoffice.nix index 39cf3351dace..85a079b218f8 100644 --- a/pkgs/applications/office/softmaker/freeoffice.nix +++ b/pkgs/applications/office/softmaker/freeoffice.nix @@ -6,9 +6,9 @@ # overridable. This is useful when the upstream archive was replaced # and nixpkgs is not in sync yet. officeVersion ? { - version = "1220"; + version = "1234"; edition = "2024"; - hash = "sha256-F1Srm3/4UPifYls21MhjbpxSyLaT0gEVzEMQF0gIzi0="; + hash = "sha256-q5QUevkSxdh622ZMhwbO44HLJowpg0vwv9de7hdOUQQ="; }, ... diff --git a/pkgs/by-name/ch/checkpolicy/package.nix b/pkgs/by-name/ch/checkpolicy/package.nix index b2d6a59daedf..9422f0807d29 100644 --- a/pkgs/by-name/ch/checkpolicy/package.nix +++ b/pkgs/by-name/ch/checkpolicy/package.nix @@ -9,12 +9,12 @@ stdenv.mkDerivation (finalAttrs: { pname = "checkpolicy"; - version = "3.10"; + version = "3.11"; inherit (libsepol) se_url; src = fetchurl { url = "${finalAttrs.se_url}/${finalAttrs.version}/checkpolicy-${finalAttrs.version}.tar.gz"; - hash = "sha256-LZKVHfywkNYXnnojhWYi4Py8Mr4Dvx5grOncnL2hHlk="; + hash = "sha256-m4G/zu9/qdAvmHLlanhvND3FjvS1cT3ODVxBbluEzvo="; }; nativeBuildInputs = [ diff --git a/pkgs/by-name/cn/cnspec/package.nix b/pkgs/by-name/cn/cnspec/package.nix index 9574fd82a314..f1e795dbc820 100644 --- a/pkgs/by-name/cn/cnspec/package.nix +++ b/pkgs/by-name/cn/cnspec/package.nix @@ -6,18 +6,18 @@ buildGoModule (finalAttrs: { pname = "cnspec"; - version = "13.27.0"; + version = "13.27.4"; src = fetchFromGitHub { owner = "mondoohq"; repo = "cnspec"; tag = "v${finalAttrs.version}"; - hash = "sha256-t/ugT15QxiwMJybX2mIwgx0wGQETLFJWplxNEosTq4A="; + hash = "sha256-HcDGHcKxbXYTF+PdrjcOcCH/0Hnz++qIGdbDYtCRpDM="; }; proxyVendor = true; - vendorHash = "sha256-M2f2HApngE8GJRXy53u7bif1puNTE6BV6oxmnvSSS6Y="; + vendorHash = "sha256-suSEjRh6vSSI2jRyz12nLD/G1gvQiWC4aGx2J2drSIo="; subPackages = [ "apps/cnspec" ]; diff --git a/pkgs/by-name/cy/cyberstrike/package.nix b/pkgs/by-name/cy/cyberstrike/package.nix new file mode 100644 index 000000000000..8ce2972eb26e --- /dev/null +++ b/pkgs/by-name/cy/cyberstrike/package.nix @@ -0,0 +1,178 @@ +{ + lib, + bun, + fetchFromGitHub, + installShellFiles, + makeBinaryWrapper, + models-dev, + nix-update-script, + nodejs, + ripgrep, + stdenvNoCC, + sysctl, + versionCheckHook, + writableTmpDirAsHomeHook, +}: + +stdenvNoCC.mkDerivation (finalAttrs: { + pname = "cyberstrike"; + version = "1.1.14"; + + __structuredAttrs = true; + strictDeps = true; + + src = fetchFromGitHub { + owner = "CyberStrikeus"; + repo = "CyberStrike"; + tag = "v${finalAttrs.version}"; + hash = "sha256-MlFEGP/MiuDtLl7Ms6j11u1MdLV6w8T/7TYo7eeE/rc="; + }; + + node_modules = stdenvNoCC.mkDerivation { + pname = "${finalAttrs.pname}-node_modules"; + inherit (finalAttrs) version src; + + impureEnvVars = lib.fetchers.proxyImpureEnvVars ++ [ + "GIT_PROXY_COMMAND" + "SOCKS_SERVER" + ]; + + nativeBuildInputs = [ + bun + writableTmpDirAsHomeHook + ]; + + dontConfigure = true; + + buildPhase = '' + runHook preBuild + + export BUN_INSTALL_CACHE_DIR=$(mktemp -d) + bun install \ + --cpu="${if stdenvNoCC.hostPlatform.isAarch64 then "arm64" else "x64"}" \ + --os="${if stdenvNoCC.hostPlatform.isLinux then "linux" else "darwin"}" \ + --filter '!./' \ + --filter './packages/cyberstrike' \ + --frozen-lockfile \ + --ignore-scripts \ + --no-progress + + bun --bun ./nix/scripts/canonicalize-node-modules.ts + bun --bun ./nix/scripts/normalize-bun-binaries.ts + + runHook postBuild + ''; + + installPhase = '' + runHook preInstall + + mkdir -p $out + find . -type d -name node_modules -exec cp -R --parents {} $out \; + + runHook postInstall + ''; + + # Required so fixed-output derivation does not retain store references + dontFixup = true; + + outputHash = "sha256-IxIdzd9MJJRpc0nB5eEASSW0LIckU+SvcUgkKoL+mog="; + outputHashAlgo = "sha256"; + outputHashMode = "recursive"; + }; + + nativeBuildInputs = [ + bun + installShellFiles + makeBinaryWrapper + writableTmpDirAsHomeHook + ]; + + configurePhase = '' + runHook preConfigure + + cp -R ${finalAttrs.node_modules}/. . + patchShebangs node_modules + patchShebangs packages/*/node_modules + + runHook postConfigure + ''; + + env = { + MODELS_DEV_API_JSON = "${models-dev}/dist/_api.json"; + CYBERSTRIKE_DISABLE_MODELS_FETCH = true; + CYBERSTRIKE_VERSION = finalAttrs.version; + CYBERSTRIKE_CHANNEL = "local"; + }; + + buildPhase = '' + runHook preBuild + + cd ./packages/cyberstrike + bun --bun ./script/build.ts --single --skip-install + bun --bun ./script/schema.ts schema.json + + runHook postBuild + ''; + + installPhase = '' + runHook preInstall + + install -Dm755 dist/cyberstrike-*/bin/cyberstrike $out/bin/cyberstrike + install -Dm644 schema.json $out/share/cyberstrike/schema.json + + wrapProgram $out/bin/cyberstrike \ + --prefix PATH : ${ + lib.makeBinPath ( + [ + ripgrep + nodejs + ] + ++ lib.optional stdenvNoCC.hostPlatform.isDarwin sysctl + ) + } + + runHook postInstall + ''; + + postInstall = lib.optionalString (stdenvNoCC.buildPlatform.canExecute stdenvNoCC.hostPlatform) '' + installShellCompletion --cmd cyberstrike \ + --bash <($out/bin/cyberstrike completion) \ + --zsh <(SHELL=/bin/zsh $out/bin/cyberstrike completion) + ''; + + nativeInstallCheckInputs = [ + versionCheckHook + writableTmpDirAsHomeHook + ]; + + doInstallCheck = true; + + versionCheckKeepEnvironment = [ + "HOME" + "CYBERSTRIKE_DISABLE_MODELS_FETCH" + ]; + + versionCheckProgramArg = "--version"; + + passthru = { + jsonschema = { + config = "${placeholder "out"}/share/cyberstrike/schema.json"; + tui = "${placeholder "out"}/share/cyberstrike/tui.json"; + }; + updateScript = nix-update-script { + extraArgs = [ + "--subpackage" + "node_modules" + ]; + }; + }; + + meta = { + description = "AI-powered offensive security agent"; + homepage = "https://github.com/CyberStrikeus/CyberStrike"; + changelog = "https://github.com/CyberStrikeus/CyberStrike/blob/${finalAttrs.src.rev}/CHANGELOG.md"; + license = lib.licenses.agpl3Only; + maintainers = with lib.maintainers; [ fab ]; + mainProgram = "cyberstrike"; + }; +}) diff --git a/pkgs/by-name/de/delve/package.nix b/pkgs/by-name/de/delve/package.nix index 053b6aa93d68..32b4bf498625 100644 --- a/pkgs/by-name/de/delve/package.nix +++ b/pkgs/by-name/de/delve/package.nix @@ -9,13 +9,13 @@ buildGoModule (finalAttrs: { pname = "delve"; - version = "1.26.3"; + version = "1.27.0"; src = fetchFromGitHub { owner = "go-delve"; repo = "delve"; tag = "v${finalAttrs.version}"; - hash = "sha256-R7rxWJZ1AfwH/ytgQnq21D5d4YRm3fzYSIG0eugww1U="; + hash = "sha256-g7Lyi+lZZ818p4yINoJ12bdCY8sTwxaU/eRkuofnqnU="; }; patches = [ diff --git a/pkgs/by-name/en/entire/package.nix b/pkgs/by-name/en/entire/package.nix index 7b2ca61663b9..8ce5c4ec6804 100644 --- a/pkgs/by-name/en/entire/package.nix +++ b/pkgs/by-name/en/entire/package.nix @@ -11,16 +11,16 @@ buildGoModule (finalAttrs: { pname = "entire"; - version = "0.6.3"; + version = "0.7.8"; src = fetchFromGitHub { owner = "entireio"; repo = "cli"; tag = "v${finalAttrs.version}"; - hash = "sha256-yGutKLwdTuGamZMdkqHlhBypZFuY9jM0w/1VW6ACppg="; + hash = "sha256-SqJnrvRwjuPMCEkd4d+ULIUOfDW6mPs6VeW84Tc5vN0="; }; - vendorHash = "sha256-pIIrrbp3x15iiY3CuA+wU7315bHUSjvJWBa4Q58OorU="; + vendorHash = "sha256-foQkuVJtyWJrGSPV8kxMcAWdjCw4TOgMV/KUa92FL/Y="; subPackages = [ "cmd/entire" ]; diff --git a/pkgs/by-name/fr/freeradius/package.nix b/pkgs/by-name/fr/freeradius/package.nix index 7f0036dc66a5..3aa2e394b9f5 100644 --- a/pkgs/by-name/fr/freeradius/package.nix +++ b/pkgs/by-name/fr/freeradius/package.nix @@ -38,13 +38,13 @@ assert withRest -> withJson; stdenv.mkDerivation rec { pname = "freeradius"; - version = "3.2.8"; + version = "3.2.10"; src = fetchFromGitHub { owner = "FreeRADIUS"; repo = "freeradius-server"; tag = "release_${lib.replaceStrings [ "." ] [ "_" ] version}"; - hash = "sha256-NvcXTT0jp3WR/w+JWcNESg6iNYqIV8QAlM8MxpYkpjs="; + hash = "sha256-+pFV6dDnL7T5G309cLACa+/0vGppCEdk3ghOQhgSjTs="; }; nativeBuildInputs = [ autoreconfHook ]; diff --git a/pkgs/by-name/go/gopodder/package.nix b/pkgs/by-name/go/gopodder/package.nix new file mode 100644 index 000000000000..944c70fe416e --- /dev/null +++ b/pkgs/by-name/go/gopodder/package.nix @@ -0,0 +1,52 @@ +{ + lib, + buildGoModule, + fetchFromGitHub, + gitUpdater, + versionCheckHook, +}: + +buildGoModule (finalAttrs: { + pname = "gopodder"; + version = "1.2.1"; + __structuredAttrs = true; + + src = fetchFromGitHub { + owner = "cbrgm"; + repo = "gopodder"; + tag = "v${finalAttrs.version}"; + hash = "sha256-o/iQnr8WLArecRyMttCluuEYwKirKsOJyj5a7tdulVo="; + }; + + vendorHash = "sha256-iG2IUfBVLQ7P0W4HOiGShVyD4mGUQ0dfGjG4XIYVtWU="; + + ldflags = [ + "-s" + "-X main.Version=${finalAttrs.version}" + "-X main.Revision=${finalAttrs.src.tag}" + "-X main.BuildDate=1970-01-01" + ]; + + env.CGO_ENABLED = 0; + + nativeInstallCheckInputs = [ + versionCheckHook + ]; + + doInstallCheck = true; + + __darwinAllowLocalNetworking = true; + + passthru.updateScript = gitUpdater { + rev-prefix = "v"; + }; + + meta = { + description = "Self-hostable podcast synchronization server compatible with the gPodder API"; + homepage = "https://github.com/cbrgm/gopodder"; + changelog = "https://github.com/cbrgm/gopodder/releases/tag/${finalAttrs.src.tag}"; + license = lib.licenses.asl20; + maintainers = with lib.maintainers; [ nielmin ]; + mainProgram = "gopodder"; + }; +}) diff --git a/pkgs/by-name/li/libgedit-gtksourceview/package.nix b/pkgs/by-name/li/libgedit-gtksourceview/package.nix index 21cc59c282a7..2d06a69c1866 100644 --- a/pkgs/by-name/li/libgedit-gtksourceview/package.nix +++ b/pkgs/by-name/li/libgedit-gtksourceview/package.nix @@ -19,7 +19,7 @@ stdenv.mkDerivation (finalAttrs: { pname = "libgedit-gtksourceview"; - version = "299.7.0"; + version = "299.7.1"; outputs = [ "out" @@ -34,7 +34,7 @@ stdenv.mkDerivation (finalAttrs: { repo = "libgedit-gtksourceview"; tag = finalAttrs.version; forceFetchGit = true; # To avoid occasional 501 failures. - hash = "sha256-CU9EO0oHfkdWPyicmIG6eaN+wUvvkUhrb6wgNosnm2Q="; + hash = "sha256-i+6Rfqm/KPJrLSvhvTVY53Q6O+LJEU9WjLJ/L3hMSUA="; }; patches = [ diff --git a/pkgs/by-name/li/libsemanage/package.nix b/pkgs/by-name/li/libsemanage/package.nix index c0423d7ef3e5..d37f651c1a29 100644 --- a/pkgs/by-name/li/libsemanage/package.nix +++ b/pkgs/by-name/li/libsemanage/package.nix @@ -16,12 +16,12 @@ stdenv.mkDerivation (finalAttrs: { pname = "libsemanage"; - version = "3.10"; + version = "3.11"; inherit (libsepol) se_url; src = fetchurl { url = "${finalAttrs.se_url}/${finalAttrs.version}/libsemanage-${finalAttrs.version}.tar.gz"; - hash = "sha256-GXiJTEFHaa13Q40miG6q4/t7t0V47ypa0xMMictcsf4="; + hash = "sha256-52FgKGu/sIIWAsbAwyIOvPNmrTJG07nQoPvvzTXoYEM="; }; outputs = [ diff --git a/pkgs/by-name/li/listmonk/email-builder.nix b/pkgs/by-name/li/listmonk/email-builder.nix index a8c4718730e6..4b069365903e 100644 --- a/pkgs/by-name/li/listmonk/email-builder.nix +++ b/pkgs/by-name/li/listmonk/email-builder.nix @@ -17,7 +17,7 @@ stdenv.mkDerivation { offlineCache = fetchYarnDeps { yarnLock = "${src}/frontend/email-builder/yarn.lock"; - hash = "sha256-sFRmnMPStNp45hxcF+Iq1WhH6LtVFtgq2regq6MPzcc="; + hash = "sha256-ANPLOL9j0gljtNtbfb+ZifVRN9vLexPddAevpeFwX4o="; }; nativeBuildInputs = [ diff --git a/pkgs/by-name/li/listmonk/frontend.nix b/pkgs/by-name/li/listmonk/frontend.nix index 4fec2c272de4..cb82721de315 100644 --- a/pkgs/by-name/li/listmonk/frontend.nix +++ b/pkgs/by-name/li/listmonk/frontend.nix @@ -17,7 +17,7 @@ stdenv.mkDerivation (finalAttrs: { offlineCache = fetchYarnDeps { yarnLock = "${src}/frontend/yarn.lock"; - hash = "sha256-VCaEMftA7AzW/6jyceVO596iby0wC3LW9YDG66kLJmw="; + hash = "sha256-R2xHcHksTtFfFh41FLeBhpuz84ceixGt6oz6SQWWyMQ="; }; nativeBuildInputs = [ diff --git a/pkgs/by-name/li/listmonk/package.nix b/pkgs/by-name/li/listmonk/package.nix index 7fc3c88b6425..ed62aebb3996 100644 --- a/pkgs/by-name/li/listmonk/package.nix +++ b/pkgs/by-name/li/listmonk/package.nix @@ -11,16 +11,16 @@ buildGoModule (finalAttrs: { pname = "listmonk"; - version = "6.1.0"; + version = "6.2.0"; src = fetchFromGitHub { owner = "knadh"; repo = "listmonk"; rev = "v${finalAttrs.version}"; - hash = "sha256-SG9PhQOu3QB0LA9dNLnNzwwtfaib7MCfvOcBMkWMRPw="; + hash = "sha256-eora/+zJf60trmANEqAhYAQXfEMifyw5gLPKcqBW46w="; }; - vendorHash = "sha256-0KrjaExgT9tN4M99CfyQpqpGYnXOpzsPRk/Ih4qXsuE="; + vendorHash = "sha256-t4l8872bniTmNIW4ias1gImURJgrR6htXkncqfrJ+AU="; nativeBuildInputs = [ stuffbin diff --git a/pkgs/by-name/ma/mattermost/package.nix b/pkgs/by-name/ma/mattermost/package.nix index d241c440c42a..077e35239ed7 100644 --- a/pkgs/by-name/ma/mattermost/package.nix +++ b/pkgs/by-name/ma/mattermost/package.nix @@ -35,6 +35,11 @@ ... }: +assert lib.warnIf (latestVersionInfo != null && (removeUserLimit || removeFreeBadge)) '' + The user limit and free badge patches are not tested with this Mattermost version + (${latestVersionInfo.version}). +'' true; + let /* Helper function that sets the `withTests` and `withoutTests` passthru correctly, diff --git a/pkgs/by-name/ma/mattermostLatest/package.nix b/pkgs/by-name/ma/mattermostLatest/package.nix index e0fd905a82d2..e98f1f7032b5 100644 --- a/pkgs/by-name/ma/mattermostLatest/package.nix +++ b/pkgs/by-name/ma/mattermostLatest/package.nix @@ -15,10 +15,10 @@ mattermost.override ( # and make sure the version regex is up to date here. # Ensure you also check ../mattermost/package.nix for ESR releases. regex = "^v(11\\.[0-9]+\\.[0-9]+)$"; - version = "11.8.1"; - srcHash = "sha256-9EIbTwnEeZQKg5uixkMp3sp/n+9I2N9W7hxsW5juF3M="; + version = "11.8.2"; + srcHash = "sha256-XZ4yr7nbGum6UQaBjze50L8Yc/MLjo4NQBh263CNRtI="; vendorHash = "sha256-F2QMrLbio7812ZTGQZZPTqHWtIXbwbDmjUhtvv0DJ9s="; - npmDepsHash = "sha256-9GRM0VXrh1eR16ocSGEV/F2eflOflzkhrhRRnm9uB6s="; + npmDepsHash = "sha256-WIPLpi6lQvq9wieqvOACiRh7v1znxzcf+jyKXSjWzNc="; autoUpdate = ./package.nix; }; } diff --git a/pkgs/by-name/ne/neowall/package.nix b/pkgs/by-name/ne/neowall/package.nix index 597a9d694396..a962a297ce4f 100644 --- a/pkgs/by-name/ne/neowall/package.nix +++ b/pkgs/by-name/ne/neowall/package.nix @@ -18,13 +18,13 @@ stdenv.mkDerivation (finalAttrs: { pname = "neowall"; - version = "0.5.0"; + version = "0.5.1"; src = fetchFromGitHub { owner = "1ay1"; repo = "neowall"; tag = "v${finalAttrs.version}"; - hash = "sha256-hmfHcKXDmMHlFlaODo+BrbHUyx9BHn9BiCbPDp5CMG0="; + hash = "sha256-NntwAm4LmGEcAJEp9W+y0mosn+jZXwatTp4ftMqcpSo="; }; nativeBuildInputs = [ diff --git a/pkgs/by-name/ne/nerva/package.nix b/pkgs/by-name/ne/nerva/package.nix index eb5599180716..45f27e67e084 100644 --- a/pkgs/by-name/ne/nerva/package.nix +++ b/pkgs/by-name/ne/nerva/package.nix @@ -6,13 +6,13 @@ buildGoModule (finalAttrs: { pname = "nerva"; - version = "1.36.0"; + version = "1.37.0"; src = fetchFromGitHub { owner = "praetorian-inc"; repo = "nerva"; tag = "v${finalAttrs.version}"; - hash = "sha256-akGiZ5KolHOzZddgAYA3zWcFG0VSqHe6cFiB6AvRyhg="; + hash = "sha256-8naI5r/nmzQKHfub0Yv3uhx1MAh4VCSnsTY/n4BOX5U="; }; vendorHash = "sha256-Z0MSD+1/1VzrJ+pz5x0JvxrCxtJe59ckaTqHK/+TVN8="; diff --git a/pkgs/by-name/ni/nixos-render-docs/src/nixos_render_docs/html.py b/pkgs/by-name/ni/nixos-render-docs/src/nixos_render_docs/html.py index 3e4ff1aedb7a..5944431d4680 100644 --- a/pkgs/by-name/ni/nixos-render-docs/src/nixos_render_docs/html.py +++ b/pkgs/by-name/ni/nixos-render-docs/src/nixos_render_docs/html.py @@ -1,12 +1,13 @@ from collections.abc import Mapping, Sequence -from typing import cast, Optional, NamedTuple - from html import escape +from typing import NamedTuple, Optional, cast + from markdown_it.token import Token from .manual_structure import XrefTarget from .md import Renderer + class UnresolvedXrefError(Exception): pass @@ -17,9 +18,6 @@ class Heading(NamedTuple): # special handling for part content: whether partinfo div was already closed from # elsewhere or still needs closing. partintro_closed: bool - # tocs are generated when the heading opens, but have to be emitted into the file - # after the heading titlepage (and maybe partinfo) has been closed. - toc_fragment: str _bullet_list_styles = [ 'disc', 'circle', 'square' ] _ordered_list_styles = [ '1', 'a', 'i', 'A', 'I' ] @@ -29,7 +27,6 @@ class HTMLRenderer(Renderer): _headings: list[Heading] _attrspans: list[str] - _hlevel_offset: int = 0 _bullet_list_nesting: int = 0 _ordered_list_nesting: int = 0 @@ -185,8 +182,7 @@ class HTMLRenderer(Renderer): anchor = f'id="{escape(anchor, True)}"' result = self._close_headings(hlevel) tag = self._heading_tag(token, tokens, i) - toc_fragment = self._build_toc(tokens, i) - self._headings.append(Heading(tag, hlevel, htag, tag != 'part', toc_fragment)) + self._headings.append(Heading(tag, hlevel, htag, tag != 'part')) return ( f'{result}' f'
' @@ -205,8 +201,6 @@ class HTMLRenderer(Renderer): ) if heading.container_tag == 'part': result += '
' - else: - result += heading.toc_fragment return result def ordered_list_open(self, token: Token, tokens: Sequence[Token], i: int) -> str: extra = 'compact' if token.meta.get('compact', False) else '' @@ -329,14 +323,14 @@ class HTMLRenderer(Renderer): ) def _make_hN(self, level: int) -> tuple[str, str]: - return f"h{min(6, max(1, level + self._hlevel_offset))}", "" + return f"h{min(6, max(1, level))}", "" def _maybe_close_partintro(self) -> str: if self._headings: heading = self._headings[-1] if heading.container_tag == 'part' and not heading.partintro_closed: self._headings[-1] = heading._replace(partintro_closed=True) - return heading.toc_fragment + "
" + return "
" return "" def _close_headings(self, level: Optional[int]) -> str: @@ -349,5 +343,3 @@ class HTMLRenderer(Renderer): def _heading_tag(self, token: Token, tokens: Sequence[Token], i: int) -> str: return "section" - def _build_toc(self, tokens: Sequence[Token], i: int) -> str: - return "" diff --git a/pkgs/by-name/ni/nixos-render-docs/src/nixos_render_docs/manual.py b/pkgs/by-name/ni/nixos-render-docs/src/nixos_render_docs/manual.py index 9208148c594b..11d247320d68 100644 --- a/pkgs/by-name/ni/nixos-render-docs/src/nixos_render_docs/manual.py +++ b/pkgs/by-name/ni/nixos-render-docs/src/nixos_render_docs/manual.py @@ -4,21 +4,29 @@ import html import json import re import xml.sax.saxutils as xml - from abc import abstractmethod from collections.abc import Mapping, Sequence from pathlib import Path -from typing import Any, Callable, cast, ClassVar, Generic, get_args, NamedTuple +from typing import Any, Callable, ClassVar, Generic, NamedTuple, cast, get_args from markdown_it.token import Token from . import md, options from .html import HTMLRenderer, UnresolvedXrefError -from .manual_structure import check_structure, FragmentType, is_include, make_xml_id, TocEntry, TocEntryType, XrefTarget +from .manual_structure import ( + FragmentType, + TocEntry, + TocEntryType, + XrefTarget, + check_structure, + is_include, + make_xml_id, +) from .md import Converter, Renderer from .redirects import Redirects from .src_error import SrcError + class BaseConverter(Converter[md.TR], Generic[md.TR]): # per-converter configuration for ns:arg=value arguments to include blocks, following # the include type. html converters need something like this to support chunking, or @@ -253,13 +261,10 @@ class HTMLParameters(NamedTuple): generator: str stylesheets: Sequence[str] scripts: Sequence[str] - # number of levels in the rendered table of contents. tables are prepended to - # the content they apply to (entire document / document chunk / top-level section - # of a chapter), setting a depth of 0 omits the respective table. - toc_depth: int - chunk_toc_depth: int - section_toc_depth: int + # structural depth of the navigation sidebar tree + sidebar_depth: int media_dir: Path + sidebar_open: frozenset[str] = frozenset() class ManualHTMLRenderer(RendererMixin, HTMLRenderer): _base_path: Path @@ -289,14 +294,13 @@ class ManualHTMLRenderer(RendererMixin, HTMLRenderer): target_path.write_bytes(content) return f"./{self._html_params.media_dir}/{target_name}" - def _push(self, tag: str, hlevel_offset: int) -> Any: - result = (self._toplevel_tag, self._headings, self._attrspans, self._hlevel_offset, self._in_dir) - self._hlevel_offset += hlevel_offset + def _push(self, tag: str) -> Any: + result = (self._toplevel_tag, self._headings, self._attrspans, self._in_dir) self._toplevel_tag, self._headings, self._attrspans = tag, [], [] return result def _pop(self, state: Any) -> None: - (self._toplevel_tag, self._headings, self._attrspans, self._hlevel_offset, self._in_dir) = state + (self._toplevel_tag, self._headings, self._attrspans, self._in_dir) = state def _render_book(self, tokens: Sequence[Token]) -> str: assert tokens[4].children @@ -307,7 +311,7 @@ class ManualHTMLRenderer(RendererMixin, HTMLRenderer): toc = TocEntry.of(tokens[0]) return "\n".join([ - self._file_header(toc, sidebar=self._build_toc(tokens, 0)), + self._file_header(toc, sidebar=self._build_sidebar(toc)), '
', '
', '
', @@ -364,6 +368,20 @@ class ManualHTMLRenderer(RendererMixin, HTMLRenderer): file.write(self._redirects.get_redirect_script(toc.target.path)) scripts.append(f'./{redirects_name}') + # Register a close handler + # Without this the popover can still be closed by clicking outside of it + # It handles auto-closing when the user clicks a href. + close_menu_js = """ + document.addEventListener("DOMContentLoaded", () => { + const nav = document.getElementById("manual-toc"); + nav?.addEventListener("click", (e) => { + if (e.target.closest("a[href]") && nav.matches(":popover-open")) { + nav.hidePopover(); + } + }); + }); + """ + return "\n".join([ '', '' for script in scripts)), + f"", f' ', f' ' if home.target.href() else "", f' {up_link}{prev_link}{next_link}', ' ', ' ', + # See: https://developer.mozilla.org/en-US/docs/Web/API/Popover_API + # Supported by most browsers since 2023, full support since Jan 2025 + (' ') if sidebar else "", nav_html, - f' ' if sidebar else "", + f' ' if sidebar else "", '
', ]) @@ -434,103 +458,61 @@ class ManualHTMLRenderer(RendererMixin, HTMLRenderer): if token.tag == 'h1': return self._toplevel_tag return super()._heading_tag(token, tokens, i) - def _build_toc(self, tokens: Sequence[Token], i: int) -> str: - toc = TocEntry.of(tokens[i]) - if toc.kind == 'section' and self._html_params.section_toc_depth < 1: - return "" - def walk_and_emit(toc: TocEntry, depth: int) -> list[str]: - if depth <= 0: - return [] - result = [] - for child in toc.children: - result.append( - f'
' - f' ' - f' {child.target.toc_html}' - f' ' - f'
' - ) - # we want to look straight through parts because docbook-xsl did too, but it - # also makes for more uesful top-level tocs. - next_level = walk_and_emit(child, depth - (0 if child.kind == 'part' else 1)) - if next_level: - result.append(f'
{"".join(next_level)}
') - return result + def _build_sidebar(self, toc: TocEntry) -> str: + root = toc.root + def render_entries(entries: Sequence[TocEntry], budget: int) -> str: + items: list[str] = [] + for e in entries: + # 'part' are structural containers we look straight through, so + # they do not consume a depth level + child_budget = budget if e.kind == 'part' else budget - 1 + children = (render_entries(e.children, child_budget) + if e.children and child_budget > 0 else "") + link = f'{e.target.toc_html}' + cls = html.escape(e.kind, True) + if children: + open_attr = " open" if e.target.id in self._html_params.sidebar_open else "" + items.append( + f'
  • ' + f'{link}{children}' + '
  • ' + ) + else: + items.append(f'
  • {link}
  • ') + return f'
      {"".join(items)}
    ' if items else "" def build_list(kind: str, id: str, lst: Sequence[TocEntry]) -> str: if not lst: return "" - entries = [ - f'
    {i}. {e.target.toc_html}
    ' - for i, e in enumerate(lst, start=1) - ] + entries = "".join( + f'
  • {e.target.toc_html}
  • ' + for e in lst + ) return ( f'
    ' f'

    List of {kind}

    ' - f'
    {"".join(entries)}
    ' + f'
      {entries}
    ' '
    ' ) - # we don't want to generate the "Title of Contents" header for sections, - # docbook didn't and it's only distracting clutter unless it's the main table. - # we also want to generate tocs only for a top-level section (ie, one that is - # not itself contained in another section) - print_title = toc.kind != 'section' - if toc.kind == 'section': - if toc.parent and toc.parent.kind == 'section': - toc_depth = 0 - else: - toc_depth = self._html_params.section_toc_depth - elif toc.starts_new_chunk and toc.kind != 'book': - toc_depth = self._html_params.chunk_toc_depth - else: - toc_depth = self._html_params.toc_depth - if not (items := walk_and_emit(toc, toc_depth)): - return "" - figures = build_list("Figures", "list-of-figures", toc.figures) - examples = build_list("Examples", "list-of-examples", toc.examples) - return "".join([ - f'
    ', - '

    Table of Contents

    ' if print_title else "", - f'
    ' - f' {"".join(items)}' - f'
    ' - f'
    ' - f'{figures}' - f'{examples}' - ]) + nav = render_entries(root.children, self._html_params.sidebar_depth) + figures = build_list("Figures", "list-of-figures", root.figures) + examples = build_list("Examples", "list-of-examples", root.examples) + return f'{nav}{figures}{examples}' def _make_hN(self, level: int) -> tuple[str, str]: - # for some reason chapters didn't increase the hN nesting count in docbook xslts. - # originally this was duplicated here for consistency with docbook rendering, but - # it could be reevaluated and changed now that docbook is gone. - if self._toplevel_tag == 'chapter': - level -= 1 - # this style setting is also for docbook compatibility only and could well go away. - style = "" - if level + self._hlevel_offset < 3 \ - and (self._toplevel_tag == 'section' or (self._toplevel_tag == 'chapter' and level > 0)): - style = "clear: both" - tag, hstyle = super()._make_hN(max(1, level)) - return tag, style + # book heading := h1 + # Everything else is h2 ... h6 + return super()._make_hN(level + 1) def _included_thing(self, tag: str, token: Token, tokens: Sequence[Token], i: int) -> str: outer, inner = [], [] - # since books have no non-include content the toplevel book wrapper will not count - # towards nesting depth. other types will have at least a title+id heading which - # *does* count towards the nesting depth. chapters give a -1 to included sections - # mirroring the special handing in _make_hN. sigh. - hoffset = ( - 0 if not self._headings - else self._headings[-1].level - 1 if self._toplevel_tag == 'chapter' - else self._headings[-1].level - ) outer.append(self._maybe_close_partintro()) into = token.meta['include-args'].get('into-file') fragments = token.meta['included'] - state = self._push(tag, hoffset) + state = self._push(tag) if into: toc = TocEntry.of(fragments[0][0][0]) - inner.append(self._file_header(toc)) - # we do not set _hlevel_offset=0 because docbook didn't either. + # chunk pages carry the same whole-book sidebar as the main page. + inner.append(self._file_header(toc, sidebar=self._build_sidebar(toc))) else: inner = outer in_dir = self._in_dir @@ -755,21 +737,36 @@ class HTMLConverter(BaseConverter[ManualHTMLRenderer]): server_redirects_file.write("\n".join(formatted_server_redirects)) +class _DeprecatedDepthFlag(argparse.Action): + def __call__(self, parser: argparse.ArgumentParser, namespace: argparse.Namespace, + values: Any, option_string: str | None = None) -> None: + parser.error(f"{option_string} has been removed, use --sidebar-depth instead") + def _build_cli_html(p: argparse.ArgumentParser) -> None: p.add_argument('--manpage-urls', required=True) p.add_argument('--revision', required=True) p.add_argument('--generator', default='nixos-render-docs') p.add_argument('--stylesheet', default=[], action='append') p.add_argument('--script', default=[], action='append') - p.add_argument('--toc-depth', default=1, type=int) - p.add_argument('--chunk-toc-depth', default=1, type=int) - p.add_argument('--section-toc-depth', default=0, type=int) p.add_argument('--media-dir', default="media", type=Path) p.add_argument('--redirects', type=Path) + p.add_argument('--sidebar-depth', default=2, type=int) + # nav metadata (JSON): {"open": ["anchor-id", ...]} selects which sidebar + # entries render expanded; omitted or absent means everything is collapsed. + p.add_argument('--nav', type=Path) + # Deprecated flags, + p.add_argument('--toc-depth', nargs='?', action=_DeprecatedDepthFlag, default=None) + p.add_argument('--chunk-toc-depth', nargs='?', action=_DeprecatedDepthFlag, default=None) + p.add_argument('--section-toc-depth', nargs='?', action=_DeprecatedDepthFlag, default=None) + # Positional p.add_argument('infile', type=Path) p.add_argument('outfile', type=Path) def _run_cli_html(args: argparse.Namespace) -> None: + sidebar_open: frozenset[str] = frozenset() + if args.nav: + with open(args.nav) as nav_file: + sidebar_open = frozenset(json.load(nav_file).get("open", [])) with open(args.manpage_urls) as manpage_urls, open(Path(__file__).parent / "redirects.js") as redirects_script: redirects = None if args.redirects: @@ -778,8 +775,8 @@ def _run_cli_html(args: argparse.Namespace) -> None: md = HTMLConverter( args.revision, - HTMLParameters(args.generator, args.stylesheet, args.script, args.toc_depth, - args.chunk_toc_depth, args.section_toc_depth, args.media_dir), + HTMLParameters(args.generator, args.stylesheet, args.script, + args.sidebar_depth, args.media_dir, sidebar_open), json.load(manpage_urls), redirects) md.convert(args.infile, args.outfile) diff --git a/pkgs/by-name/ni/nixos-render-docs/src/tests/test_auto_id_prefix.py b/pkgs/by-name/ni/nixos-render-docs/src/tests/test_auto_id_prefix.py index 6fb706bad5ac..fce017fc70ba 100644 --- a/pkgs/by-name/ni/nixos-render-docs/src/tests/test_auto_id_prefix.py +++ b/pkgs/by-name/ni/nixos-render-docs/src/tests/test_auto_id_prefix.py @@ -10,7 +10,7 @@ def set_prefix(token: Token, ident: str) -> None: def test_auto_id_prefix_simple() -> None: - md = HTMLConverter("1.0.0", HTMLParameters("", [], [], 2, 2, 2, Path("")), {}) + md = HTMLConverter("1.0.0", HTMLParameters("", [], [], 2, Path("")), {}) src = f""" # title @@ -31,7 +31,7 @@ def test_auto_id_prefix_simple() -> None: def test_auto_id_prefix_repeated() -> None: - md = HTMLConverter("1.0.0", HTMLParameters("", [], [], 2, 2, 2, Path("")), {}) + md = HTMLConverter("1.0.0", HTMLParameters("", [], [], 2, Path("")), {}) src = f""" # title @@ -57,7 +57,7 @@ def test_auto_id_prefix_repeated() -> None: ] def test_auto_id_prefix_maximum_nested() -> None: - md = HTMLConverter("1.0.0", HTMLParameters("", [], [], 2, 2, 2, Path("")), {}) + md = HTMLConverter("1.0.0", HTMLParameters("", [], [], 2, Path("")), {}) src = f""" # h1 diff --git a/pkgs/by-name/ni/nixos-render-docs/src/tests/test_manual.py b/pkgs/by-name/ni/nixos-render-docs/src/tests/test_manual.py new file mode 100644 index 000000000000..14f7024ce186 --- /dev/null +++ b/pkgs/by-name/ni/nixos-render-docs/src/tests/test_manual.py @@ -0,0 +1,124 @@ +from pathlib import Path + +from nixos_render_docs.manual import HTMLConverter, HTMLParameters + + +def _build(tmp_path: Path, sidebar_depth: int = 2, sidebar_open: frozenset[str] = frozenset()) -> str: + (tmp_path / "part.md").write_text( + "# Build helpers {#part-builders}\n\n" # -> h2 + "```{=include=} chapters\nchapter.md\n```\n" + ) + (tmp_path / "chapter.md").write_text( + "# Fixed-point arguments {#chap-fpa}\n\n" # -> h2 + "Intro.\n\n" + "## First section {#sec-first}\n\n" # -> h3 + "Body.\n\n" + "### A subsection {#sub-a}\n\n" + "Deep.\n\n" + "#### Deeper {#d4}\n\n" + "More.\n\n" + "##### Deepest {#d5}\n\n" + "Most.\n" + ) + (tmp_path / "index.md").write_text( + "# Test manual {#book-test}\n\n" # -> h1 (book title) + "## Version 1\n\n" # -> h2 + "```{=include=} parts\npart.md\n```\n" + ) + out = tmp_path / "out" + out.mkdir(exist_ok=True) + conv = HTMLConverter( + "1.0.0", + HTMLParameters("test-gen", [], [], sidebar_depth, Path("media"), sidebar_open), + {}, + ) + conv.convert(tmp_path / "index.md", out / "index.html") + return (out / "index.html").read_text() + + +def test_single_h1_and_flat_heading_levels(tmp_path: Path) -> None: + html = _build(tmp_path) + # There should be only one h1 on an html for acessibility and semantic reasons + assert html.count("' in html + assert '

    None: + html = _build(tmp_path) + assert '