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:
Matt Sturgeon 2024-12-21 13:40:16 +00:00
parent e2ef15a665
commit 4b3b67fb6f
No known key found for this signature in database
GPG key ID: 4F91844CED1A8299
6 changed files with 33 additions and 35 deletions

View file

@ -6,24 +6,29 @@
...
}:
{
_module.args.helpers = import ../lib {
inherit lib;
flake = self;
# Expose lib as a flake-parts module arg
_module.args = {
helpers = self.lib.nixvim;
};
# TODO: output lib without pkgs at the top-level
flake.lib = lib.genAttrs config.systems (
lib.flip withSystem (
{ pkgs, ... }:
{
# NOTE: this is the publicly documented flake output we've had for a while
check = import ../lib/tests.nix { inherit self lib pkgs; };
# TODO: no longer needs to be per-system
helpers = import ../lib {
inherit lib;
flake = self;
};
}
)
);
# Public `lib` flake output
flake.lib =
{
nixvim = lib.makeOverridable (import ../lib) {
inherit lib;
flake = self;
};
}
// lib.genAttrs config.systems (
lib.flip withSystem (
{ pkgs, ... }:
{
# NOTE: this is the publicly documented flake output we've had for a while
check = pkgs.callPackage ../lib/tests.nix { inherit self; };
# NOTE: no longer needs to be per-system
helpers = self.lib.nixvim;
}
)
);
}