mirror of
https://github.com/nix-community/nixvim.git
synced 2025-12-16 05:51:10 +01:00
lib/modules: init buildNixvim and buildNixvimWith
Introduce thin wrappers around the `<configuration>.config.build.package`, option intended to replace the legacy `makeNixvim` and `makeNixvimWithModule` functions.
This commit is contained in:
parent
a250540213
commit
2695bef079
2 changed files with 46 additions and 0 deletions
|
|
@ -57,6 +57,47 @@ in
|
|||
}
|
||||
// extraSpecialArgs;
|
||||
};
|
||||
|
||||
/**
|
||||
Build a Nixvim package.
|
||||
|
||||
# Inputs
|
||||
|
||||
`input`
|
||||
: One of:
|
||||
1. A Nixvim module or a list of modules.
|
||||
2. A Nixvim configuration.
|
||||
3. A Nixvim package.
|
||||
|
||||
# Output
|
||||
|
||||
An installable Nixvim package.
|
||||
*/
|
||||
buildNixvim =
|
||||
input:
|
||||
if lib.isDerivation input then
|
||||
lib.throwIfNot (input ? config.build.package)
|
||||
"buildNixvim: received a derivation without the expected `config` attribute."
|
||||
input.config.build.package
|
||||
else if lib.isType "configuration" input then
|
||||
lib.throwIfNot (input ? config.build.package)
|
||||
"buildNixvim: received a configuration without the expected `build.package` option."
|
||||
input.config.build.package
|
||||
else
|
||||
self.modules.buildNixvimWith {
|
||||
modules = lib.toList input;
|
||||
};
|
||||
|
||||
/**
|
||||
Build a Nixvim package using the same interface as `evalNixvim`.
|
||||
|
||||
# Output
|
||||
|
||||
An installable Nixvim package.
|
||||
*/
|
||||
buildNixvimWith = lib.mirrorFunctionArgs self.modules.evalNixvim (
|
||||
args: (self.modules.evalNixvim args).config.build.package
|
||||
);
|
||||
}
|
||||
// lib.mapAttrs (
|
||||
name: msg:
|
||||
|
|
|
|||
|
|
@ -546,6 +546,11 @@ let
|
|||
"Nixvim (single-element): Trailing whitespaces"
|
||||
];
|
||||
};
|
||||
|
||||
buildNixvimWith_hasExpectedArgs = {
|
||||
expr = lib.functionArgs lib.nixvim.modules.buildNixvimWith;
|
||||
expected = lib.functionArgs lib.nixvim.modules.evalNixvim;
|
||||
};
|
||||
};
|
||||
in
|
||||
if results == [ ] then
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue