Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)

lib/modules: Change mkAliasOptionModule to use the priority for the alias.

This commit changes the `mkAliasOptionModule` function to make sure that
the priority for the aliased option is propagated to the non-aliased
option.

This also affects the `mkRenamedOptionModule` function in a similar
fashion.

This also removes the `mkAliasOptionModuleWithPriority` function, since
its functionality is now subsumed by `mkAliasOptionModule`.

This change was recommended by @nbp:
https://github.com/NixOS/nixpkgs/pull/53397#discussion_r245487432

+8 -14
+1 -1
lib/default.nix
··· 109 109 mkFixStrictness mkOrder mkBefore mkAfter mkAliasDefinitions 110 110 mkAliasAndWrapDefinitions fixMergeModules mkRemovedOptionModule 111 111 mkRenamedOptionModule mkMergedOptionModule mkChangedOptionModule 112 - mkAliasOptionModule mkAliasOptionModuleWithPriority doRename filterModules; 112 + mkAliasOptionModule doRename filterModules; 113 113 inherit (options) isOption mkEnableOption mkSinkUndeclaredOptions 114 114 mergeDefaultOption mergeOneOption mergeEqualOption getValues 115 115 getFiles optionAttrSetToDocList optionAttrSetToDocList'
+4 -10
lib/modules.nix
··· 609 609 610 610 forwards any definitions of boot.copyKernels to 611 611 boot.loader.grub.copyKernels while printing a warning. 612 + 613 + This also copies over the priority from the aliased option to the 614 + non-aliased option. 612 615 */ 613 616 mkRenamedOptionModule = from: to: doRename { 614 617 inherit from to; ··· 703 706 use = id; 704 707 }; 705 708 706 - /* Like ‘mkAliasOptionModule’, but copy over the priority of the option as well. */ 707 - mkAliasOptionModuleWithPriority = from: to: doRename { 708 - inherit from to; 709 - visible = true; 710 - warn = false; 711 - use = id; 712 - withPriority = true; 713 - }; 714 - 715 - doRename = { from, to, visible, warn, use, withPriority ? false }: 709 + doRename = { from, to, visible, warn, use, withPriority ? true }: 716 710 { config, options, ... }: 717 711 let 718 712 fromOpt = getAttrFromPath from options;
+1 -1
lib/tests/modules.sh
··· 149 149 # Check loaOf with many merges of lists. 150 150 checkConfigOutput "1 2 3 4 5 6 7 8 9 10" config.result ./loaOf-with-many-list-merges.nix 151 151 152 - # Check mkAliasOptionModuleWithPriority. 152 + # Check mkAliasOptionModule. 153 153 checkConfigOutput "true" config.enable ./alias-with-priority.nix 154 154 checkConfigOutput "true" config.enableAlias ./alias-with-priority.nix 155 155 checkConfigOutput "false" config.enable ./alias-with-priority-can-override.nix
+1 -1
lib/tests/modules/alias-with-priority-can-override.nix
··· 32 32 33 33 imports = [ 34 34 # Create an alias for the "enable" option. 35 - (mkAliasOptionModuleWithPriority [ "enableAlias" ] [ "enable" ]) 35 + (mkAliasOptionModule [ "enableAlias" ] [ "enable" ]) 36 36 37 37 # Disable the aliased option, but with a default (low) priority so it 38 38 # should be able to be overridden by the next import.
+1 -1
lib/tests/modules/alias-with-priority.nix
··· 32 32 33 33 imports = [ 34 34 # Create an alias for the "enable" option. 35 - (mkAliasOptionModuleWithPriority [ "enableAlias" ] [ "enable" ]) 35 + (mkAliasOptionModule [ "enableAlias" ] [ "enable" ]) 36 36 37 37 # Disable the aliased option, but with a default (low) priority so it 38 38 # should be able to be overridden by the next import.