treewide: convert package options to use mkPackageOption (#7116)

This commit converts `package = mkOption` declarations throughout the
codebase to use the more modern and consistent `lib.mkPackageOption`
function.

Key changes:
- Simple package options: `mkOption { type = types.package; default = pkgs.foo; }`
  becomes `lib.mkPackageOption pkgs "foo" { }`
- Package set options: Uses correct package set as first argument with
  `pkgsText` parameter (e.g., `lib.mkPackageOption pkgs.vimPlugins "plugin" { pkgsText = "pkgs.vimPlugins"; }`)
- Removes redundant descriptions that just restate the package name
- Preserves examples and extra context where meaningful
- Handles submodule plugin options properly with `null` defaults

This modernizes the option declarations and makes them more consistent
with current nixpkgs patterns while maintaining full backward compatibility.

Signed-off-by: Austin Horstman <khaneliman12@gmail.com>
This commit is contained in:
Austin Horstman 2025-05-23 00:42:38 -05:00 committed by GitHub
parent a868570581
commit 7419250703
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
59 changed files with 93 additions and 383 deletions

View file

@ -27,13 +27,7 @@ in
{
options.programs.lutris = {
enable = mkEnableOption "lutris.";
package = mkOption {
default = pkgs.lutris;
description = ''
The lutris package to use.
'';
type = types.package;
};
package = lib.mkPackageOption pkgs "lutris" { };
steamPackage = mkOption {
default = null;
example = "pkgs.steam or osConfig.programs.steam.package";

View file

@ -48,9 +48,10 @@ let
description = "Don't load by default (load with :packadd)";
};
plugin = mkOption {
type = types.package;
description = "vim plugin";
plugin = lib.mkPackageOption pkgs.vimPlugins "plugin" {
default = null;
example = "pkgs.vimPlugins.nvim-treesitter";
pkgsText = "pkgs.vimPlugins";
};
runtime = mkOption {

View file

@ -19,9 +19,11 @@ let
pluginModule = types.submodule {
options = {
plugin = mkOption {
type = types.package;
description = "Path of the configuration file to include.";
plugin = lib.mkPackageOption pkgs.tmuxPlugins "plugin" {
example = "pkgs.tmuxPlugins.sensible";
default = null;
pkgsText = "pkgs.tmuxPlugins";
extraDescription = "Path of the configuration file to include.";
};
extraConfig = mkOption {

View file

@ -152,12 +152,9 @@ in
readOnly = true;
};
packageConfigurable = mkOption {
type = types.package;
description = "Vim package to customize";
default = pkgs.vim-full or pkgs.vim_configurable;
defaultText = literalExpression "pkgs.vim-full";
example = literalExpression "pkgs.vim";
packageConfigurable = lib.mkPackageOption pkgs "vim-full" {
extraDescription = "Vim package to customize";
example = "pkgs.vim";
};
defaultEditor = mkOption {