This commit is contained in:
RingOfStorms (Joshua Bell) 2024-04-30 11:02:30 -05:00
parent c72d894bbd
commit 0b833d555c
13 changed files with 719 additions and 46 deletions

104
flake.nix
View file

@ -4,10 +4,8 @@
inputs = {
nixpkgs.url = "nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
# inputs.nixpkgs.follows = "nixpkgs";
# All my neovim plguins managed by flake. Lazy will only be used for loading/configuration with direct dir links to these.
"nvim_plugin-folke/lazy.nvim" = {
url = "github:folke/lazy.nvim";
flake = false;
@ -25,6 +23,7 @@
pkgs = nixpkgs.legacyPackages.${system};
lib = nixpkgs.lib;
# This will look at all inputs and grab any prefixed with `nvim_plugin-`
nvimPluginPaths = "NVIM_PLUGIN_PATHS=" + lib.generators.toLua
{
multiline = false;
@ -42,10 +41,17 @@
(builtins.attrNames inputs))
)
;
nvimConfigStorePath = ''NVIM_CONFIG_STORE_PATH="${./.}"'';
runtimeDependencies = with pkgs; [
ripgrep
curl
cowsay
nodePackages.cspell
];
treesitterParsers = builtins.attrValues pkgs.vimPlugins.nvim-treesitter.grammarPlugins;
# https://zimbatm.com/notes/1000-instances-of-nixpkgs
# Read article for why we don't do the below version
# pkgs = import nixpkgs {
@ -69,31 +75,75 @@
{
packages = {
default = self.packages.${system}.neovim;
neovim = pkgs.wrapNeovimUnstable pkgs.neovim-unwrapped (
pkgs.neovimUtils.makeNeovimConfig
{
customRC = ''
lua print("HELLO WORLD 123! TEST")
lua ${nvimPluginPaths}
lua package.path =";${./.}/lua/?.lua" .. package.path
luafile ${./.}/init.lua
'';
# set runtimepath^=${builtins.concatStringsSep "," treesitterParsers}
}
// {
wrapperArgs = [
# Add runtime dependencies to neovim path
"--prefix"
"PATH"
":"
"${lib.makeBinPath runtimeDependencies}"
# Use custom XDG_CONFIG_HOME so it doesn't use the user's real one
"--set"
"XDG_CONFIG_HOME"
"~/.config/ringofstorms_neovim"
];
}
);
neovim =
(pkgs.wrapNeovimUnstable
pkgs.neovim-unwrapped
(pkgs.neovimUtils.makeNeovimConfig
{
withPython3 = false;
customRC = ''
lua ${nvimPluginPaths}
lua ${nvimConfigStorePath}
luafile ${./.}/init.lua
set runtimepath^=${builtins.concatStringsSep "," treesitterParsers}
'';
# lua package.path = package.path .. ";${./.}/lua/?.lua"
# lua print("HELLO WORLD 123! TEST")
# lua print("${./.}")
# -- lua package.runtimepath = "${./.}`
# plugins = [
# pkgs.vimPlugins.nvim-treesitter.withAllGrammars
# ];
# customRC = import ./lua { inherit lib self; };
# wrapperArgs = [
# # Add runtime dependencies to neovim path
# "--prefix"
# "PATH"
# ":"
# "${lib.makeBinPath runtimeDependencies}"
# # Set the LAZY env path to the nix store
# "--set"
# "LAZY"
# "${inputs.nvim_plugin-folke/lazy.nvim}"
# # Use custom XDG_CONFIG_HOME so it doesn't use the user's real one
# # TODO do I need to set all the XDG_ env vars? - or should I remove this entirely?
# "--set"
# "XDG_CONFIG_HOME"
# "${./.}"
# ];
}
)
).overrideAttrs
(old: {
generatedWrapperArgs = old.generatedWrapperArgs or [ ] ++ [
# Add runtime dependencies to neovim path
"--prefix"
"PATH"
":"
"${lib.makeBinPath runtimeDependencies}"
# Set the LAZY env path to the nix store
"--set"
"LAZY"
"${inputs."nvim_plugin-folke/lazy.nvim"}"
# Use custom XDG_CONFIG_HOME so it doesn't use the user's real one
# TODO do I need to set all the XDG_ env vars? - or should I remove this entirely?
"--set"
"XDG_CONFIG_HOME"
"~/.config/nvim_flaked"
"--set"
"XDG_DATA_HOME"
"~/.local/share/nvim_flaked"
"--set"
"XDG_RUNTIME_DIR"
"/tmp/nvim.user/nvim_flaked/xxx"
"--set"
"XDG_STATE_HOME"
"~/.local/state/nvim_flaked"
];
})
;
# neovim = pkgs.stdenv.mkDerivation {
# name = "nvim";
# nativeBuildInputs = with pkgs; [ makeWrapper rsync ];