mirror of
https://github.com/NotAShelf/nvf.git
synced 2025-11-09 06:55:30 +00:00
{lib,flake}: convert to fixed-point and modify flake for compat
This commit is contained in:
parent
3e48f13c3c
commit
1627e4dddc
18 changed files with 68 additions and 83 deletions
|
|
@ -1,4 +1,4 @@
|
|||
{lib}: let
|
||||
_: let
|
||||
inherit (builtins) listToAttrs;
|
||||
in {
|
||||
mapListToAttrs = f: list: listToAttrs (map f list);
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
{lib}: let
|
||||
{lib, ...}: let
|
||||
inherit (lib.options) mkOption;
|
||||
inherit (lib.modules) mkIf mkDefault;
|
||||
inherit (lib.types) nullOr str;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
{lib}: let
|
||||
{lib, ...}: let
|
||||
inherit (lib.options) mkOption;
|
||||
inherit (lib.types) bool;
|
||||
inherit (lib.modules) mkRenamedOptionModule;
|
||||
|
|
|
|||
|
|
@ -7,11 +7,15 @@
|
|||
#
|
||||
# - the addition of the function `entryBefore` indicating a "wanted
|
||||
# by" relationship.
|
||||
{lib}: let
|
||||
{
|
||||
lib,
|
||||
nvf-lib,
|
||||
...
|
||||
}: let
|
||||
inherit (builtins) isAttrs attrValues attrNames elem all head tail length toJSON isString removeAttrs;
|
||||
inherit (lib.attrsets) filterAttrs mapAttrs;
|
||||
inherit (lib.lists) toposort;
|
||||
inherit (lib.nvim.dag) empty isEntry entryBetween entryAfter entriesBetween entryAnywhere topoSort;
|
||||
inherit (nvf-lib.dag) empty isEntry entryBetween entryAfter entriesBetween entryAnywhere topoSort;
|
||||
in {
|
||||
empty = {};
|
||||
|
||||
|
|
|
|||
|
|
@ -1,16 +1,22 @@
|
|||
{
|
||||
self,
|
||||
inputs,
|
||||
lib,
|
||||
...
|
||||
}: {
|
||||
types = import ./types {inherit lib self;};
|
||||
config = import ./config.nix {inherit lib;};
|
||||
binds = import ./binds.nix {inherit lib;};
|
||||
dag = import ./dag.nix {inherit lib;};
|
||||
languages = import ./languages.nix {inherit lib;};
|
||||
lists = import ./lists.nix {inherit lib;};
|
||||
attrsets = import ./attrsets.nix {inherit lib;};
|
||||
lua = import ./lua.nix {inherit lib;};
|
||||
neovimConfiguration = import ../modules {inherit self inputs lib;};
|
||||
self,
|
||||
}: final: let
|
||||
# Modeled after nixpkgs' lib.
|
||||
callLibs = file:
|
||||
import file {
|
||||
nvf-lib = final;
|
||||
inherit inputs self;
|
||||
inherit (inputs.nixpkgs) lib;
|
||||
};
|
||||
in {
|
||||
types = callLibs ./types;
|
||||
config = callLibs ./config.nix;
|
||||
binds = callLibs ./binds.nix;
|
||||
dag = callLibs ./dag.nix;
|
||||
languages = callLibs ./languages.nix;
|
||||
lists = callLibs ./lists.nix;
|
||||
attrsets = callLibs ./attrsets.nix;
|
||||
lua = callLibs ./lua.nix;
|
||||
neovimConfiguration = callLibs ../modules;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,9 +1,13 @@
|
|||
{lib}: let
|
||||
{
|
||||
lib,
|
||||
nvf-lib,
|
||||
...
|
||||
}: let
|
||||
inherit (builtins) isString getAttr;
|
||||
inherit (lib.options) mkOption;
|
||||
inherit (lib.types) listOf bool str submodule attrsOf anything either nullOr uniq;
|
||||
inherit (lib.nvim.attrsets) mapListToAttrs;
|
||||
inherit (lib.nvim.types) luaInline;
|
||||
inherit (nvf-lib.attrsets) mapListToAttrs;
|
||||
inherit (nvf-lib.types) luaInline;
|
||||
in {
|
||||
# TODO: remove
|
||||
diagnosticsToLua = {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
{lib}: let
|
||||
{lib, ...}: let
|
||||
inherit (lib.lists) elem all;
|
||||
in {
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
# Helpers for converting values to lua
|
||||
{lib}: let
|
||||
{lib, ...}: let
|
||||
isLuaInline = object: (object._type or null) == "lua-inline";
|
||||
|
||||
toLuaObject = args:
|
||||
|
|
|
|||
|
|
@ -1,21 +0,0 @@
|
|||
# Convenience function that returns the given Nixpkgs standard library
|
||||
# extended with our functions using `lib.extend`.
|
||||
{inputs, ...} @ args:
|
||||
inputs.nixpkgs.lib.extend (self: super: {
|
||||
# WARNING: New functions should not be added here, but to files
|
||||
# imported by `./default.nix` under their own categories. If your
|
||||
# function does not fit to any of the existing categories, create
|
||||
# a new file and import it in `./default.nix.`
|
||||
|
||||
# Makes our custom functions available under `lib.nvim` where stdlib-extended.nix is imported
|
||||
# with the appropriate arguments. For end-users, a `lib` output will be accessible from the flake.
|
||||
# E.g. for an input called `nvf`, `inputs.nvf.lib.nvim` will return the set
|
||||
# below.
|
||||
nvim = import ./. {
|
||||
inherit (args) inputs self;
|
||||
lib = self;
|
||||
};
|
||||
|
||||
# For forward compatibility.
|
||||
literalExpression = super.literalExpression or super.literalExample;
|
||||
})
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
{lib}: let
|
||||
{lib, ...}: let
|
||||
inherit (lib.options) mergeEqualOption;
|
||||
inherit (lib.lists) singleton;
|
||||
inherit (lib.strings) isString stringLength match;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
# From home-manager: https://github.com/nix-community/home-manager/blob/master/modules/lib/types-dag.nix
|
||||
# Used for ordering configuration text.
|
||||
{lib}: let
|
||||
{lib, ...}: let
|
||||
# TODO: inherit from subgroups
|
||||
inherit
|
||||
(lib)
|
||||
defaultFunctor
|
||||
|
|
|
|||
|
|
@ -1,11 +1,8 @@
|
|||
{
|
||||
lib,
|
||||
self,
|
||||
}: let
|
||||
typesDag = import ./dag.nix {inherit lib;};
|
||||
typesPlugin = import ./plugins.nix {inherit lib self;};
|
||||
typesLanguage = import ./languages.nix {inherit lib;};
|
||||
customTypes = import ./custom.nix {inherit lib;};
|
||||
args: let
|
||||
typesDag = import ./dag.nix args;
|
||||
typesPlugin = import ./plugins.nix args;
|
||||
typesLanguage = import ./languages.nix args;
|
||||
customTypes = import ./custom.nix args;
|
||||
in {
|
||||
inherit (typesDag) dagOf;
|
||||
inherit (typesPlugin) pluginsOpt extraPluginType mkPluginSetupOption luaInline pluginType borderType;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
{lib}: let
|
||||
{lib, ...}: let
|
||||
inherit (lib.options) mkOption mkPackageOption;
|
||||
inherit (lib.attrsets) attrNames;
|
||||
inherit (lib.types) listOf either enum submodule package;
|
||||
|
|
|
|||
|
|
@ -1,11 +1,14 @@
|
|||
{
|
||||
lib,
|
||||
nvf-lib,
|
||||
self,
|
||||
...
|
||||
}: let
|
||||
inherit (lib.options) mkOption;
|
||||
inherit (lib.attrsets) attrNames mapAttrs' filterAttrs nameValuePair;
|
||||
inherit (lib.strings) hasPrefix removePrefix;
|
||||
inherit (lib.types) submodule either package enum str lines anything listOf nullOr;
|
||||
inherit (lib.types) submodule either package enum str lines anything listOf nullOr mkOptionType;
|
||||
inherit (nvf-lib.lua) isLuaInline;
|
||||
|
||||
# Get the names of all flake inputs that start with the given prefix.
|
||||
fromInputs = {
|
||||
|
|
@ -64,9 +67,9 @@ in {
|
|||
type = pluginsType;
|
||||
};
|
||||
|
||||
luaInline = lib.mkOptionType {
|
||||
luaInline = mkOptionType {
|
||||
name = "luaInline";
|
||||
check = x: lib.nvim.lua.isLuaInline x;
|
||||
check = x: isLuaInline x;
|
||||
};
|
||||
|
||||
/*
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue