mirror of
https://github.com/nix-community/nixvim.git
synced 2025-06-21 00:25:42 +02:00
wrappers: make helpers
available via lib
option
NixOS, HM, & Darwin provide a `lib` option, not to be confused with the `lib` module arg. This option is intended for modules to define custom functions without having to extend nixpkgs lib. The old option is renamed, if it is accessed it will print: trace: Obsolete option `nixvim.helpers' is used. It was renamed to `lib.nixvim'.
This commit is contained in:
parent
0ac10f6776
commit
216d64c158
2 changed files with 17 additions and 13 deletions
|
@ -10,12 +10,12 @@ If Nixvim is built using the standalone method, you can access our `helpers` as
|
||||||
```
|
```
|
||||||
|
|
||||||
If Nixvim is being used as as a home-manager module, a nixos module, or as a dawwin module,
|
If Nixvim is being used as as a home-manager module, a nixos module, or as a dawwin module,
|
||||||
helpers can be accessed via the `config.nixvim.helpers` option:
|
helpers can be accessed via the `config.lib` option:
|
||||||
|
|
||||||
```nix
|
```nix
|
||||||
{ config, ... }:
|
{ config, ... }:
|
||||||
let
|
let
|
||||||
inherit (config.nixvim) helpers;
|
helpers = config.lib.nixvim;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
# Your config
|
# Your config
|
||||||
|
|
|
@ -29,20 +29,24 @@ let
|
||||||
extraFiles = lib.filter (file: file.enable) (lib.attrValues cfg.extraFiles);
|
extraFiles = lib.filter (file: file.enable) (lib.attrValues cfg.extraFiles);
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
options = {
|
# TODO: Added 2024-07-24; remove after 24.11
|
||||||
nixvim.helpers = mkOption {
|
imports = [
|
||||||
type = mkOptionType {
|
(lib.mkRenamedOptionModule
|
||||||
name = "helpers";
|
[
|
||||||
description = "Helpers that can be used when writing nixvim configs";
|
"nixvim"
|
||||||
check = isAttrs;
|
"helpers"
|
||||||
};
|
]
|
||||||
description = "Use this option to access the helpers";
|
[
|
||||||
};
|
"lib"
|
||||||
};
|
"nixvim"
|
||||||
|
]
|
||||||
|
)
|
||||||
|
];
|
||||||
|
|
||||||
config = mkMerge [
|
config = mkMerge [
|
||||||
# Make our lib available to the host modules
|
# Make our lib available to the host modules
|
||||||
{ nixvim.helpers = lib.mkDefault (import ../lib/helpers.nix { inherit pkgs lib; }); }
|
# TODO: import top-level ../lib
|
||||||
|
{ lib.nixvim = lib.mkDefault (import ../lib/helpers.nix { inherit pkgs lib; }); }
|
||||||
# Propagate extraFiles to the host modules
|
# Propagate extraFiles to the host modules
|
||||||
(optionalAttrs (filesOpt != null) (
|
(optionalAttrs (filesOpt != null) (
|
||||||
mkIf (!cfg.wrapRc) (
|
mkIf (!cfg.wrapRc) (
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue