mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-12-13 17:23:08 +00:00
4f0dadbf38
After final improvements to the official formatter implementation, this commit now performs the first treewide reformat of Nix files using it. This is part of the implementation of RFC 166. Only "inactive" files are reformatted, meaning only files that aren't being touched by any PR with activity in the past 2 months. This is to avoid conflicts for PRs that might soon be merged. Later we can do a full treewide reformat to get the rest, which should not cause as many conflicts. A CI check has already been running for some time to ensure that new and already-formatted files are formatted, so the files being reformatted here should also stay formatted. This commit was automatically created and can be verified using nix-builda08b3a4d19
.tar.gz \ --argstr baseRevb32a094368
result/bin/apply-formatting $NIXPKGS_PATH
65 lines
1.4 KiB
Nix
65 lines
1.4 KiB
Nix
# This is a test to show that mkAliasOptionModule sets the priority correctly
|
|
# for aliased options.
|
|
#
|
|
# This test shows that an alias with a low priority is able to be overridden
|
|
# with a non-aliased option.
|
|
|
|
{ config, lib, ... }:
|
|
|
|
let
|
|
inherit (lib)
|
|
mkAliasOptionModule
|
|
mkDefault
|
|
mkOption
|
|
types
|
|
;
|
|
in
|
|
|
|
{
|
|
options = {
|
|
# A simple boolean option that can be enabled or disabled.
|
|
enable = mkOption {
|
|
type = types.nullOr types.bool;
|
|
default = null;
|
|
example = true;
|
|
description = ''
|
|
Some descriptive text
|
|
'';
|
|
};
|
|
|
|
# mkAliasOptionModule sets warnings, so this has to be defined.
|
|
warnings = mkOption {
|
|
internal = true;
|
|
default = [ ];
|
|
type = types.listOf types.str;
|
|
example = [ "The `foo' service is deprecated and will go away soon!" ];
|
|
description = ''
|
|
This option allows modules to show warnings to users during
|
|
the evaluation of the system configuration.
|
|
'';
|
|
};
|
|
};
|
|
|
|
imports = [
|
|
# Create an alias for the "enable" option.
|
|
(mkAliasOptionModule [ "enableAlias" ] [ "enable" ])
|
|
|
|
# Disable the aliased option, but with a default (low) priority so it
|
|
# should be able to be overridden by the next import.
|
|
(
|
|
{ config, lib, ... }:
|
|
{
|
|
enableAlias = mkDefault false;
|
|
}
|
|
)
|
|
|
|
# Enable the normal (non-aliased) option.
|
|
(
|
|
{ config, lib, ... }:
|
|
{
|
|
enable = true;
|
|
}
|
|
)
|
|
];
|
|
}
|