From d1c821eced6e1ae02b4e0b303cd8388d38e6943c Mon Sep 17 00:00:00 2001 From: Cody Hiar Date: Fri, 10 Jun 2022 12:22:55 -0600 Subject: Add nix linting and fixing --- flake.nix | 8 ++++---- init.lua | 3 +++ nix/flake8-isort.nix | 1 + nix/mypython.nix | 1 + nix/vale.nix | 1 + 5 files changed, 10 insertions(+), 4 deletions(-) diff --git a/flake.nix b/flake.nix index 00d34bc..a062e6d 100644 --- a/flake.nix +++ b/flake.nix @@ -1,9 +1,7 @@ { description = "My Completely Inelegant Neovim Flake"; - inputs = { - nixpkgs.url = "nixpkgs/nixos-unstable"; - }; + inputs = { nixpkgs.url = "nixpkgs/nixos-unstable"; }; outputs = { self, nixpkgs, ... }@inputs: let @@ -23,7 +21,8 @@ # 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 { }; + vim-angry-reviewer = + super.callPackage ./nix/vim-angry-reviewer.nix { }; }) ]; }; @@ -112,6 +111,7 @@ nodePackages.bash-language-server shellcheck hadolint + nixfmt ] } makeWrapper ${myneovim}/bin/nvim $out/bin/nvim --prefix PATH : $BINPATH diff --git a/init.lua b/init.lua index f3a8e9c..eeb0382 100644 --- a/init.lua +++ b/init.lua @@ -314,17 +314,20 @@ require'hop'.setup { keys = 'etovxqpdygfblzhckisuran' } -- ale vim.g.ale_lint_on_save = 1 +vim.g.ale_fix_on_save = 1 vim.g.ale_linters = { sh = { "shellcheck", }, python = { "flake8" }, dockerfile = { "hadolint" }, terraform = { "terraform_ls" }, markdown = { "vale" }, + nix = { "nix" }, } vim.g.ale_fixers = { sh = { "shfmt", }, python = { "isort", "black" }, terraform = { "terraform" }, + nix = { "nixfmt" }, } vim.cmd([[ autocmd BufRead *.py :ALEFix diff --git a/nix/flake8-isort.nix b/nix/flake8-isort.nix index ce27161..385e4f7 100644 --- a/nix/flake8-isort.nix +++ b/nix/flake8-isort.nix @@ -1,4 +1,5 @@ { buildPythonPackage, fetchPypi, python3Packages }: + buildPythonPackage rec { pname = "flake8-isort"; version = "4.1.1"; diff --git a/nix/mypython.nix b/nix/mypython.nix index 9906fa7..524ec51 100644 --- a/nix/mypython.nix +++ b/nix/mypython.nix @@ -1,4 +1,5 @@ { python3, flake8-isort }: + let my-python-packages = python-packages: with python-packages; [ diff --git a/nix/vale.nix b/nix/vale.nix index c1fd15d..f33b2ba 100644 --- a/nix/vale.nix +++ b/nix/vale.nix @@ -1,4 +1,5 @@ { lib, buildGoModule, fetchFromGitHub }: + buildGoModule rec { pname = "vale"; version = "2.17.0"; -- cgit v1.2.3