From 164704220b09e0f18f8be918f9fde025355f0dcd Mon Sep 17 00:00:00 2001 From: Cody Hiar Date: Sun, 5 Jun 2022 13:47:31 -0600 Subject: Get a basic flake set up --- flake.lock | 26 ++++++++++++++++++++++++++ flake.nix | 42 ++++++++++++++++++++++++++++++++++++++++++ init.lua | 15 +++++++++++++++ nix/flake8-isort.nix | 11 +++++++++++ nix/mypython.nix | 13 +++++++++++++ nix/vale.nix | 20 ++++++++++++++++++++ 6 files changed, 127 insertions(+) create mode 100644 flake.lock create mode 100644 flake.nix create mode 100644 nix/flake8-isort.nix create mode 100644 nix/mypython.nix create mode 100644 nix/vale.nix diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..c00c3dd --- /dev/null +++ b/flake.lock @@ -0,0 +1,26 @@ +{ + "nodes": { + "nixpkgs": { + "locked": { + "lastModified": 1654230545, + "narHash": "sha256-8Vlwf0x8ow6pPOK2a04bT+pxIeRnM1+O0Xv9/CuDzRs=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "236cc2971ac72acd90f0ae3a797f9f83098b17ec", + "type": "github" + }, + "original": { + "id": "nixpkgs", + "ref": "nixos-unstable", + "type": "indirect" + } + }, + "root": { + "inputs": { + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..87fffd5 --- /dev/null +++ b/flake.nix @@ -0,0 +1,42 @@ +{ + description = "My Completely Inelegant Neovim Flake"; + + inputs = { + nixpkgs.url = "nixpkgs/nixos-unstable"; + }; + + outputs = { self, nixpkgs }: + 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 { + packages.${system}.neovimCH = with pkgs; symlinkJoin { + name = "neovim"; + paths = [ pkgs.neovim ]; + buildInputs = [ pkgs.makeWrapper ]; + postBuild = with pkgs; '' + rm $out/bin/nvim + BINPATH=${lib.makeBinPath [ + nodejs + mypython + pyright + vale + tree-sitter + nodePackages.bash-language-server + shellcheck + hadolint + ]} + makeWrapper ${neovim}/bin/nvim $out/bin/nvim --prefix PATH : $BINPATH + ''; + }; + }; +} diff --git a/init.lua b/init.lua index 59efa86..e62906e 100644 --- a/init.lua +++ b/init.lua @@ -103,6 +103,8 @@ vim.api.nvim_set_keymap('n', 'cp', "cprev", { noremap = true }) vim.api.nvim_set_keymap('n', 'cn', "cnext", { noremap = true }) vim.api.nvim_set_keymap('n', 'lp', "lprev", { noremap = true }) vim.api.nvim_set_keymap('n', 'ln', "lnext", { noremap = true }) +vim.api.nvim_set_keymap('n', 'lo', "lopen", { noremap = true }) +vim.api.nvim_set_keymap('n', 'lc', "lclose", { noremap = true }) -- Visually select line without ending vim.api.nvim_set_keymap('n', 'v', '^v$h', { noremap = true }) -- Ledger Shortcuts @@ -387,11 +389,15 @@ return require('packer').startup(function() use { 'dense-analysis/ale', config = function() + -- vim.g.ale_set_quickfix = 1 + -- vim.g.ale_open_list = 1 + vim.g.ale_lint_on_save = 1 vim.g.ale_linters = { sh = { "shellcheck", }, python = { "flake8" }, dockerfile = { "hadolint" }, terraform = { "terraform_ls" }, + markdown = { "vale" }, } vim.g.ale_fixers = { sh = { "shfmt", }, @@ -411,6 +417,15 @@ return require('packer').startup(function() end } use 'hashivim/vim-terraform' + use { + 'anufrievroman/vim-angry-reviewer', + config = function() + vim.g.AngryReviewerEnglish = 'american' + vim.cmd([[ + autocmd BufWrite *.md :AngryReviewer + ]]) + end + } use { 'mileszs/ack.vim', config = function() diff --git a/nix/flake8-isort.nix b/nix/flake8-isort.nix new file mode 100644 index 0000000..385e4f7 --- /dev/null +++ b/nix/flake8-isort.nix @@ -0,0 +1,11 @@ +{ buildPythonPackage, fetchPypi, python3Packages }: + +buildPythonPackage rec { + pname = "flake8-isort"; + version = "4.1.1"; + src = fetchPypi { + inherit pname version; + sha256 = "2BQwSrcObliFm8XD4iHi5ucclY5wBSOSAv7hnCT4Jxc="; + }; + checkInputs = with python3Packages; [ flake8 isort pytest testfixtures ]; +} diff --git a/nix/mypython.nix b/nix/mypython.nix new file mode 100644 index 0000000..aa262d4 --- /dev/null +++ b/nix/mypython.nix @@ -0,0 +1,13 @@ +{ python3, flake8-isort }: + +let + my-python-packages = python-packages: with python-packages; [ + jedi-language-server + flake8 + flake8-isort + isort + black + ]; + mypython = python3.withPackages my-python-packages; +in +mypython diff --git a/nix/vale.nix b/nix/vale.nix new file mode 100644 index 0000000..396f0b7 --- /dev/null +++ b/nix/vale.nix @@ -0,0 +1,20 @@ +{ lib, buildGoModule, fetchFromGitHub }: + +buildGoModule rec { + pname = "vale"; + version = "2.17.0"; + subPackages = [ "cmd/vale" ]; + outputs = [ "out" "data" ]; + src = fetchFromGitHub { + owner = "errata-ai"; + repo = "vale"; + rev = "v${version}"; + sha256 = "sha256-PUaIx6rEaLz0HUxkglsVHw0Kx/ovI2f4Yhknuysr5Gs="; + }; + vendorSha256 = "sha256-zdgLWEArmtHTDM844LoSJwKp0UGoAR8bHnFOSlrrjdg="; + postInstall = '' + mkdir -p $data/share/vale + cp -r styles $data/share/vale + ''; + ldflags = [ "-s" "-w" "-X main.version=${version}" ]; +} -- cgit v1.2.3