···159159 "/run/opengl-driver/share/vulkan/icd.d/radeon_icd.x86_64.json";
160160```
161161162162+## VA-API {#sec-gpu-accel-va-api}
163163+164164+[VA-API (Video Acceleration API)](https://www.intel.com/content/www/us/en/developer/articles/technical/linuxmedia-vaapi.html)
165165+is an open-source library and API specification, which provides access to
166166+graphics hardware acceleration capabilities for video processing.
167167+168168+VA-API drivers are loaded by `libva`. The version in nixpkgs is built to search
169169+the opengl driver path, so drivers can be installed in
170170+[](#opt-hardware.opengl.extraPackages).
171171+172172+VA-API can be tested using:
173173+174174+```ShellSession
175175+$ nix-shell -p libva-utils --run vainfo
176176+```
177177+178178+### Intel {#sec-gpu-accel-va-api-intel}
179179+180180+Modern Intel GPUs use the iHD driver, which can be installed with:
181181+182182+```nix
183183+hardware.opengl.extraPackages = [
184184+ intel-media-driver
185185+];
186186+```
187187+188188+Older Intel GPUs use the i965 driver, which can be installed with:
189189+190190+```nix
191191+hardware.opengl.extraPackages = [
192192+ vaapiIntel
193193+];
194194+```
195195+162196## Common issues {#sec-gpu-accel-common-issues}
163197164198### User permissions {#sec-gpu-accel-common-issues-permissions}
+36
nixos/doc/manual/development/bootspec.chapter.md
···11+# Experimental feature: Bootspec {#sec-experimental-bootspec}
22+33+Bootspec is a experimental feature, introduced in the [RFC-0125 proposal](https://github.com/NixOS/rfcs/pull/125), the reference implementation can be found [there](https://github.com/NixOS/nixpkgs/pull/172237) in order to standardize bootloader support
44+and advanced boot workflows such as SecureBoot and potentially more.
55+66+You can enable the creation of bootspec documents through [`boot.bootspec.enable = true`](options.html#opt-boot.bootspec.enable), which will prompt a warning until [RFC-0125](https://github.com/NixOS/rfcs/pull/125) is officially merged.
77+88+## Schema {#sec-experimental-bootspec-schema}
99+1010+The bootspec schema is versioned and validated against [a CUE schema file](https://cuelang.org/) which should considered as the source of truth for your applications.
1111+1212+You will find the current version [here](../../../modules/system/activation/bootspec.cue).
1313+1414+## Extensions mechanism {#sec-experimental-bootspec-extensions}
1515+1616+Bootspec cannot account for all usecases.
1717+1818+For this purpose, Bootspec offers a generic extension facility [`boot.bootspec.extensions`](options.html#opt-boot.bootspec.extensions) which can be used to inject any data needed for your usecases.
1919+2020+An example for SecureBoot is to get the Nix store path to `/etc/os-release` in order to bake it into a unified kernel image:
2121+2222+```nix
2323+{ config, lib, ... }: {
2424+ boot.bootspec.extensions = {
2525+ "org.secureboot.osRelease" = config.environment.etc."os-release".source;
2626+ };
2727+}
2828+```
2929+3030+To reduce incompatibility and prevent names from clashing between applications, it is **highly recommended** to use a unique namespace for your extensions.
3131+3232+## External bootloaders {#sec-experimental-bootspec-external-bootloaders}
3333+3434+It is possible to enable your own bootloader through [`boot.loader.external.installHook`](options.html#opt-boot.loader.external.installHook) which can wrap an existing bootloader.
3535+3636+Currently, there is no good story to compose existing bootloaders to enrich their features, e.g. SecureBoot, etc. It will be necessary to reimplement or reuse existing parts.
···180180</programlisting>
181181 </section>
182182 </section>
183183+ <section xml:id="sec-gpu-accel-va-api">
184184+ <title>VA-API</title>
185185+ <para>
186186+ <link xlink:href="https://www.intel.com/content/www/us/en/developer/articles/technical/linuxmedia-vaapi.html">VA-API
187187+ (Video Acceleration API)</link> is an open-source library and API
188188+ specification, which provides access to graphics hardware
189189+ acceleration capabilities for video processing.
190190+ </para>
191191+ <para>
192192+ VA-API drivers are loaded by <literal>libva</literal>. The version
193193+ in nixpkgs is built to search the opengl driver path, so drivers
194194+ can be installed in
195195+ <xref linkend="opt-hardware.opengl.extraPackages" />.
196196+ </para>
197197+ <para>
198198+ VA-API can be tested using:
199199+ </para>
200200+ <programlisting>
201201+$ nix-shell -p libva-utils --run vainfo
202202+</programlisting>
203203+ <section xml:id="sec-gpu-accel-va-api-intel">
204204+ <title>Intel</title>
205205+ <para>
206206+ Modern Intel GPUs use the iHD driver, which can be installed
207207+ with:
208208+ </para>
209209+ <programlisting language="bash">
210210+hardware.opengl.extraPackages = [
211211+ intel-media-driver
212212+];
213213+</programlisting>
214214+ <para>
215215+ Older Intel GPUs use the i965 driver, which can be installed
216216+ with:
217217+ </para>
218218+ <programlisting language="bash">
219219+hardware.opengl.extraPackages = [
220220+ vaapiIntel
221221+];
222222+</programlisting>
223223+ </section>
224224+ </section>
183225 <section xml:id="sec-gpu-accel-common-issues">
184226 <title>Common issues</title>
185227 <section xml:id="sec-gpu-accel-common-issues-permissions">
···11+<chapter xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xml:id="sec-experimental-bootspec">
22+ <title>Experimental feature: Bootspec</title>
33+ <para>
44+ Bootspec is a experimental feature, introduced in the
55+ <link xlink:href="https://github.com/NixOS/rfcs/pull/125">RFC-0125
66+ proposal</link>, the reference implementation can be found
77+ <link xlink:href="https://github.com/NixOS/nixpkgs/pull/172237">there</link>
88+ in order to standardize bootloader support and advanced boot
99+ workflows such as SecureBoot and potentially more.
1010+ </para>
1111+ <para>
1212+ You can enable the creation of bootspec documents through
1313+ <link xlink:href="options.html#opt-boot.bootspec.enable"><literal>boot.bootspec.enable = true</literal></link>,
1414+ which will prompt a warning until
1515+ <link xlink:href="https://github.com/NixOS/rfcs/pull/125">RFC-0125</link>
1616+ is officially merged.
1717+ </para>
1818+ <section xml:id="sec-experimental-bootspec-schema">
1919+ <title>Schema</title>
2020+ <para>
2121+ The bootspec schema is versioned and validated against
2222+ <link xlink:href="https://cuelang.org/">a CUE schema file</link>
2323+ which should considered as the source of truth for your
2424+ applications.
2525+ </para>
2626+ <para>
2727+ You will find the current version
2828+ <link xlink:href="../../../modules/system/activation/bootspec.cue">here</link>.
2929+ </para>
3030+ </section>
3131+ <section xml:id="sec-experimental-bootspec-extensions">
3232+ <title>Extensions mechanism</title>
3333+ <para>
3434+ Bootspec cannot account for all usecases.
3535+ </para>
3636+ <para>
3737+ For this purpose, Bootspec offers a generic extension facility
3838+ <link xlink:href="options.html#opt-boot.bootspec.extensions"><literal>boot.bootspec.extensions</literal></link>
3939+ which can be used to inject any data needed for your usecases.
4040+ </para>
4141+ <para>
4242+ An example for SecureBoot is to get the Nix store path to
4343+ <literal>/etc/os-release</literal> in order to bake it into a
4444+ unified kernel image:
4545+ </para>
4646+ <programlisting language="bash">
4747+{ config, lib, ... }: {
4848+ boot.bootspec.extensions = {
4949+ "org.secureboot.osRelease" = config.environment.etc."os-release".source;
5050+ };
5151+}
5252+</programlisting>
5353+ <para>
5454+ To reduce incompatibility and prevent names from clashing between
5555+ applications, it is <emphasis role="strong">highly
5656+ recommended</emphasis> to use a unique namespace for your
5757+ extensions.
5858+ </para>
5959+ </section>
6060+ <section xml:id="sec-experimental-bootspec-external-bootloaders">
6161+ <title>External bootloaders</title>
6262+ <para>
6363+ It is possible to enable your own bootloader through
6464+ <link xlink:href="options.html#opt-boot.loader.external.installHook"><literal>boot.loader.external.installHook</literal></link>
6565+ which can wrap an existing bootloader.
6666+ </para>
6767+ <para>
6868+ Currently, there is no good story to compose existing bootloaders
6969+ to enrich their features, e.g. SecureBoot, etc. It will be
7070+ necessary to reimplement or reuse existing parts.
7171+ </para>
7272+ </section>
7373+</chapter>
···11+# Note that these schemas are defined by RFC-0125.
22+# This document is considered a stable API, and is depended upon by external tooling.
33+# Changes to the structure of the document, or the semantics of the values should go through an RFC.
44+#
55+# See: https://github.com/NixOS/rfcs/pull/125
66+{ config
77+, pkgs
88+, lib
99+, ...
1010+}:
1111+let
1212+ cfg = config.boot.bootspec;
1313+ children = lib.mapAttrs (childName: childConfig: childConfig.configuration.system.build.toplevel) config.specialisation;
1414+ schemas = {
1515+ v1 = rec {
1616+ filename = "boot.json";
1717+ json =
1818+ pkgs.writeText filename
1919+ (builtins.toJSON
2020+ {
2121+ v1 = {
2222+ kernel = "${config.boot.kernelPackages.kernel}/${config.system.boot.loader.kernelFile}";
2323+ kernelParams = config.boot.kernelParams;
2424+ initrd = "${config.system.build.initialRamdisk}/${config.system.boot.loader.initrdFile}";
2525+ initrdSecrets = "${config.system.build.initialRamdiskSecretAppender}/bin/append-initrd-secrets";
2626+ label = "NixOS ${config.system.nixos.codeName} ${config.system.nixos.label} (Linux ${config.boot.kernelPackages.kernel.modDirVersion})";
2727+2828+ inherit (cfg) extensions;
2929+ };
3030+ });
3131+3232+ generator =
3333+ let
3434+ # NOTE: Be careful to not introduce excess newlines at the end of the
3535+ # injectors, as that may affect the pipes and redirects.
3636+3737+ # Inject toplevel and init into the bootspec.
3838+ # This can only be done here because we *cannot* depend on $out
3939+ # referring to the toplevel, except by living in the toplevel itself.
4040+ toplevelInjector = lib.escapeShellArgs [
4141+ "${pkgs.jq}/bin/jq"
4242+ ''
4343+ .v1.toplevel = $toplevel |
4444+ .v1.init = $init
4545+ ''
4646+ "--sort-keys"
4747+ "--arg" "toplevel" "${placeholder "out"}"
4848+ "--arg" "init" "${placeholder "out"}/init"
4949+ ] + " < ${json}";
5050+5151+ # We slurp all specialisations and inject them as values, such that
5252+ # `.specialisations.${name}` embeds the specialisation's bootspec
5353+ # document.
5454+ specialisationInjector =
5555+ let
5656+ specialisationLoader = (lib.mapAttrsToList
5757+ (childName: childToplevel: lib.escapeShellArgs [ "--slurpfile" childName "${childToplevel}/bootspec/${filename}" ])
5858+ children);
5959+ in
6060+ lib.escapeShellArgs [
6161+ "${pkgs.jq}/bin/jq"
6262+ "--sort-keys"
6363+ ".v1.specialisation = ($ARGS.named | map_values(. | first | .v1))"
6464+ ] + " ${lib.concatStringsSep " " specialisationLoader}";
6565+ in
6666+ ''
6767+ mkdir -p $out/bootspec
6868+6969+ ${toplevelInjector} | ${specialisationInjector} > $out/bootspec/${filename}
7070+ '';
7171+7272+ validator = pkgs.writeCueValidator ./bootspec.cue {
7373+ document = "Document"; # Universal validator for any version as long the schema is correctly set.
7474+ };
7575+ };
7676+ };
7777+in
7878+{
7979+ options.boot.bootspec = {
8080+ enable = lib.mkEnableOption (lib.mdDoc "Enable generation of RFC-0125 bootspec in $system/bootspec, e.g. /run/current-system/bootspec");
8181+8282+ extensions = lib.mkOption {
8383+ type = lib.types.attrs;
8484+ default = { };
8585+ description = lib.mdDoc ''
8686+ User-defined data that extends the bootspec document.
8787+8888+ To reduce incompatibility and prevent names from clashing
8989+ between applications, it is **highly recommended** to use a
9090+ unique namespace for your extensions.
9191+ '';
9292+ };
9393+9494+ # This will be run as a part of the `systemBuilder` in ./top-level.nix. This
9595+ # means `$out` points to the output of `config.system.build.toplevel` and can
9696+ # be used for a variety of things (though, for now, it's only used to report
9797+ # the path of the `toplevel` itself and the `init` executable).
9898+ writer = lib.mkOption {
9999+ internal = true;
100100+ default = schemas.v1.generator;
101101+ };
102102+103103+ validator = lib.mkOption {
104104+ internal = true;
105105+ default = schemas.v1.validator;
106106+ };
107107+108108+ filename = lib.mkOption {
109109+ internal = true;
110110+ default = schemas.v1.filename;
111111+ };
112112+ };
113113+114114+ config = lib.mkIf (cfg.enable) {
115115+ warnings = [
116116+ ''RFC-0125 is not merged yet, this is a feature preview of bootspec.
117117+ The schema is not definitive and features are not guaranteed to be stable until RFC-0125 is merged.
118118+ See:
119119+ - https://github.com/NixOS/nixpkgs/pull/172237 to track merge status in nixpkgs.
120120+ - https://github.com/NixOS/rfcs/pull/125 to track RFC status.
121121+ ''
122122+ ];
123123+ };
124124+}
···11+# External Bootloader Backends {#sec-bootloader-external}
22+33+NixOS has support for several bootloader backends by default: systemd-boot, grub, uboot, etc.
44+The built-in bootloader backend support is generic and supports most use cases.
55+Some users may prefer to create advanced workflows around managing the bootloader and bootable entries.
66+77+You can replace the built-in bootloader support with your own tooling using the "external" bootloader option.
88+99+Imagine you have created a new package called FooBoot.
1010+FooBoot provides a program at `${pkgs.fooboot}/bin/fooboot-install` which takes the system closure's path as its only argument and configures the system's bootloader.
1111+1212+You can enable FooBoot like this:
1313+1414+```nix
1515+{ pkgs, ... }: {
1616+ boot.loader.external = {
1717+ enable = true;
1818+ installHook = "${pkgs.fooboot}/bin/fooboot-install";
1919+ };
2020+}
2121+```
2222+2323+## Developing Custom Bootloader Backends
2424+2525+Bootloaders should use [RFC-0125](https://github.com/NixOS/rfcs/pull/125)'s Bootspec format and synthesis tools to identify the key properties for bootable system generations.
2626+
···11+<chapter xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xml:id="sec-bootloader-external">
22+ <title>External Bootloader Backends</title>
33+ <para>
44+ NixOS has support for several bootloader backends by default:
55+ systemd-boot, grub, uboot, etc. The built-in bootloader backend
66+ support is generic and supports most use cases. Some users may
77+ prefer to create advanced workflows around managing the bootloader
88+ and bootable entries.
99+ </para>
1010+ <para>
1111+ You can replace the built-in bootloader support with your own
1212+ tooling using the <quote>external</quote> bootloader option.
1313+ </para>
1414+ <para>
1515+ Imagine you have created a new package called FooBoot. FooBoot
1616+ provides a program at
1717+ <literal>${pkgs.fooboot}/bin/fooboot-install</literal> which takes
1818+ the system closure’s path as its only argument and configures the
1919+ system’s bootloader.
2020+ </para>
2121+ <para>
2222+ You can enable FooBoot like this:
2323+ </para>
2424+ <programlisting language="nix">
2525+{ pkgs, ... }: {
2626+ boot.loader.external = {
2727+ enable = true;
2828+ installHook = "${pkgs.fooboot}/bin/fooboot-install";
2929+ };
3030+}
3131+</programlisting>
3232+ <section xml:id="developing-custom-bootloader-backends">
3333+ <title>Developing Custom Bootloader Backends</title>
3434+ <para>
3535+ Bootloaders should use
3636+ <link xlink:href="https://github.com/NixOS/rfcs/pull/125">RFC-0125</link>’s
3737+ Bootspec format and synthesis tools to identify the key properties
3838+ for bootable system generations.
3939+ </para>
4040+ </section>
4141+</chapter>
···6060 # only an issue with the useLLVM stdenv, not the darwin stdenv…
6161 # https://github.com/grpc/grpc/issues/26473#issuecomment-860885484
6262 useLLVMAndOldCC = (stdenv.hostPlatform.useLLVM or false) && lib.versionOlder stdenv.cc.cc.version "11.0";
6363- cxxStandard = if useLLVMAndOldCC then "11" else "17";
6363+ # With GCC 9 (current aarch64-linux) it fails with c++17 but OK with c++14.
6464+ useOldGCC = !(stdenv.hostPlatform.useLLVM or false) && lib.versionOlder stdenv.cc.cc.version "10";
6565+ cxxStandard = if useLLVMAndOldCC then "11" else if useOldGCC then "14" else "17";
6466 in
6567 [
6668 "-DgRPC_ZLIB_PROVIDER=package"
···3232 perl scripts/config.pl set MBEDTLS_THREADING_PTHREAD # POSIX thread wrapper layer for the threading layer.
3333 '';
34343535- cmakeFlags = [ "-DUSE_SHARED_MBEDTLS_LIBRARY=on" ];
3636- NIX_CFLAGS_COMPILE = lib.optionals stdenv.cc.isGNU [
3737- "-Wno-error=format"
3838- "-Wno-error=format-truncation"
3535+ cmakeFlags = [
3636+ "-DUSE_SHARED_MBEDTLS_LIBRARY=on"
3737+3838+ # Avoid a dependency on jsonschema and jinja2 by not generating source code
3939+ # using python. In releases, these generated files are already present in
4040+ # the repository and do not need to be regenerated. See:
4141+ # https://github.com/Mbed-TLS/mbedtls/releases/tag/v3.3.0 below "Requirement changes".
4242+ "-DGEN_FILES=off"
3943 ];
40444145 meta = with lib; {
···7788stdenv.mkDerivation rec {
99 pname = "adguardhome";
1010- version = "0.107.20";
1010+ version = "0.107.21";
1111 src = sources.${system} or (throw "Source for ${pname} is not available for ${system}");
12121313 installPhase = ''