diff options
author | github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> | 2023-02-26 06:02:30 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-02-26 06:02:30 +0000 |
commit | de3f71e277b751bdaa9458d83e9e67227ef54206 (patch) | |
tree | d5a8a6a0ef99d9ef8c8859bd668f45bb1108638f /nixos | |
parent | 9bb986284ff5c8b18aae1ec0979b87c23dc2ac44 (diff) | |
parent | 399e2c78d4610a50f7c74ff4b17fecd0b782ba2a (diff) | |
download | nixlib-de3f71e277b751bdaa9458d83e9e67227ef54206.tar nixlib-de3f71e277b751bdaa9458d83e9e67227ef54206.tar.gz nixlib-de3f71e277b751bdaa9458d83e9e67227ef54206.tar.bz2 nixlib-de3f71e277b751bdaa9458d83e9e67227ef54206.tar.lz nixlib-de3f71e277b751bdaa9458d83e9e67227ef54206.tar.xz nixlib-de3f71e277b751bdaa9458d83e9e67227ef54206.tar.zst nixlib-de3f71e277b751bdaa9458d83e9e67227ef54206.zip |
Merge staging-next into staging
Diffstat (limited to 'nixos')
-rw-r--r-- | nixos/doc/manual/development/option-declarations.section.md | 34 | ||||
-rw-r--r-- | nixos/modules/security/polkit.nix | 4 | ||||
-rw-r--r-- | nixos/modules/system/boot/systemd/coredump.nix | 2 |
3 files changed, 35 insertions, 5 deletions
diff --git a/nixos/doc/manual/development/option-declarations.section.md b/nixos/doc/manual/development/option-declarations.section.md index 59470bf1bc11..f6fed3e16837 100644 --- a/nixos/doc/manual/development/option-declarations.section.md +++ b/nixos/doc/manual/development/option-declarations.section.md @@ -101,11 +101,24 @@ Creates an Option attribute set for an option that specifies the package a modul **Note**: You shouldn’t necessarily make package options for all of your modules. You can always overwrite a specific package throughout nixpkgs by using [nixpkgs overlays](https://nixos.org/manual/nixpkgs/stable/#chap-overlays). -The default package is specified as a list of strings representing its attribute path in nixpkgs. Because of this, you need to pass nixpkgs itself as the first argument. +The package is specified in the third argument under `default` as a list of strings +representing its attribute path in nixpkgs (or another package set). +Because of this, you need to pass nixpkgs itself (or a subset) as the first argument. -The second argument is the name of the option, used in the description "The \<name\> package to use.". You can also pass an example value, either a literal string or a package's attribute path. +The second argument may be either a string or a list of strings. +It provides the display name of the package in the description of the generated option +(using only the last element if the passed value is a list) +and serves as the fallback value for the `default` argument. -You can omit the default path if the name of the option is also attribute path in nixpkgs. +To include extra information in the description, pass `extraDescription` to +append arbitrary text to the generated description. +You can also pass an `example` value, either a literal string or an attribute path. + +The default argument can be omitted if the provided name is +an attribute of pkgs (if name is a string) or a +valid attribute path in pkgs (if name is a list). + +If you wish to explicitly provide no default, pass `null` as `default`. During the transition to CommonMark documentation `mkPackageOption` creates an option with a DocBook description attribute, once the transition is completed it will create a CommonMark description instead. `mkPackageOptionMD` always creates an option with a CommonMark description attribute and will be removed some time after the transition is completed. @@ -142,6 +155,21 @@ lib.mkOption { ``` ::: +::: {#ex-options-declarations-util-mkPackageOption-extraDescription .example} +```nix +mkPackageOption pkgs [ "python39Packages" "pytorch" ] { + extraDescription = "This is an example and doesn't actually do anything."; +} +# is like +lib.mkOption { + type = lib.types.package; + default = pkgs.python39Packages.pytorch; + defaultText = lib.literalExpression "pkgs.python39Packages.pytorch"; + description = "The pytorch package to use. This is an example and doesn't actually do anything."; +} +``` +::: + ## Extensible Option Types {#sec-option-declarations-eot} Extensible option types is a feature that allow to extend certain types diff --git a/nixos/modules/security/polkit.nix b/nixos/modules/security/polkit.nix index 903bbbcab072..1b6594802277 100644 --- a/nixos/modules/security/polkit.nix +++ b/nixos/modules/security/polkit.nix @@ -113,7 +113,9 @@ in group = "polkituser"; }; - users.groups.polkituser.gid = config.ids.gids.polkituser; + users.groups.polkituser = { + gid = mkIf (lib.versionAtLeast config.system.stateVersion "23.05") config.ids.gids.polkituser; + }; }; } diff --git a/nixos/modules/system/boot/systemd/coredump.nix b/nixos/modules/system/boot/systemd/coredump.nix index 2dbc95e38ee3..deaaba9bbf85 100644 --- a/nixos/modules/system/boot/systemd/coredump.nix +++ b/nixos/modules/system/boot/systemd/coredump.nix @@ -67,7 +67,7 @@ in { group = "systemd-coredump"; }; users.groups.systemd-coredump = { - gid = config.ids.gids.systemd-coredump; + gid = mkIf (lib.versionAtLeast config.system.stateVersion "23.05") config.ids.gids.systemd-coredump; }; }) |