wip
This commit is contained in:
parent
43df590ba2
commit
c72d894bbd
8 changed files with 214 additions and 40 deletions
|
@ -9,7 +9,9 @@
|
|||
|
||||
Enture all prequisites are installed:
|
||||
- neovim
|
||||
-
|
||||
- Evertying listed in flake.nix `runtime dependencies` variable near the top of the file
|
||||
- These must be available on the path
|
||||
- Treesitter/Lazy/Mason will install all other requirements needed on other systems
|
||||
|
||||
Install neovim config (backup old version first if present):
|
||||
```
|
||||
|
|
36
flake.lock
generated
36
flake.lock
generated
|
@ -33,10 +33,44 @@
|
|||
"type": "indirect"
|
||||
}
|
||||
},
|
||||
"nvim_plugin-catppuccin/nvim": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1711706907,
|
||||
"narHash": "sha256-GQjxE8lQj52pheJtHCS+9v2lsJY7wMj2IXVCoNRmQSQ=",
|
||||
"owner": "catppuccin",
|
||||
"repo": "nvim",
|
||||
"rev": "aebe43db9cb26e1c70fc5b2fd4158169c405e720",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "catppuccin",
|
||||
"repo": "nvim",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nvim_plugin-folke/lazy.nvim": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1711740527,
|
||||
"narHash": "sha256-MyJfQS80so7COsN87aGtd6DSrDKUme6SaFGWpaQ1ZHk=",
|
||||
"owner": "folke",
|
||||
"repo": "lazy.nvim",
|
||||
"rev": "31ddbea7c10b6920c9077b66c97951ca8682d5c8",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "folke",
|
||||
"repo": "lazy.nvim",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"flake-utils": "flake-utils",
|
||||
"nixpkgs": "nixpkgs"
|
||||
"nixpkgs": "nixpkgs",
|
||||
"nvim_plugin-catppuccin/nvim": "nvim_plugin-catppuccin/nvim",
|
||||
"nvim_plugin-folke/lazy.nvim": "nvim_plugin-folke/lazy.nvim"
|
||||
}
|
||||
},
|
||||
"systems": {
|
||||
|
|
135
flake.nix
135
flake.nix
|
@ -3,54 +3,115 @@
|
|||
# Nixpkgs / NixOS version to use.
|
||||
inputs = {
|
||||
nixpkgs.url = "nixpkgs/nixos-unstable";
|
||||
flake-utils = {
|
||||
url = "github:numtide/flake-utils";
|
||||
# inputs.nixpkgs.follows = "nixpkgs";
|
||||
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;
|
||||
};
|
||||
"nvim_plugin-catppuccin/nvim" = {
|
||||
url = "github:catppuccin/nvim";
|
||||
flake = false;
|
||||
};
|
||||
};
|
||||
|
||||
outputs = { self, nixpkgs, flake-utils, ... }:
|
||||
{
|
||||
# TODO any non each system attributes here
|
||||
} // flake-utils.lib.eachDefaultSystem (system:
|
||||
outputs = { self, nixpkgs, flake-utils, ... } @ inputs:
|
||||
# Takes all top level attributes and changes them to `attribute.${system} = old value`
|
||||
flake-utils.lib.eachDefaultSystem (system:
|
||||
let
|
||||
pkgs = import nixpkgs {
|
||||
inherit system;
|
||||
};
|
||||
pkgs = nixpkgs.legacyPackages.${system};
|
||||
lib = nixpkgs.lib;
|
||||
|
||||
nvimPluginPaths = "NVIM_PLUGIN_PATHS=" + lib.generators.toLua
|
||||
{
|
||||
multiline = false;
|
||||
indent = false;
|
||||
}
|
||||
(
|
||||
builtins.foldl'
|
||||
(dirs: name:
|
||||
{
|
||||
"${name}" = inputs.${name}.outPath;
|
||||
} // dirs)
|
||||
{ }
|
||||
(builtins.filter
|
||||
(n: builtins.substring 0 12 n == "nvim_plugin-")
|
||||
(builtins.attrNames inputs))
|
||||
)
|
||||
;
|
||||
|
||||
runtimeDependencies = with pkgs; [
|
||||
cowsay
|
||||
];
|
||||
# https://zimbatm.com/notes/1000-instances-of-nixpkgs
|
||||
# Read article for why we don't do the below version
|
||||
# pkgs = import nixpkgs {
|
||||
# inherit system;
|
||||
# };
|
||||
|
||||
# TODO
|
||||
# cpsell = pkgs.nodePackages.cpsell;
|
||||
|
||||
source = nixpkgs.lib.cleanSourceWith {
|
||||
src = self;
|
||||
filter = name: type:
|
||||
let
|
||||
base = baseNameOf name;
|
||||
in
|
||||
nixpkgs.lib.cleanSourceFilter
|
||||
name
|
||||
type && (base != ".git") && (base != "flake.nix") && (base != "flake.lock");
|
||||
};
|
||||
# source = nixpkgs.lib.cleanSourceWith {
|
||||
# src = self;
|
||||
# filter = name: type:
|
||||
# let
|
||||
# base = baseNameOf name;
|
||||
# in
|
||||
# nixpkgs.lib.cleanSourceFilter
|
||||
# name
|
||||
# type && (base != ".git") && (base != "flake.nix") && (base != "flake.lock");
|
||||
# };
|
||||
in
|
||||
{
|
||||
# defaultPackage = pkgs.neovim;
|
||||
defaultPackage = pkgs.stdenv.mkDerivation {
|
||||
name = "nvim";
|
||||
nativeBuildInputs = with pkgs; [ makeWrapper rsync ];
|
||||
buildInputs = with pkgs; [ neovim ];
|
||||
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.stdenv.mkDerivation {
|
||||
# name = "nvim";
|
||||
# nativeBuildInputs = with pkgs; [ makeWrapper rsync ];
|
||||
# buildInputs = with pkgs; [ neovim cowsay ];
|
||||
|
||||
unpackPhase = ":";
|
||||
installPhase = ''
|
||||
mkdir -p $out/bin
|
||||
cp ${pkgs.neovim}/bin/nvim $out/bin/nvim
|
||||
wrapProgram $out/bin/nvim --run "
|
||||
export XDG_CONFIG_HOME=$out/config
|
||||
|
||||
"
|
||||
mkdir -p $out/share/nvim
|
||||
rsync -a ${source}/ $out/share/nvim
|
||||
'';
|
||||
# ln -s ${cpsell}/bin/cpsell $out/bin/cpsell
|
||||
# unpackPhase = ":";
|
||||
# installPhase = ''
|
||||
# mkdir -p $out/bin
|
||||
# cp ${pkgs.neovim}/bin/nvim $out/bin/nvim
|
||||
# wrapProgram $out/bin/nvim --run "
|
||||
# export XDG_CONFIG_HOME=$out/config
|
||||
# "
|
||||
# mkdir -p $out/share/nvim
|
||||
# rsync -a ${source}/ $out/share/nvim
|
||||
# ln -s ${pkgs.cowsay}/bin/cowsay $out/bin/cowsay
|
||||
# '';
|
||||
# # ln -s ${cpsell}/bin/cpsell $out/bin/cpsell
|
||||
# };
|
||||
};
|
||||
});
|
||||
|
||||
|
|
5
init.lua
5
init.lua
|
@ -1 +1,4 @@
|
|||
print("NIX FLAKE NVIM")
|
||||
NVIM_PLUGIN_PATHS = NVIM_PLUGIN_PATHS or {}
|
||||
|
||||
|
||||
require("options")
|
||||
|
|
0
lua/autocommands.lua
Normal file
0
lua/autocommands.lua
Normal file
0
lua/keymaps.lua
Normal file
0
lua/keymaps.lua
Normal file
74
lua/options.lua
Normal file
74
lua/options.lua
Normal file
|
@ -0,0 +1,74 @@
|
|||
-- global status line
|
||||
vim.opt.laststatus = 3
|
||||
|
||||
-- allow use of mouse
|
||||
vim.opt.mouse = "a"
|
||||
|
||||
-- line numbering, relative
|
||||
vim.opt.number = true
|
||||
vim.wo.number = true
|
||||
vim.wo.relativenumber = true
|
||||
|
||||
-- Highlights the results of previous search, which is annoying when we are done searching
|
||||
vim.opt.hlsearch = false
|
||||
|
||||
-- Wrap lines in files
|
||||
vim.opt.wrap = true
|
||||
|
||||
-- preseve indentation of virtual wrapped lines
|
||||
vim.opt.breakindent = true
|
||||
|
||||
-- be smart with indents
|
||||
vim.opt.smartindent = true
|
||||
|
||||
-- set tab length
|
||||
vim.opt.tabstop = 2
|
||||
vim.opt.softtabstop = 2
|
||||
vim.opt.shiftwidth = 2
|
||||
vim.opt.expandtab = true
|
||||
|
||||
-- Dont use swap files, use undotree
|
||||
vim.opt.swapfile = false
|
||||
vim.opt.backup = false
|
||||
vim.opt.undodir = os.getenv("HOME") .. "/.vim/undodir"
|
||||
vim.opt.undofile = true
|
||||
|
||||
-- Search settings
|
||||
vim.opt.hlsearch = true
|
||||
vim.opt.incsearch = true
|
||||
|
||||
-- split to the right or below always
|
||||
vim.opt.splitbelow = true
|
||||
vim.opt.splitright = true
|
||||
|
||||
-- Set completeopt to have a better completion experience
|
||||
vim.o.completeopt = "menuone,noselect"
|
||||
vim.diagnostic.config({
|
||||
float = { border = "single" },
|
||||
})
|
||||
|
||||
-- Turn on new diff
|
||||
vim.opt.diffopt:append("linematch:20")
|
||||
|
||||
-- Set screen mode
|
||||
-- vim.o.noequalalways = true
|
||||
-- vim.o.equalalways = false
|
||||
|
||||
-- enable colors for opacity changes
|
||||
vim.o.termguicolors = true
|
||||
|
||||
function dump(o)
|
||||
if type(o) == 'table' then
|
||||
local s = '{ '
|
||||
for k,v in pairs(o) do
|
||||
if type(k) ~= 'number' then k = '"'..k..'"' end
|
||||
s = s .. '['..k..'] = ' .. dump(v) .. ','
|
||||
end
|
||||
return s .. '} '
|
||||
else
|
||||
return tostring(o)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
print("NIX FLAKE NVIM: nvim package count " .. dump(NVIM_PLUGIN_PATHS))
|
0
lua/utils.lua
Normal file
0
lua/utils.lua
Normal file
Loading…
Add table
Add a link
Reference in a new issue