sloth-flake.nvim/lib/init.nix

52 lines
1.2 KiB
Nix

{pkgs, ...}: let
inherit (builtins) isAttrs isPath isString readFile;
inherit (pkgs.lib) fix mkOption types;
in
fix (self: {
module = types.submodule {
options = {
init = mkOption {
type = with types; nullOr (either path str);
default = null;
description = ''
Lua code to call before plugins loaded
'';
};
postInit = mkOption {
type = with types; nullOr (either path str);
default = null;
description = ''
Lua code called after init but before import
'';
};
config = mkOption {
type = with types; nullOr (either path str);
default = null;
description = ''
Lua code called after all plugins are loaded
'';
};
};
};
option = mkOption {
default = null;
description = ''
init.lua configuration
'';
type = with types; nullOr (oneOf [path str self.module]);
example = ./init.lua;
};
mkCustomLuaRc = init:
if isString init
then init
else if isPath init
then readFile init
else if isAttrs init
then "print('not implmented yet')"
else null;
})