mirror of
https://github.com/nix-community/nixvim.git
synced 2025-06-21 00:25:42 +02:00
lib: make overrideable & access via flake
Add a non-system specific `<flake>.lib.nixvim` output, which is equivalent to the existing `<flake>.lib.<system>.helpers` output. This is now also wrapped with `lib.makeOverridable` to allow overriding the function args used to construct the nixvim-lib. Consistently access nixvim-lib via the new flake output, overriding where necessary.
This commit is contained in:
parent
e2ef15a665
commit
4b3b67fb6f
6 changed files with 33 additions and 35 deletions
|
@ -1,4 +1,5 @@
|
||||||
{
|
{
|
||||||
|
helpers,
|
||||||
system,
|
system,
|
||||||
nixpkgs,
|
nixpkgs,
|
||||||
nuschtosSearch,
|
nuschtosSearch,
|
||||||
|
@ -7,7 +8,6 @@ let
|
||||||
# We overlay a few tweaks into pkgs, for use in the docs
|
# We overlay a few tweaks into pkgs, for use in the docs
|
||||||
pkgs = import ./pkgs.nix { inherit system nixpkgs; };
|
pkgs = import ./pkgs.nix { inherit system nixpkgs; };
|
||||||
inherit (pkgs) lib;
|
inherit (pkgs) lib;
|
||||||
helpers = import ../lib { inherit lib; };
|
|
||||||
|
|
||||||
nixvimPath = toString ./..;
|
nixvimPath = toString ./..;
|
||||||
|
|
||||||
|
|
|
@ -6,23 +6,28 @@
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
{
|
{
|
||||||
_module.args.helpers = import ../lib {
|
# Expose lib as a flake-parts module arg
|
||||||
|
_module.args = {
|
||||||
|
helpers = self.lib.nixvim;
|
||||||
|
};
|
||||||
|
|
||||||
|
# Public `lib` flake output
|
||||||
|
flake.lib =
|
||||||
|
{
|
||||||
|
nixvim = lib.makeOverridable (import ../lib) {
|
||||||
inherit lib;
|
inherit lib;
|
||||||
flake = self;
|
flake = self;
|
||||||
};
|
};
|
||||||
|
}
|
||||||
# TODO: output lib without pkgs at the top-level
|
// lib.genAttrs config.systems (
|
||||||
flake.lib = lib.genAttrs config.systems (
|
|
||||||
lib.flip withSystem (
|
lib.flip withSystem (
|
||||||
{ pkgs, ... }:
|
{ pkgs, ... }:
|
||||||
{
|
{
|
||||||
# NOTE: this is the publicly documented flake output we've had for a while
|
# NOTE: this is the publicly documented flake output we've had for a while
|
||||||
check = import ../lib/tests.nix { inherit self lib pkgs; };
|
check = pkgs.callPackage ../lib/tests.nix { inherit self; };
|
||||||
# TODO: no longer needs to be per-system
|
|
||||||
helpers = import ../lib {
|
# NOTE: no longer needs to be per-system
|
||||||
inherit lib;
|
helpers = self.lib.nixvim;
|
||||||
flake = self;
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
|
@ -1,4 +1,8 @@
|
||||||
{ inputs, ... }:
|
{
|
||||||
|
inputs,
|
||||||
|
helpers,
|
||||||
|
...
|
||||||
|
}:
|
||||||
{
|
{
|
||||||
perSystem =
|
perSystem =
|
||||||
{
|
{
|
||||||
|
@ -9,6 +13,7 @@
|
||||||
}:
|
}:
|
||||||
{
|
{
|
||||||
packages = import ../docs {
|
packages = import ../docs {
|
||||||
|
inherit helpers;
|
||||||
inherit system;
|
inherit system;
|
||||||
inherit (inputs) nixpkgs;
|
inherit (inputs) nixpkgs;
|
||||||
inherit (inputs') nuschtosSearch;
|
inherit (inputs') nuschtosSearch;
|
||||||
|
|
|
@ -46,9 +46,7 @@ let
|
||||||
}@args:
|
}@args:
|
||||||
let
|
let
|
||||||
# NOTE: we are importing this just for evalNixvim
|
# NOTE: we are importing this just for evalNixvim
|
||||||
helpers = import ../lib {
|
helpers = self.lib.nixvim.override {
|
||||||
inherit lib;
|
|
||||||
flake = self;
|
|
||||||
# TODO: deprecate helpers.enableExceptInTests,
|
# TODO: deprecate helpers.enableExceptInTests,
|
||||||
# add a context option e.g. `config.isTest`?
|
# add a context option e.g. `config.isTest`?
|
||||||
_nixvimTests = true;
|
_nixvimTests = true;
|
||||||
|
|
|
@ -59,13 +59,7 @@ in
|
||||||
config = mkMerge [
|
config = mkMerge [
|
||||||
{
|
{
|
||||||
# Make our lib available to the host modules
|
# Make our lib available to the host modules
|
||||||
# NOTE: user-facing so we must include the legacy `pkgs` argument
|
lib.nixvim = lib.mkDefault self.lib.nixvim;
|
||||||
lib.nixvim = lib.mkDefault (
|
|
||||||
import ../lib {
|
|
||||||
inherit lib;
|
|
||||||
flake = self;
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
# Make nixvim's "extended" lib available to the host's module args
|
# Make nixvim's "extended" lib available to the host's module args
|
||||||
_module.args.nixvimLib = lib.mkDefault config.lib.nixvim.extendedLib;
|
_module.args.nixvimLib = lib.mkDefault config.lib.nixvim.extendedLib;
|
||||||
|
|
|
@ -9,11 +9,7 @@ default_pkgs: self:
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
# NOTE: we are importing this just for evalNixvim
|
# NOTE: we are importing this just for evalNixvim
|
||||||
helpers = import ../lib {
|
helpers = self.lib.nixvim.override { inherit _nixvimTests; };
|
||||||
inherit lib _nixvimTests;
|
|
||||||
flake = self;
|
|
||||||
};
|
|
||||||
|
|
||||||
inherit (helpers.modules) evalNixvim;
|
inherit (helpers.modules) evalNixvim;
|
||||||
|
|
||||||
mkNvim =
|
mkNvim =
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue