mirror of
https://github.com/nix-community/nixvim.git
synced 2025-08-07 11:25:06 +02:00
33 lines
1.1 KiB
Nix
33 lines
1.1 KiB
Nix
{ lib, ... }:
|
|
with lib;
|
|
|
|
{
|
|
# This should be used instead of mkRemovedOptionModule, when the option still works,
|
|
# but is just deprecated and should be changed now and for the future
|
|
mkDeprecatedOption =
|
|
{ option # an array of the path to the option
|
|
, alternative ? null
|
|
, message ? null
|
|
, visible ? false
|
|
}:
|
|
{ options, ... }:
|
|
let
|
|
fromOpt = getAttrFromPath option options;
|
|
fullMessage = "The option `${showOption option}` has been deprecated, but might still work." +
|
|
(optionalString (alternative != null) " You may want to use `${showOption alternative}` instead.") +
|
|
(optionalString (message != null) " Message: ${message}");
|
|
in
|
|
{
|
|
config = mkIf (fromOpt.isDefined) {
|
|
warnings = [
|
|
("Nixvim: ${fullMessage}")
|
|
];
|
|
};
|
|
};
|
|
|
|
# For removed options, we can just use nixpkgs mkRemovedOptionModule, which is already in lib
|
|
mkRemovedOption = mkRemovedOptionModule;
|
|
|
|
# For renamed options, we can also use the function from nixpkgs
|
|
mkRenamedOption = mkRenamedOptionModule; # use the function from nixpkgs
|
|
}
|