Home Explore Blog CI



nixpkgs

25th chunk of `nixos/doc/manual/release-notes/rl-2311.section.md`
425fa6c825b523ccc3e2f75118e4cc317590693a53d5770d0000000100000ee7
  [`toDconfINI`](https://nixos.org/manual/nixpkgs/stable#function-library-lib.generators.toDconfINI).

  `lib.generators.toKeyValue` now supports the `indent` attribute in its first
  argument.
- [`lib.lists`](https://nixos.org/manual/nixpkgs/stable#sec-functions-library-lists):
  New functions:
  [`findFirstIndex`](https://nixos.org/manual/nixpkgs/stable#function-library-lib.lists.findFirstIndex),
  [`hasPrefix`](https://nixos.org/manual/nixpkgs/stable#function-library-lib.lists.hasPrefix),
  [`removePrefix`](https://nixos.org/manual/nixpkgs/stable#function-library-lib.lists.removePrefix),
  [`commonPrefix`](https://nixos.org/manual/nixpkgs/stable#function-library-lib.lists.commonPrefix),
  [`allUnique`](https://nixos.org/manual/nixpkgs/stable#function-library-lib.lists.allUnique).

  Documentation improvements for
  [`lib.lists.foldl'`](https://nixos.org/manual/nixpkgs/stable#function-library-lib.lists.foldl-prime).
- [`lib.meta`](https://nixos.org/manual/nixpkgs/stable#sec-functions-library-meta):
  Documentation of functions now gets rendered
- [`lib.path`](https://nixos.org/manual/nixpkgs/stable#sec-functions-library-path):
  New functions:
  [`hasPrefix`](https://nixos.org/manual/nixpkgs/stable#function-library-lib.path.hasPrefix),
  [`removePrefix`](https://nixos.org/manual/nixpkgs/stable#function-library-lib.path.removePrefix),
  [`splitRoot`](https://nixos.org/manual/nixpkgs/stable#function-library-lib.path.splitRoot),
  [`subpath.components`](https://nixos.org/manual/nixpkgs/stable#function-library-lib.path.subpath.components).
- [`lib.strings`](https://nixos.org/manual/nixpkgs/stable#sec-functions-library-strings):
  New functions:
  [`replicate`](https://nixos.org/manual/nixpkgs/stable#function-library-lib.strings.replicate),
  [`cmakeOptionType`](https://nixos.org/manual/nixpkgs/stable#function-library-lib.strings.cmakeOptionType),
  [`cmakeBool`](https://nixos.org/manual/nixpkgs/stable#function-library-lib.strings.cmakeBool),
  [`cmakeFeature`](https://nixos.org/manual/nixpkgs/stable#function-library-lib.strings.cmakeFeature).
- [`lib.trivial`](https://nixos.org/manual/nixpkgs/stable#sec-functions-library-trivial):
  New function:
  [`mirrorFunctionArgs`](https://nixos.org/manual/nixpkgs/stable#function-library-lib.trivial.mirrorFunctionArgs).
- `lib.systems`: New function:
  [`equals`](https://nixos.org/manual/nixpkgs/stable#function-library-lib.systems.equals).
- [`lib.options`](https://nixos.org/manual/nixpkgs/stable#sec-functions-library-options):
  Improved documentation for
  [`mkPackageOption`](https://nixos.org/manual/nixpkgs/stable#function-library-lib.options.mkPackageOption).

  [`mkPackageOption`](https://nixos.org/manual/nixpkgs/stable#function-library-lib.options.mkPackageOption).
  now also supports the `pkgsText` attribute.

Module system:
- Options in the `options` module argument now have the `declarationPositions`
  attribute containing the position where the option was declared:
  ```
  $ nix-repl -f '<nixpkgs/nixos>' [...]
  nix-repl> :p options.environment.systemPackages.declarationPositions
  [ {
    column = 7;
    file = "/nix/store/vm9zf9wvfd628cchj0hdij1g4hzjrcz9-source/nixos/modules/config/system-path.nix";
    line = 62;
  } ]
  ```

  Not to be confused with `definitionsWithLocations`, which is the same but for option _definitions_.
- Improved error message for option declarations missing `mkOption`

### Deprecations {#sec-release-23.11-lib-deprecations}

- `lib.meta.getExe pkg` (also available as `lib.getExe`) now gives a warning if
  `pkg.meta.mainProgram` is not set, but it continues to default to the
  derivation name. Nixpkgs accepts PRs that set `meta.mainProgram` on packages
  where it makes sense. Use `lib.getExe' pkg "some-command"` to avoid the
  warning and/or select a different executable.

Title: Nixpkgs Library Updates: meta, path, strings, trivial, systems, options, Module system improvements, and Deprecations
Summary
This section details updates to various Nixpkgs libraries. `lib.generators.toKeyValue` now supports the `indent` attribute. New functions are added to `lib.lists`: `findFirstIndex`, `hasPrefix`, `removePrefix`, `commonPrefix`, and `allUnique`. Documentation rendering is improved for `lib.meta`. `lib.path` gains `hasPrefix`, `removePrefix`, `splitRoot`, and `subpath.components`. `lib.strings` introduces `replicate`, `cmakeOptionType`, `cmakeBool`, and `cmakeFeature`. `lib.trivial` adds `mirrorFunctionArgs`. `lib.systems` includes `equals`. `lib.options` sees documentation improvements for `mkPackageOption`, which also supports `pkgsText`. Module system options now have `declarationPositions`. The error message for missing `mkOption` in option declarations is improved. Finally, `lib.meta.getExe` now warns if `pkg.meta.mainProgram` is unset, suggesting setting it or using `lib.getExe'`.