···45 else args';
4647 # TODO: deprecate args.rustc in favour of args.rust after 23.05 is EOL.
48- rust = assert !(args ? rust && args ? rustc); args.rust or args.rustc or {};
4950 final = {
51 # Prefer to parse `config` as it is strictly more informative.
···168169 # TODO: remove after 23.05 is EOL, with an error pointing to the rust.* attrs.
170 rustc = args.rustc or {};
171-172- rust = rust // {
173- # Once args.rustc.platform.target-family is deprecated and
174- # removed, there will no longer be any need to modify any
175- # values from args.rust.platform, so we can drop all the
176- # "args ? rust" etc. checks, and merge args.rust.platform in
177- # /after/.
178- platform = rust.platform or {} // {
179- # https://doc.rust-lang.org/reference/conditional-compilation.html#target_arch
180- arch =
181- /**/ if rust ? platform then rust.platform.arch
182- else if final.isAarch32 then "arm"
183- else if final.isMips64 then "mips64" # never add "el" suffix
184- else if final.isPower64 then "powerpc64" # never add "le" suffix
185- else final.parsed.cpu.name;
186-187- # https://doc.rust-lang.org/reference/conditional-compilation.html#target_os
188- os =
189- /**/ if rust ? platform then rust.platform.os or "none"
190- else if final.isDarwin then "macos"
191- else final.parsed.kernel.name;
192-193- # https://doc.rust-lang.org/reference/conditional-compilation.html#target_family
194- target-family =
195- /**/ if args ? rust.platform.target-family then args.rust.platform.target-family
196- else if args ? rustc.platform.target-family
197- then
198- (
199- # Since https://github.com/rust-lang/rust/pull/84072
200- # `target-family` is a list instead of single value.
201- let
202- f = args.rustc.platform.target-family;
203- in
204- if builtins.isList f then f else [ f ]
205- )
206- else lib.optional final.isUnix "unix"
207- ++ lib.optional final.isWindows "windows";
208-209- # https://doc.rust-lang.org/reference/conditional-compilation.html#target_vendor
210- vendor = let
211- inherit (final.parsed) vendor;
212- in rust.platform.vendor or {
213- "w64" = "pc";
214- }.${vendor.name} or vendor.name;
215- };
216-217- # The name of the rust target, even if it is custom. Adjustments are
218- # because rust has slightly different naming conventions than we do.
219- rustcTarget = let
220- inherit (final.parsed) cpu kernel abi;
221- cpu_ = rust.platform.arch or {
222- "armv7a" = "armv7";
223- "armv7l" = "armv7";
224- "armv6l" = "arm";
225- "armv5tel" = "armv5te";
226- "riscv64" = "riscv64gc";
227- }.${cpu.name} or cpu.name;
228- vendor_ = final.rust.platform.vendor;
229- in rust.config
230- or "${cpu_}-${vendor_}-${kernel.name}${lib.optionalString (abi.name != "unknown") "-${abi.name}"}";
231-232- # The name of the rust target if it is standard, or the json file
233- # containing the custom target spec.
234- rustcTargetSpec =
235- /**/ if rust ? platform
236- then builtins.toFile (final.rust.rustcTarget + ".json") (builtins.toJSON rust.platform)
237- else final.rust.rustcTarget;
238-239- # The name of the rust target if it is standard, or the
240- # basename of the file containing the custom target spec,
241- # without the .json extension.
242- #
243- # This is the name used by Cargo for target subdirectories.
244- cargoShortTarget =
245- lib.removeSuffix ".json" (baseNameOf "${final.rust.rustcTargetSpec}");
246-247- # When used as part of an environment variable name, triples are
248- # uppercased and have all hyphens replaced by underscores:
249- #
250- # https://github.com/rust-lang/cargo/pull/9169
251- # https://github.com/rust-lang/cargo/issues/8285#issuecomment-634202431
252- cargoEnvVarTarget =
253- lib.strings.replaceStrings ["-"] ["_"]
254- (lib.strings.toUpper final.rust.cargoShortTarget);
255-256- # True if the target is no_std
257- # https://github.com/rust-lang/rust/blob/2e44c17c12cec45b6a682b1e53a04ac5b5fcc9d2/src/bootstrap/config.rs#L415-L421
258- isNoStdTarget =
259- builtins.any (t: lib.hasInfix t final.rust.rustcTarget) ["-none" "nvptx" "switch" "-uefi"];
260- };
261262 linuxArch =
263 if final.isAarch32 then "arm"
···356357 }) // mapAttrs (n: v: v final.parsed) inspect.predicates
358 // mapAttrs (n: v: v final.gcc.arch or "default") architectures.predicates
359- // args;
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000360 in assert final.useAndroidPrebuilt -> final.isAndroid;
361 assert lib.foldl
362 (pass: { assertion, message }:
···45 else args';
4647 # TODO: deprecate args.rustc in favour of args.rust after 23.05 is EOL.
48+ rust = args.rust or args.rustc or {};
4950 final = {
51 # Prefer to parse `config` as it is strictly more informative.
···168169 # TODO: remove after 23.05 is EOL, with an error pointing to the rust.* attrs.
170 rustc = args.rustc or {};
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000171172 linuxArch =
173 if final.isAarch32 then "arm"
···266267 }) // mapAttrs (n: v: v final.parsed) inspect.predicates
268 // mapAttrs (n: v: v final.gcc.arch or "default") architectures.predicates
269+ // args // {
270+ rust = rust // {
271+ # Once args.rustc.platform.target-family is deprecated and
272+ # removed, there will no longer be any need to modify any
273+ # values from args.rust.platform, so we can drop all the
274+ # "args ? rust" etc. checks, and merge args.rust.platform in
275+ # /after/.
276+ platform = rust.platform or {} // {
277+ # https://doc.rust-lang.org/reference/conditional-compilation.html#target_arch
278+ arch =
279+ /**/ if rust ? platform then rust.platform.arch
280+ else if final.isAarch32 then "arm"
281+ else if final.isMips64 then "mips64" # never add "el" suffix
282+ else if final.isPower64 then "powerpc64" # never add "le" suffix
283+ else final.parsed.cpu.name;
284+285+ # https://doc.rust-lang.org/reference/conditional-compilation.html#target_os
286+ os =
287+ /**/ if rust ? platform then rust.platform.os or "none"
288+ else if final.isDarwin then "macos"
289+ else final.parsed.kernel.name;
290+291+ # https://doc.rust-lang.org/reference/conditional-compilation.html#target_family
292+ target-family =
293+ /**/ if args ? rust.platform.target-family then args.rust.platform.target-family
294+ else if args ? rustc.platform.target-family
295+ then
296+ (
297+ # Since https://github.com/rust-lang/rust/pull/84072
298+ # `target-family` is a list instead of single value.
299+ let
300+ f = args.rustc.platform.target-family;
301+ in
302+ if builtins.isList f then f else [ f ]
303+ )
304+ else lib.optional final.isUnix "unix"
305+ ++ lib.optional final.isWindows "windows";
306+307+ # https://doc.rust-lang.org/reference/conditional-compilation.html#target_vendor
308+ vendor = let
309+ inherit (final.parsed) vendor;
310+ in rust.platform.vendor or {
311+ "w64" = "pc";
312+ }.${vendor.name} or vendor.name;
313+ };
314+315+ # The name of the rust target, even if it is custom. Adjustments are
316+ # because rust has slightly different naming conventions than we do.
317+ rustcTarget = let
318+ inherit (final.parsed) cpu kernel abi;
319+ cpu_ = rust.platform.arch or {
320+ "armv7a" = "armv7";
321+ "armv7l" = "armv7";
322+ "armv6l" = "arm";
323+ "armv5tel" = "armv5te";
324+ "riscv64" = "riscv64gc";
325+ }.${cpu.name} or cpu.name;
326+ vendor_ = final.rust.platform.vendor;
327+ in rust.config
328+ or "${cpu_}-${vendor_}-${kernel.name}${lib.optionalString (abi.name != "unknown") "-${abi.name}"}";
329+330+ # The name of the rust target if it is standard, or the json file
331+ # containing the custom target spec.
332+ rustcTargetSpec = rust.rustcTargetSpec or (
333+ /**/ if rust ? platform
334+ then builtins.toFile (final.rust.rustcTarget + ".json") (builtins.toJSON rust.platform)
335+ else final.rust.rustcTarget);
336+337+ # The name of the rust target if it is standard, or the
338+ # basename of the file containing the custom target spec,
339+ # without the .json extension.
340+ #
341+ # This is the name used by Cargo for target subdirectories.
342+ cargoShortTarget =
343+ lib.removeSuffix ".json" (baseNameOf "${final.rust.rustcTargetSpec}");
344+345+ # When used as part of an environment variable name, triples are
346+ # uppercased and have all hyphens replaced by underscores:
347+ #
348+ # https://github.com/rust-lang/cargo/pull/9169
349+ # https://github.com/rust-lang/cargo/issues/8285#issuecomment-634202431
350+ cargoEnvVarTarget =
351+ lib.strings.replaceStrings ["-"] ["_"]
352+ (lib.strings.toUpper final.rust.cargoShortTarget);
353+354+ # True if the target is no_std
355+ # https://github.com/rust-lang/rust/blob/2e44c17c12cec45b6a682b1e53a04ac5b5fcc9d2/src/bootstrap/config.rs#L415-L421
356+ isNoStdTarget =
357+ builtins.any (t: lib.hasInfix t final.rust.rustcTarget) ["-none" "nvptx" "switch" "-uefi"];
358+ };
359+ };
360 in assert final.useAndroidPrebuilt -> final.isAndroid;
361 assert lib.foldl
362 (pass: { assertion, message }:
···316317- The binary of the package `cloud-sql-proxy` has changed from `cloud_sql_proxy` to `cloud-sql-proxy`.
3180000000319- Garage has been upgraded to 0.9.x. `services.garage.package` now needs to be explicitly set, so version upgrades can be done in a controlled fashion. For this, we expose `garage_x_y` attributes which can be set here.
320321- `voms` and `xrootd` now moves the `$out/etc` content to the `$etc` output instead of `$out/etc.orig`, when input argument `externalEtc` is not `null`.
322323- The `woodpecker-*` CI packages have been updated to 1.0.0. This release is wildly incompatible with the 0.15.X versions that were previously packaged. Please read [upstream's documentation](https://woodpecker-ci.org/docs/next/migrations#100) to learn how to update your CI configurations.
00324325- The Caddy module gained a new option named `services.caddy.enableReload` which is enabled by default. It allows reloading the service instead of restarting it, if only a config file has changed. This option must be disabled if you have turned off the [Caddy admin API](https://caddyserver.com/docs/caddyfile/options#admin). If you keep this option enabled, you should consider setting [`grace_period`](https://caddyserver.com/docs/caddyfile/options#grace-period) to a non-infinite value to prevent Caddy from delaying the reload indefinitely.
326
···316317- The binary of the package `cloud-sql-proxy` has changed from `cloud_sql_proxy` to `cloud-sql-proxy`.
318319+- The module `services.apache-kafka` was largely rewritten and has certain breaking changes. To be precise, this means that the following things have changed:
320+321+ - Most settings have been migrated to [services.apache-kafka.settings](#opt-services.apache-kafka.settings).
322+ - Care must be taken when adapting an existing cluster to these changes, see [](#module-services-apache-kafka-migrating-to-settings).
323+ - By virtue of being less opinionated, it is now possible to use the module to run Apache Kafka in KRaft mode instead of Zookeeper mode.
324+ - [A few options](#module-services-apache-kafka-kraft) have been added to assist in this mode.
325+326- Garage has been upgraded to 0.9.x. `services.garage.package` now needs to be explicitly set, so version upgrades can be done in a controlled fashion. For this, we expose `garage_x_y` attributes which can be set here.
327328- `voms` and `xrootd` now moves the `$out/etc` content to the `$etc` output instead of `$out/etc.orig`, when input argument `externalEtc` is not `null`.
329330- The `woodpecker-*` CI packages have been updated to 1.0.0. This release is wildly incompatible with the 0.15.X versions that were previously packaged. Please read [upstream's documentation](https://woodpecker-ci.org/docs/next/migrations#100) to learn how to update your CI configurations.
331+332+- Meilisearch was updated from 1.3.1 to 1.5.0. The update has breaking changes about backslashes and filtering. See the [release announcement](https://blog.meilisearch.com/v1-4-release/) for more information.
333334- The Caddy module gained a new option named `services.caddy.enableReload` which is enabled by default. It allows reloading the service instead of restarting it, if only a config file has changed. This option must be disabled if you have turned off the [Caddy admin API](https://caddyserver.com/docs/caddyfile/options#admin). If you keep this option enabled, you should consider setting [`grace_period`](https://caddyserver.com/docs/caddyfile/options#grace-period) to a non-infinite value to prevent Caddy from delaying the reload indefinitely.
335
···1+# Apache Kafka {#module-services-apache-kafka}
2+3+[Apache Kafka](https://kafka.apache.org/) is an open-source distributed event
4+streaming platform
5+6+## Basic Usage {#module-services-apache-kafka-basic-usage}
7+8+The Apache Kafka service is configured almost exclusively through its
9+[settings](#opt-services.apache-kafka.settings) option, with each attribute
10+corresponding to the [upstream configuration
11+manual](https://kafka.apache.org/documentation/#configuration) broker settings.
12+13+## KRaft {#module-services-apache-kafka-kraft}
14+15+Unlike in Zookeeper mode, Kafka in
16+[KRaft](https://kafka.apache.org/documentation/#kraft) mode requires each log
17+dir to be "formatted" (which means a cluster-specific a metadata file must
18+exist in each log dir)
19+20+The upstream intention is for users to execute the [storage
21+tool](https://kafka.apache.org/documentation/#kraft_storage) to achieve this,
22+but this module contains a few extra options to automate this:
23+24+- [](#opt-services.apache-kafka.clusterId)
25+- [](#opt-services.apache-kafka.formatLogDirs)
26+- [](#opt-services.apache-kafka.formatLogDirsIgnoreFormatted)
27+28+## Migrating to settings {#module-services-apache-kafka-migrating-to-settings}
29+30+Migrating a cluster to the new `settings`-based changes requires adapting removed options to the corresponding upstream settings.
31+32+This means that the upstream [Broker Configs documentation](https://kafka.apache.org/documentation/#brokerconfigs) should be followed closely.
33+34+Note that dotted options in the upstream docs do _not_ correspond to nested Nix attrsets, but instead as quoted top level `settings` attributes, as in `services.apache-kafka.settings."broker.id"`, *NOT* `services.apache-kafka.settings.broker.id`.
35+36+Care should be taken, especially when migrating clusters from the old module, to ensure that the same intended configuration is reproduced faithfully via `settings`.
37+38+To assist in the comparison, the final config can be inspected by building the config file itself, ie. with: `nix-build <nixpkgs/nixos> -A config.services.apache-kafka.configFiles.serverProperties`.
39+40+Notable changes to be aware of include:
41+42+- Removal of `services.apache-kafka.extraProperties` and `services.apache-kafka.serverProperties`
43+ - Translate using arbitrary properties using [](#opt-services.apache-kafka.settings)
44+ - [Upstream docs](https://kafka.apache.org/documentation.html#brokerconfigs)
45+ - The intention is for all broker properties to be fully representable via [](#opt-services.apache-kafka.settings).
46+ - If this is not the case, please do consider raising an issue.
47+ - Until it can be remedied, you *can* bail out by using [](#opt-services.apache-kafka.configFiles.serverProperties) to the path of a fully rendered properties file.
48+49+- Removal of `services.apache-kafka.hostname` and `services.apache-kafka.port`
50+ - Translate using: `services.apache-kafka.settings.listeners`
51+ - [Upstream docs](https://kafka.apache.org/documentation.html#brokerconfigs_listeners)
52+53+- Removal of `services.apache-kafka.logDirs`
54+ - Translate using: `services.apache-kafka.settings."log.dirs"`
55+ - [Upstream docs](https://kafka.apache.org/documentation.html#brokerconfigs_log.dirs)
56+57+- Removal of `services.apache-kafka.brokerId`
58+ - Translate using: `services.apache-kafka.settings."broker.id"`
59+ - [Upstream docs](https://kafka.apache.org/documentation.html#brokerconfigs_broker.id)
60+61+- Removal of `services.apache-kafka.zookeeper`
62+ - Translate using: `services.apache-kafka.settings."zookeeper.connect"`
63+ - [Upstream docs](https://kafka.apache.org/documentation.html#brokerconfigs_zookeeper.connect)
···66 deprecatedNativeMessagingHost = option: pkg:
67 if (cfg.${option} or false)
68 then
69- lib.warn "The cfg.${option} argument for `firefox.override` is deprecated, please add `pkgs.${pkg.pname}` to `nativeMessagingHosts` instead"
70 [pkg]
71 else [];
72
···66 deprecatedNativeMessagingHost = option: pkg:
67 if (cfg.${option} or false)
68 then
69+ lib.warn "The cfg.${option} argument for `firefox.override` is deprecated, please add `pkgs.${pkg.pname}` to `nativeMessagingHosts.packages` instead"
70 [pkg]
71 else [];
72