aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCody Hiar <cody@hiar.ca>2022-06-08 21:12:27 -0600
committerCody Hiar <cody@hiar.ca>2022-06-08 21:12:27 -0600
commit1dfb0beddb27cd5420214f875f484621ac86bdb6 (patch)
treeba770882dfa58dd60aabbf9ec975ecb22c4b90b7
parentbd3fe5b914b521279fcfb08aa8c5e58037cbe4f8 (diff)
Cleaning up
-rw-r--r--README.md15
-rw-r--r--flake.lock19
-rw-r--r--flake.nix206
-rw-r--r--init.vim.backup60
-rwxr-xr-xinstall9
-rw-r--r--nix/flake8-isort.nix1
-rw-r--r--nix/mypython.nix19
-rw-r--r--nix/vale.nix5
-rw-r--r--nix/vim-angry-reviewer.nix12
9 files changed, 141 insertions, 205 deletions
diff --git a/README.md b/README.md
index 349a53b..aa25ed6 100644
--- a/README.md
+++ b/README.md
@@ -1,3 +1,14 @@
-# Neovim Setup
+# Neovim flake
-Run with `nix run git+https://git.codyhiar.com/config/nvim`
+A [Nixos Flake][1] for Neovim. Installs binary packages, plugins, and
+`init.lua`. To use on existing nix setup, run:
+
+```
+nix run git+https://git.codyhiar.com/config/nvim
+```
+
+The flake is intentionally kept as simple as possible. When I read other
+examples online, they were not always easy to follow. The `flake.nix` tries to
+stick to the interface described in the [Nixos Wiki][1] without using any magic.
+
+[1]: https://nixos.wiki/wiki/Flakes
diff --git a/flake.lock b/flake.lock
index cb3c5ec..c00c3dd 100644
--- a/flake.lock
+++ b/flake.lock
@@ -17,24 +17,7 @@
},
"root": {
"inputs": {
- "nixpkgs": "nixpkgs",
- "vim-angry-reviewer": "vim-angry-reviewer"
- }
- },
- "vim-angry-reviewer": {
- "flake": false,
- "locked": {
- "lastModified": 1643181068,
- "narHash": "sha256-06V+aAnL2ER5yP26VQWVRP0yB4SpB28RX4K38bm52y4=",
- "owner": "anufrievroman",
- "repo": "vim-angry-reviewer",
- "rev": "9bf1179c71b8137a2d4845d4dfe477b08ac5b85b",
- "type": "github"
- },
- "original": {
- "owner": "anufrievroman",
- "repo": "vim-angry-reviewer",
- "type": "github"
+ "nixpkgs": "nixpkgs"
}
}
},
diff --git a/flake.nix b/flake.nix
index 04799d0..00d34bc 100644
--- a/flake.nix
+++ b/flake.nix
@@ -3,118 +3,120 @@
inputs = {
nixpkgs.url = "nixpkgs/nixos-unstable";
- vim-angry-reviewer = {
- url = "github:anufrievroman/vim-angry-reviewer";
- flake = false;
- };
};
outputs = { self, nixpkgs, ... }@inputs:
- let
- system = "x86_64-linux";
- pkgs = import nixpkgs {
- inherit system;
- overlays = [
- (self: super: {
- vale = super.callPackage ./nix/vale.nix { };
- flake8-isort = super.python3Packages.callPackage ./nix/flake8-isort.nix { };
- mypython = super.python3Packages.callPackage ./nix/mypython.nix { };
- })
- ];
- };
- in rec {
- # For nix < 2.7
- # For nix >= 2.7 they should grab automatically from:
- # apps.${system}.default
- # packages.${system}.default
- defaultApp.${system} = apps.${system}.default;
- defaultPackage.${system} = packages.${system}.default;
-
- apps.${system} = rec {
- nvim = {
- type = "app";
- program = "${packages.${system}.default}/bin/nvim";
+ let
+ system = "x86_64-linux";
+ pkgs = import nixpkgs {
+ inherit system;
+ # This is where I import any custom packages that I want to install. By
+ # placing them in the overlay the become available in 'pkgs' further
+ # below.
+ overlays = [
+ (self: super: {
+ # Kept having issues with ones in stable and unstable so built custom revision
+ vale = super.callPackage ./nix/vale.nix { };
+ # Wasn't packaged
+ flake8-isort =
+ super.python3Packages.callPackage ./nix/flake8-isort.nix { };
+ # Python with linting and such
+ mypython = super.python3Packages.callPackage ./nix/mypython.nix { };
+ # Wasn't packaged
+ vim-angry-reviewer = super.callPackage ./nix/vim-angry-reviewer.nix { };
+ })
+ ];
};
- default = nvim;
- };
- # Read the init.lua from the repo.
- initfile = pkgs.lib.readFile ./init.lua;
- packages.${system} = with pkgs; let
- # Vim angry reviewer wasn't packaged when I build this. Easy enough to
- # package myself.
- vim-angry-reviewer = vimUtils.buildVimPluginFrom2Nix {
- pname = "vim-angry-reviewer";
- version = "HEAD";
- src = inputs.vim-angry-reviewer;
+ in rec {
+ # For nix < 2.7
+ # For nix >= 2.7 they should grab automatically from:
+ # apps.${system}.default
+ # packages.${system}.default
+ defaultApp.${system} = apps.${system}.default;
+ defaultPackage.${system} = packages.${system}.default;
+
+ apps.${system} = rec {
+ nvim = {
+ type = "app";
+ program = "${packages.${system}.default}/bin/nvim";
+ };
+ default = nvim;
};
- # My custom neovim with my init file and all the plugins I use.
- myneovim = (neovim.override {
- configure = {
- customRC = ''
- lua << EOF
- ${initfile}
- EOF
- '';
- packages.myPlugins = with vimPlugins; {
- start = [
- # Colorscheme
- nord-nvim
+ packages.${system} = with pkgs;
+ let
+ # My custom neovim with my init file and all the plugins I use.
+ myneovim = (neovim.override {
+ configure = {
+ # customRC expects vimscript but I've already converted to lua
+ customRC = ''
+ lua << EOF
+ ${pkgs.lib.readFile ./init.lua}
+ EOF
+ '';
+ packages.myPlugins = with vimPlugins; {
+ start = [
+ # Colorscheme
+ nord-nvim
- # Syntax coloring
- nvim-ts-rainbow
- (nvim-treesitter.withPlugins (plugins: tree-sitter.allGrammars))
+ # Syntax coloring
+ nvim-ts-rainbow
+ (nvim-treesitter.withPlugins
+ (plugins: tree-sitter.allGrammars))
- # Autocompletes
- nvim-lspconfig
- nvim-cmp
- cmp-nvim-lsp
+ # Autocompletes
+ nvim-lspconfig
+ nvim-cmp
+ cmp-nvim-lsp
- # File navigation
- lf-vim
- vim-floaterm
+ # File navigation
+ lf-vim
+ vim-floaterm
- # The rest
- vim-commentary
- vim-surround
- vim-repeat
- fzf-vim
- vim-argwrap
- vim-fugitive
- indent-blankline-nvim
- camelcasemotion
- hop-nvim
- ale
- goyo-vim
- vim-oscyank
- ack-vim
- vim-angry-reviewer
- ];
+ # The rest
+ vim-commentary
+ vim-surround
+ vim-repeat
+ fzf-vim
+ vim-argwrap
+ vim-fugitive
+ indent-blankline-nvim
+ camelcasemotion
+ hop-nvim
+ ale
+ goyo-vim
+ vim-oscyank
+ ack-vim
+ vim-angry-reviewer
+ ];
+ };
+ };
+ });
+ in rec {
+ default = neovimCH;
+ # symlinkJoin might not be the best solution here but it worked so I
+ # just use it for now.
+ neovimCH = symlinkJoin {
+ name = "neovim";
+ paths = [ myneovim ];
+ buildInputs = [ pkgs.makeWrapper ];
+ postBuild = with pkgs; ''
+ rm $out/bin/nvim
+ BINPATH=${
+ lib.makeBinPath [
+ gcc
+ nodejs
+ mypython
+ pyright
+ vale
+ tree-sitter
+ nodePackages.bash-language-server
+ shellcheck
+ hadolint
+ ]
+ }
+ makeWrapper ${myneovim}/bin/nvim $out/bin/nvim --prefix PATH : $BINPATH
+ '';
};
};
- });
- in
- rec {
- default = neovimCH;
- neovimCH = symlinkJoin {
- name = "neovim";
- paths = [ myneovim ];
- buildInputs = [ pkgs.makeWrapper ];
- postBuild = with pkgs; ''
- rm $out/bin/nvim
- BINPATH=${lib.makeBinPath [
- gcc
- nodejs
- mypython
- pyright
- vale
- tree-sitter
- nodePackages.bash-language-server
- shellcheck
- hadolint
- ]}
- makeWrapper ${myneovim}/bin/nvim $out/bin/nvim --prefix PATH : $BINPATH
- '';
- };
};
- };
}
diff --git a/init.vim.backup b/init.vim.backup
deleted file mode 100644
index 0c5b1ae..0000000
--- a/init.vim.backup
+++ /dev/null
@@ -1,60 +0,0 @@
-"-----------------------------------------------------------------------------------------------------------------------
-" Plugins
-"----------------------------------------------------------------------------------------------------------------------
-call plug#begin('~/.config/nvim/plugged')
-
-Plug 'gcmt/taboo.vim' " Rename Tabs
-Plug 'jremmen/vim-ripgrep' " Use ripgrep for search
-Plug 'FooSoft/vim-argwrap' " Wrap or unwrap arguments to functions
-Plug 'w0rp/ale' " Async linting
-Plug 'tpope/vim-commentary' " Better commenting commands
-Plug 'tpope/vim-fugitive' " Git integration with vim
-Plug 'tpope/vim-surround' " Helps with surrounding text
-Plug 'tpope/vim-repeat' " Enable Repeating of plugin maps
-Plug 'Thornycrackers-Forks/nord-vim' " Pretty colorscheme
-Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' } " Autocomplete
-Plug 'deoplete-plugins/deoplete-jedi' " Jedi integration with deoplete
-" can't find plugin right now
-Plug 'rbgrouleff/bclose.vim' " Ranger dep for neovim
-Plug 'francoiscabrol/ranger.vim' " Ranger integration
-Plug 'nathanaelkane/vim-indent-guides' " Creates indent lines, makes code a bit easier to read
-Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' } " Install fzf
-Plug 'junegunn/fzf.vim' " fzf integration
-Plug 'eapache/rainbow_parentheses.vim' " Colored Brackets
-Plug 'saltstack/salt-vim' " Salt file plugin
-Plug 'Thornycrackers-Forks/vim-markdown' " Markdown highlighting
-Plug 'dkarter/bullets.vim' " Better bullet list handling
-Plug 'reedes/vim-pencil' " Writing utility
-Plug 'junegunn/goyo.vim' " Distraction Free writing
-Plug 'mattn/emmet-vim' " Html expansion plugin
-Plug 'majutsushi/tagbar' " Tagbar explorer
-Plug 'hashivim/vim-terraform' " Terraform plugin
-Plug 'godlygeek/tabular' " Formatting code
-Plug 'vim-scripts/camelcasemotion' " Additional word objects
-Plug 'LnL7/vim-nix' " Nix for vim
-Plug 'easymotion/vim-easymotion' " faster jumping
-Plug 'ervandew/supertab' " Tab for complete
-Plug 'z0mbix/vim-shfmt', { 'for': 'sh' } " Format shell scripts
-
-" File Type Specific
-Plug 'ledger/vim-ledger' " Ledger plugin
-Plug 'python-mode/python-mode' " Python awesomeness in vim
-Plug 'chr4/nginx.vim' " nginx goodness
-Plug 'Glench/Vim-Jinja2-Syntax' " Jinja Syntax
-
-" My custom options
-Plug 'https://git.codyhiar.com/config/vim-options'
-
-call plug#end()
-
-" These options don't work inside vim-options
-let g:ale_lint_on_text_changed = 'never'
-let g:ale_lint_on_enter = 0
-
-" Deoplete
-let g:deoplete#enable_at_startup = 1
-
-" Manually set python cause NixOS
-" Need for figure out how to do this correctly
-let g:deoplete#sources#jedi#python_path = '/nix/store/v4kkz8a1lf4y21dyq8qwhyr2nvl5n0i3-python3-3.8.5-env/bin/python3'
-"-----------------------------------------------------------------------------------------------------------------------
diff --git a/install b/install
deleted file mode 100755
index 1eca5e0..0000000
--- a/install
+++ /dev/null
@@ -1,9 +0,0 @@
-#!/usr/bin/env bash
-
-readonly PLUG_FILE="${HOME}/.config/nvim/autoload/plug.vim"
-readonly PLUG_URL="https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim"
-
-# Install plug if it doesn't exist
-[[ ! -f "${PLUG_FILE}" ]] && curl -fLo "${PLUG_FILE}" --create-dirs "${PLUG_URL}" &> /dev/null
-# Install neovim plugins
-nvim -i NONE -c PlugInstall -c quitall > /dev/null 2>&1
diff --git a/nix/flake8-isort.nix b/nix/flake8-isort.nix
index 385e4f7..ce27161 100644
--- a/nix/flake8-isort.nix
+++ b/nix/flake8-isort.nix
@@ -1,5 +1,4 @@
{ buildPythonPackage, fetchPypi, python3Packages }:
-
buildPythonPackage rec {
pname = "flake8-isort";
version = "4.1.1";
diff --git a/nix/mypython.nix b/nix/mypython.nix
index aa262d4..9906fa7 100644
--- a/nix/mypython.nix
+++ b/nix/mypython.nix
@@ -1,13 +1,12 @@
{ python3, flake8-isort }:
-
let
- my-python-packages = python-packages: with python-packages; [
- jedi-language-server
- flake8
- flake8-isort
- isort
- black
- ];
+ my-python-packages = python-packages:
+ with python-packages; [
+ jedi-language-server
+ flake8
+ flake8-isort
+ isort
+ black
+ ];
mypython = python3.withPackages my-python-packages;
-in
-mypython
+in mypython
diff --git a/nix/vale.nix b/nix/vale.nix
index 396f0b7..c1fd15d 100644
--- a/nix/vale.nix
+++ b/nix/vale.nix
@@ -1,5 +1,4 @@
{ lib, buildGoModule, fetchFromGitHub }:
-
buildGoModule rec {
pname = "vale";
version = "2.17.0";
@@ -13,8 +12,8 @@ buildGoModule rec {
};
vendorSha256 = "sha256-zdgLWEArmtHTDM844LoSJwKp0UGoAR8bHnFOSlrrjdg=";
postInstall = ''
- mkdir -p $data/share/vale
- cp -r styles $data/share/vale
+ mkdir -p $data/share/vale
+ cp -r styles $data/share/vale
'';
ldflags = [ "-s" "-w" "-X main.version=${version}" ];
}
diff --git a/nix/vim-angry-reviewer.nix b/nix/vim-angry-reviewer.nix
new file mode 100644
index 0000000..7e09551
--- /dev/null
+++ b/nix/vim-angry-reviewer.nix
@@ -0,0 +1,12 @@
+{ vimUtils, fetchFromGitHub }:
+
+vimUtils.buildVimPluginFrom2Nix {
+ pname = "vim-angry-reviewer";
+ version = "HEAD";
+ src = fetchFromGitHub {
+ owner = "anufrievroman";
+ repo = "vim-angry-reviewer";
+ rev = "9bf1179";
+ sha256 = "sha256-PUaIx6rEaLz0HUxkglsVHw0Kx/ovI2f4Yhknuysr5Gs=";
+ };
+}