Compare commits
1 Commits
main
...
feat/bette
| Author | SHA1 | Date |
|---|---|---|
|
|
01f2f2c7ff |
76
README.md
76
README.md
|
|
@ -10,6 +10,7 @@ A [neovim] plugin and configuration management plugin, highly inspired by [lazy]
|
|||
- [Installation](#installation)
|
||||
- [Flake installation](#flake-installation)
|
||||
- [Usage](#usage)
|
||||
- [Minimal example](#minimal-example)
|
||||
- [Documentation](#documentation)
|
||||
- [nix](#nix)
|
||||
- [`mkPluginsFromInputs`](#mkpluginsfrominputs)
|
||||
|
|
@ -86,6 +87,81 @@ inputs.sloth-flake.url = "github:lemarsu/sloth-flake.nvim?tag=0.0.5";
|
|||
|
||||
## Usage
|
||||
|
||||
### Minimal example
|
||||
|
||||
sloth-flake has been made for this typical use case. I was a long vim/neovim
|
||||
user, had a repository with a lot of neovim config in it, and I discovered
|
||||
[nix]. At first, I kept my [lazy] setup, but it wasn't integrated with the rest
|
||||
of my nix config. I've seen a bunch of solution to handle your vim files, but
|
||||
not was for my taste. I wanted a configuration that allow me keep the maximum
|
||||
of my old lazy config, and let nix handle the rest. So after some trial and
|
||||
errors, I made this flake, and turn my old neovim configuration repository in a
|
||||
flake that produce a neovim binary bundled with my configuration.
|
||||
|
||||
Here's a minimal flake to make a bundled neovim plugin with sloth-flake.nvim:
|
||||
|
||||
`flake.nix`
|
||||
```nix
|
||||
{
|
||||
inputs = {
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
|
||||
sloth-flake.url = "github:lemarsu/sloth-flake.nvim";
|
||||
utils.url = "github:numtide/flake-utils";
|
||||
};
|
||||
outputs = {utils, sloth-flake, ...}@inputs:
|
||||
utils.lib.eachDefaultSystem (system: {
|
||||
packages = rec {
|
||||
default = neovim;
|
||||
neovim = pkgs.callPackage ./package.nix {inherit sloth-flake;};
|
||||
};
|
||||
});
|
||||
}
|
||||
```
|
||||
|
||||
`./package.nix`
|
||||
```nix
|
||||
{
|
||||
pkgs,
|
||||
lib,
|
||||
sloth-flake,
|
||||
...
|
||||
}:
|
||||
sloth-flake.lib.mkNeovimPkg {
|
||||
inherit pkgs;
|
||||
viAlias = true;
|
||||
vimAlias = true;
|
||||
vimdiffAlias = true;
|
||||
runtime = {
|
||||
init = ./init.lua;
|
||||
src = with lib.fileset;
|
||||
toSource {
|
||||
root = ./.;
|
||||
fileset = unions [
|
||||
./after
|
||||
./colors
|
||||
./ftplugin
|
||||
./lua
|
||||
./plugin
|
||||
./queries
|
||||
./spell
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
dependencies = [./dependencies.nix];
|
||||
}
|
||||
```
|
||||
|
||||
`dependencies.nix`
|
||||
```nix
|
||||
{pkgs, ...}: with pkgs.vimPlugins;
|
||||
[
|
||||
# Your plugin list
|
||||
telescope-nvim
|
||||
# TODO More examples
|
||||
]
|
||||
```
|
||||
|
||||
Once installed, you can call the `sloth-flake.lib.mkNeovimPkg` to build your neovim package.
|
||||
|
||||
`mkNeovimPkg` requires a *set* as argument with at least `pkgs` that represents your nixpkgs.
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,78 @@
|
|||
*my-awesome-plugin.txt* An awesome plugin that greets you :)
|
||||
|
||||
==============================================================================
|
||||
CONTENTS *my-awesome-plugin-contents*
|
||||
|
||||
1. Introduction ......................... |my-awesome-plugin-introduction|
|
||||
2. Setup ................................ |my-awesome-plugin-setup|
|
||||
3. Commands ............................. |my-awesome-plugin-commands|
|
||||
4. API .................................. |my-awesome-plugin-api|
|
||||
|
||||
==============================================================================
|
||||
1. INTRODUCTION *my-awesome-plugin-introduction*
|
||||
|
||||
my-awesome-plugin makes Neovim, your favorite text editor, capable of greeting
|
||||
you. See bellow how it works:
|
||||
|
||||
+--------------+ +--------------+
|
||||
| | | |
|
||||
| | | |
|
||||
| | | |
|
||||
| Hello | -----------> | [your-name] |
|
||||
| | | |
|
||||
| | | |
|
||||
+--------------+ +--------------+
|
||||
|
||||
==============================================================================
|
||||
2. SETUP *my-awesome-plugin-setup*
|
||||
|
||||
Make sure to add to call the setup function with the proper configuration on
|
||||
your `init` file.
|
||||
|
||||
If you use `init.vim`: >
|
||||
|
||||
lua require('my_awesome_plugin').setup { name = 'Alexander, The Great'}
|
||||
|
||||
|
||||
Or, if you use `init.lua`: >
|
||||
|
||||
require('my_awesome_plugin').setup { name = 'Alexander, The Great'}
|
||||
|
||||
==============================================================================
|
||||
3. COMMANDS *my-awesome-plugin-commands*
|
||||
|
||||
:MyAwesomePluginGenericGreet *MyAwesomePluginGenericGreet*
|
||||
|
||||
Shows a generic greet message.
|
||||
|
||||
:MyAwesomePluginGreet *MyAwesomePluginGreet*
|
||||
|
||||
Shows a personalized, accordingly to the setup configuration, greet message.
|
||||
|
||||
==============================================================================
|
||||
4. API *my-awesome-plugin-api*
|
||||
|
||||
|
||||
my_awesome_plugin.setup({config}) *my_awesome_plugin.setup()*
|
||||
Configures this plugin. Currently supported configuration variables
|
||||
are:
|
||||
• `name`: a string to be used in the greet message
|
||||
|
||||
Parameters: ~
|
||||
{config}(required, table) Table of values; keys are as listed
|
||||
above. Accept defaults by omitting the relevant key.
|
||||
|
||||
my_awesome_plugin.is_configured() *my_awesome_plugin.is_configured()*
|
||||
Tell if the plugin is configured.
|
||||
Return: ~
|
||||
true/false
|
||||
|
||||
my_awesome_plugin.greet() *my_awesome_plugin.greet()*
|
||||
Show a greeting message. If the plugin was previously configured with
|
||||
|my_awesome_plugin.setup()|, show a personalized message.
|
||||
|
||||
my_awesome_plugin.generic_greet() *my_awesome_plugin.generic_greet()*
|
||||
Show a generic greeting message.
|
||||
|
||||
==============================================================================
|
||||
vim:tw=78:ts=8:ft=help:norl:noet:fen:noet:
|
||||
|
|
@ -0,0 +1,339 @@
|
|||
{
|
||||
"nodes": {
|
||||
"alejandra": {
|
||||
"inputs": {
|
||||
"fenix": "fenix",
|
||||
"flakeCompat": "flakeCompat",
|
||||
"nixpkgs": [
|
||||
"sloth-flake",
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1660592437,
|
||||
"narHash": "sha256-xFumnivtVwu5fFBOrTxrv6fv3geHKF04RGP23EsDVaI=",
|
||||
"owner": "kamadorueda",
|
||||
"repo": "alejandra",
|
||||
"rev": "e7eac49074b70814b542fee987af2987dd0520b5",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "kamadorueda",
|
||||
"ref": "3.0.0",
|
||||
"repo": "alejandra",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"fenix": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"sloth-flake",
|
||||
"alejandra",
|
||||
"nixpkgs"
|
||||
],
|
||||
"rust-analyzer-src": "rust-analyzer-src"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1657607339,
|
||||
"narHash": "sha256-HaqoAwlbVVZH2n4P3jN2FFPMpVuhxDy1poNOR7kzODc=",
|
||||
"owner": "nix-community",
|
||||
"repo": "fenix",
|
||||
"rev": "b814c83d9e6aa5a28d0cf356ecfdafb2505ad37d",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-community",
|
||||
"repo": "fenix",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-utils": {
|
||||
"inputs": {
|
||||
"systems": "systems"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1710146030,
|
||||
"narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flakeCompat": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1650374568,
|
||||
"narHash": "sha256-Z+s0J8/r907g149rllvwhb4pKi8Wam5ij0st8PwAh+E=",
|
||||
"owner": "edolstra",
|
||||
"repo": "flake-compat",
|
||||
"rev": "b4a34015c698c7793d592d66adbab377907a2be8",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "edolstra",
|
||||
"repo": "flake-compat",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nil": {
|
||||
"inputs": {
|
||||
"flake-utils": "flake-utils",
|
||||
"nixpkgs": "nixpkgs_2",
|
||||
"rust-overlay": "rust-overlay"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1717086091,
|
||||
"narHash": "sha256-GmsEQa4HZeMfec37LZnwG/Lt/XmqFLXsjv5QWojeNiM=",
|
||||
"owner": "oxalica",
|
||||
"repo": "nil",
|
||||
"rev": "ab3ddb8f063774cf7e22eb610f5ecfdb77309f3c",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "oxalica",
|
||||
"repo": "nil",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1717774105,
|
||||
"narHash": "sha256-HV97wqUQv9wvptiHCb3Y0/YH0lJ60uZ8FYfEOIzYEqI=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "d226935fd75012939397c83f6c385e4d6d832288",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "nixpkgs-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs_2": {
|
||||
"locked": {
|
||||
"lastModified": 1716977081,
|
||||
"narHash": "sha256-pFe5jLeIPlKEln5n2h998d7cpzXFdbrBMRe3suz4K1o=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "ac82a513e55582291805d6f09d35b6d8b60637a1",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nixos",
|
||||
"ref": "nixpkgs-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs_3": {
|
||||
"locked": {
|
||||
"lastModified": 1717196966,
|
||||
"narHash": "sha256-yZKhxVIKd2lsbOqYd5iDoUIwsRZFqE87smE2Vzf6Ck0=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "57610d2f8f0937f39dbd72251e9614b1561942d8",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nixos",
|
||||
"ref": "nixos-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs_4": {
|
||||
"locked": {
|
||||
"lastModified": 1660438583,
|
||||
"narHash": "sha256-rJUTYxFKlWUJI3njAwEc1pKAVooAViZGJvsgqfh/q/E=",
|
||||
"owner": "nix-community",
|
||||
"repo": "nixpkgs.lib",
|
||||
"rev": "bbd8f7cd87d0b29294ef3072ffdbd61d60f05da4",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-community",
|
||||
"repo": "nixpkgs.lib",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"nixpkgs": "nixpkgs",
|
||||
"sloth-flake": "sloth-flake",
|
||||
"utils": "utils_2"
|
||||
}
|
||||
},
|
||||
"rust-analyzer-src": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1657557289,
|
||||
"narHash": "sha256-PRW+nUwuqNTRAEa83SfX+7g+g8nQ+2MMbasQ9nt6+UM=",
|
||||
"owner": "rust-lang",
|
||||
"repo": "rust-analyzer",
|
||||
"rev": "caf23f29144b371035b864a1017dbc32573ad56d",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "rust-lang",
|
||||
"ref": "nightly",
|
||||
"repo": "rust-analyzer",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"rust-overlay": {
|
||||
"inputs": {
|
||||
"flake-utils": [
|
||||
"sloth-flake",
|
||||
"nil",
|
||||
"flake-utils"
|
||||
],
|
||||
"nixpkgs": [
|
||||
"sloth-flake",
|
||||
"nil",
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1717035469,
|
||||
"narHash": "sha256-MzH+yjKULH3HCRj9QCTwBvqq4LZkR0ZqRE/QfGOGC2E=",
|
||||
"owner": "oxalica",
|
||||
"repo": "rust-overlay",
|
||||
"rev": "095702e63a40e86f339d11864da9dc965b70a01e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "oxalica",
|
||||
"repo": "rust-overlay",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"sloth-flake": {
|
||||
"inputs": {
|
||||
"alejandra": "alejandra",
|
||||
"nil": "nil",
|
||||
"nixpkgs": "nixpkgs_3",
|
||||
"utils": "utils",
|
||||
"yants": "yants"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 0,
|
||||
"narHash": "sha256-VvZ+kCRRZcMM5j+wCNCfCUZby12gFS103ItEJhwcO3A=",
|
||||
"path": "/nix/store/5xmp1bx8p395yl60c033ywjd50wahsqy-source",
|
||||
"type": "path"
|
||||
},
|
||||
"original": {
|
||||
"path": "/nix/store/5xmp1bx8p395yl60c033ywjd50wahsqy-source",
|
||||
"type": "path"
|
||||
}
|
||||
},
|
||||
"systems": {
|
||||
"locked": {
|
||||
"lastModified": 1681028828,
|
||||
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"systems_2": {
|
||||
"locked": {
|
||||
"lastModified": 1681028828,
|
||||
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"systems_3": {
|
||||
"locked": {
|
||||
"lastModified": 1681028828,
|
||||
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"utils": {
|
||||
"inputs": {
|
||||
"systems": "systems_2"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1710146030,
|
||||
"narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"utils_2": {
|
||||
"inputs": {
|
||||
"systems": "systems_3"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1710146030,
|
||||
"narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"yants": {
|
||||
"inputs": {
|
||||
"nixpkgs": "nixpkgs_4"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1686863218,
|
||||
"narHash": "sha256-kooxYm3/3ornWtVBNHM3Zh020gACUyFX2G0VQXnB+mk=",
|
||||
"owner": "divnix",
|
||||
"repo": "yants",
|
||||
"rev": "8f0da0dba57149676aa4817ec0c880fbde7a648d",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "divnix",
|
||||
"repo": "yants",
|
||||
"type": "github"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
"version": 7
|
||||
}
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
{
|
||||
inputs = {
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
|
||||
# If you start your configuration from this example, you should uncomment
|
||||
# the next line, and delete the one after.
|
||||
# sloth-flake.url = "github:lemarsu/sloth-flake.nvim";
|
||||
sloth-flake.url = "../..";
|
||||
utils.url = "github:numtide/flake-utils";
|
||||
};
|
||||
outputs = {
|
||||
nixpkgs,
|
||||
sloth-flake,
|
||||
utils,
|
||||
...
|
||||
}:
|
||||
utils.lib.eachDefaultSystem (system: let
|
||||
pkgs = nixpkgs.legacyPackages.${system};
|
||||
in {
|
||||
packages = rec {
|
||||
default = neovim;
|
||||
neovim = sloth-flake.lib.mkNeovimPkg {
|
||||
inherit pkgs;
|
||||
viAlias = true;
|
||||
vimAlias = true;
|
||||
vimdiffAlias = true;
|
||||
dependencies = with pkgs.vimPlugins; [
|
||||
telescope-nvim
|
||||
];
|
||||
};
|
||||
};
|
||||
});
|
||||
}
|
||||
Loading…
Reference in New Issue