add separate nixvim config

This commit is contained in:
sloane 2024-04-03 08:02:10 -04:00
parent eb0f89f4e9
commit 85f0f1e98b
No known key found for this signature in database
7 changed files with 566 additions and 0 deletions

View file

@ -0,0 +1,6 @@
{
colorschemes.catppuccin = {
enable = true;
flavour = "frappe";
};
}

View file

@ -0,0 +1,9 @@
{
# Import all your configuration modules here
imports = [
./settings.nix
./plugins.nix
./keys.nix
./colorscheme.nix
];
}

View file

@ -0,0 +1,91 @@
{
plugins.which-key = {
enable = true;
keyLabels = {
"<space>" = "SPC";
"<cr>" = "RET";
"<tab>" = "TAB";
};
registrations = {
"<leader>g" = "Git";
};
};
globals.mapleader = " ";
keymaps = [
{ key = ";"; action = ":"; }
{ key = "q;"; action = "q:"; }
{ key = "<leader>y"; action = "\"+y"; }
{ key = "<leader>Y"; action = "\"+Y"; }
{ key = "<leader>p"; action = "\"+p"; }
{ key = "<leader>P"; action = "\"+P"; }
{ key = "<leader>w"; action = "<cmd>w<cr>"; }
{ key = "<leader>q"; action = "<cmd>q<cr>"; }
{ key = "<esc>"; action = "<cmd>nohlsearch<cr>"; mode = "n"; }
# root level leader commands
{
key = "<leader><space>";
action = "<cmd>Telescope find_files<cr>";
options = { desc = "Find files in project"; };
}
{
key = "<leader>/";
action = "<cmd>Telescope live_grep<cr>";
options = { desc = "Search project"; };
}
{
key = "<leader><tab>";
action = "<cmd>NERDTreeToggle<cr>";
options = { desc = "Toggle NERDTree"; };
}
# git
{
key = "<leader>gs";
action = "<cmd>Git<cr>";
options = { desc = "Status"; };
}
{
key = "<leader>gp";
action = "<cmd>Git push<cr>";
options = { desc = "Push"; };
}
{
key = "<leader>gP";
action = "<cmd>Git push --force-with-lease<cr>";
options = { desc = "Push (force with lease)"; };
}
{
key = "<leader>gf";
action = "<cmd>Git fetch<cr>";
options = { desc = "Fetch"; };
}
# git rebase
{
key = "<leader>gro";
action = "<cmd>Git rebase origin/main<cr>";
options = { desc = "origin/main"; };
}
{
key = "<leader>grO";
action = "<cmd>Git rebase --interactive origin/main<cr>";
options = { desc = "-i origin/main"; };
}
{
key = "<leader>grm";
action = "<cmd>Git rebase origin/master<cr>";
options = { desc = "origin/master"; };
}
{
key = "<leader>grM";
action = "<cmd>Git rebase --interactive origin/master<cr>";
options = { desc = "-i origin/master"; };
}
];
}

View file

@ -0,0 +1,63 @@
{ pkgs, ... }:
{
extraPlugins = with pkgs.vimPlugins; [
vim-abolish
vim-dispatch
vim-repeat
vim-sensible
vim-rhubarb
vim-sort-motion
vim-textobj-user
nerdtree
];
plugins = {
surround.enable = true;
commentary.enable = true;
fugitive.enable = true;
tmux-navigator.enable = true;
lsp = {
enable = true;
servers = {
elixirls.enable = true;
tsserver.enable = true;
nil_ls.enable = true;
};
};
telescope = {
enable = true;
defaults = { preview = false; };
extensions.fzf-native.enable = true;
};
cmp = {
enable = true;
autoEnableSources = true;
settings.sources = [
{ name = "nvim_lsp"; }
{ name = "path"; }
{ name = "buffer"; }
];
cmdline = {
":" = {
mapping = { __raw = "cmp.mapping.preset.cmdline()"; };
sources = [
{ name = "path"; }
{ name = "cmdline"; }
];
};
};
};
treesitter = {
enable = true;
indent = true;
};
};
}

View file

@ -0,0 +1,10 @@
{
config.options = {
number = true;
relativenumber = true;
tabstop = 2;
shiftwidth = 2;
expandtab = true;
};
}

336
.config/nixvim/flake.lock Normal file
View file

@ -0,0 +1,336 @@
{
"nodes": {
"devshell": {
"inputs": {
"flake-utils": "flake-utils",
"nixpkgs": [
"nixvim",
"nixpkgs"
]
},
"locked": {
"lastModified": 1711099426,
"narHash": "sha256-HzpgM/wc3aqpnHJJ2oDqPBkNsqWbW0WfWUO8lKu8nGk=",
"owner": "numtide",
"repo": "devshell",
"rev": "2d45b54ca4a183f2fdcf4b19c895b64fbf620ee8",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "devshell",
"type": "github"
}
},
"flake-compat": {
"locked": {
"lastModified": 1696426674,
"narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=",
"rev": "0f9255e01c2351cc7d116c072cb317785dd33b33",
"revCount": 57,
"type": "tarball",
"url": "https://api.flakehub.com/f/pinned/edolstra/flake-compat/1.0.1/018afb31-abd1-7bff-a5e4-cff7e18efb7a/source.tar.gz"
},
"original": {
"type": "tarball",
"url": "https://flakehub.com/f/edolstra/flake-compat/1.tar.gz"
}
},
"flake-compat_2": {
"flake": false,
"locked": {
"lastModified": 1696426674,
"narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=",
"owner": "edolstra",
"repo": "flake-compat",
"rev": "0f9255e01c2351cc7d116c072cb317785dd33b33",
"type": "github"
},
"original": {
"owner": "edolstra",
"repo": "flake-compat",
"type": "github"
}
},
"flake-parts": {
"inputs": {
"nixpkgs-lib": "nixpkgs-lib"
},
"locked": {
"lastModified": 1709336216,
"narHash": "sha256-Dt/wOWeW6Sqm11Yh+2+t0dfEWxoMxGBvv3JpIocFl9E=",
"owner": "hercules-ci",
"repo": "flake-parts",
"rev": "f7b3c975cf067e56e7cda6cb098ebe3fb4d74ca2",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"repo": "flake-parts",
"type": "github"
}
},
"flake-parts_2": {
"inputs": {
"nixpkgs-lib": [
"nixvim",
"nixpkgs"
]
},
"locked": {
"lastModified": 1709336216,
"narHash": "sha256-Dt/wOWeW6Sqm11Yh+2+t0dfEWxoMxGBvv3JpIocFl9E=",
"owner": "hercules-ci",
"repo": "flake-parts",
"rev": "f7b3c975cf067e56e7cda6cb098ebe3fb4d74ca2",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"repo": "flake-parts",
"type": "github"
}
},
"flake-utils": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1701680307,
"narHash": "sha256-kAuep2h5ajznlPMD9rnQyffWG8EM/C73lejGofXvdM8=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "4022d587cbbfd70fe950c1e2083a02621806a725",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"flake-utils_2": {
"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"
}
},
"gitignore": {
"inputs": {
"nixpkgs": [
"nixvim",
"pre-commit-hooks",
"nixpkgs"
]
},
"locked": {
"lastModified": 1709087332,
"narHash": "sha256-HG2cCnktfHsKV0s4XW83gU3F57gaTljL9KNSuG6bnQs=",
"owner": "hercules-ci",
"repo": "gitignore.nix",
"rev": "637db329424fd7e46cf4185293b9cc8c88c95394",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"repo": "gitignore.nix",
"type": "github"
}
},
"home-manager": {
"inputs": {
"nixpkgs": [
"nixvim",
"nixpkgs"
]
},
"locked": {
"lastModified": 1711133180,
"narHash": "sha256-WJOahf+6115+GMl3wUfURu8fszuNeJLv9qAWFQl3Vmo=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "1c2c5e4cabba4c43504ef0f8cc3f3dfa284e2dbb",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "home-manager",
"type": "github"
}
},
"nix-darwin": {
"inputs": {
"nixpkgs": [
"nixvim",
"nixpkgs"
]
},
"locked": {
"lastModified": 1710717205,
"narHash": "sha256-Wf3gHh5uV6W1TV/A8X8QJf99a5ypDSugY4sNtdJDe0A=",
"owner": "lnl7",
"repo": "nix-darwin",
"rev": "bcc8afd06e237df060c85bad6af7128e05fd61a3",
"type": "github"
},
"original": {
"owner": "lnl7",
"repo": "nix-darwin",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1711163522,
"narHash": "sha256-YN/Ciidm+A0fmJPWlHBGvVkcarYWSC+s3NTPk/P+q3c=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "44d0940ea560dee511026a53f0e2e2cde489b4d4",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs-lib": {
"locked": {
"dir": "lib",
"lastModified": 1709237383,
"narHash": "sha256-cy6ArO4k5qTx+l5o+0mL9f5fa86tYUX3ozE1S+Txlds=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "1536926ef5621b09bba54035ae2bb6d806d72ac8",
"type": "github"
},
"original": {
"dir": "lib",
"owner": "NixOS",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_2": {
"locked": {
"lastModified": 1711001935,
"narHash": "sha256-URtGpHue7HHZK0mrHnSf8wJ6OmMKYSsoLmJybrOLFSQ=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "20f77aa09916374aa3141cbc605c955626762c9a",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixvim": {
"inputs": {
"devshell": "devshell",
"flake-compat": "flake-compat",
"flake-parts": "flake-parts_2",
"home-manager": "home-manager",
"nix-darwin": "nix-darwin",
"nixpkgs": "nixpkgs_2",
"pre-commit-hooks": "pre-commit-hooks"
},
"locked": {
"lastModified": 1711199922,
"narHash": "sha256-Oz5WNOPp95K4JLyoNQKyEdaUM5JzliC62jwTpGPqYNE=",
"owner": "nix-community",
"repo": "nixvim",
"rev": "7170aad28139cd3629b2b6ce4c9272bf41c2ad45",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "nixvim",
"type": "github"
}
},
"pre-commit-hooks": {
"inputs": {
"flake-compat": "flake-compat_2",
"flake-utils": "flake-utils_2",
"gitignore": "gitignore",
"nixpkgs": [
"nixvim",
"nixpkgs"
],
"nixpkgs-stable": [
"nixvim",
"nixpkgs"
]
},
"locked": {
"lastModified": 1710923068,
"narHash": "sha256-6hOpUiuxuwpXXc/xfJsBUJeqqgGI+JMJuLo45aG3cKc=",
"owner": "cachix",
"repo": "pre-commit-hooks.nix",
"rev": "e611897ddfdde3ed3eaac4758635d7177ff78673",
"type": "github"
},
"original": {
"owner": "cachix",
"repo": "pre-commit-hooks.nix",
"type": "github"
}
},
"root": {
"inputs": {
"flake-parts": "flake-parts",
"nixpkgs": "nixpkgs",
"nixvim": "nixvim"
}
},
"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"
}
}
},
"root": "root",
"version": 7
}

51
.config/nixvim/flake.nix Normal file
View file

@ -0,0 +1,51 @@
{
description = "sloane's neovim config via nix";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
nixvim.url = "github:nix-community/nixvim";
flake-parts.url = "github:hercules-ci/flake-parts";
};
outputs = {
nixvim,
flake-parts,
...
} @ inputs:
flake-parts.lib.mkFlake {inherit inputs;} {
systems = [
"x86_64-linux"
"aarch64-linux"
"x86_64-darwin"
"aarch64-darwin"
];
perSystem = {
pkgs,
system,
...
}: let
nixvimLib = nixvim.lib.${system};
nixvim' = nixvim.legacyPackages.${system};
nixvimModule = {
inherit pkgs;
module = import ./config; # import the module directly
# You can use `extraSpecialArgs` to pass additional arguments to your module files
extraSpecialArgs = {
# inherit (inputs) foo;
};
};
nvim = nixvim'.makeNixvimWithModule nixvimModule;
in {
checks = {
# Run `nix flake check .` to verify that your config is not broken
default = nixvimLib.check.mkTestDerivationFromNixvimModule nixvimModule;
};
packages = {
# Lets you run `nix run .` to start nixvim
default = nvim;
};
};
};
}