From ffbeff7cae6bccb538a77df345465c637897b55c Mon Sep 17 00:00:00 2001 From: Thorn Avery Date: Fri, 30 Oct 2020 10:54:07 +1300 Subject: [PATCH] initial commit --- README.md | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ flake.lock | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ flake.nix | 36 ++++++++++++++++++++++++++++++++++++ overlay.nix | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 201 insertions(+) create mode 100644 README.md create mode 100644 flake.lock create mode 100644 flake.nix create mode 100644 overlay.nix diff --git a/README.md b/README.md new file mode 100644 index 0000000..ae6f973 --- /dev/null +++ b/README.md @@ -0,0 +1,50 @@ +# tA's vim flake + +this is a reproducible setup for my vim setup, including plugins and configuration. + +## installation + +requires a system capable of using nix flakes. + +in order to try out temporarily: + +``` +nix shell github:techieAgnostic/vim --command vim +``` + +in order to add to an existing nix flakes configuration, simply add: + +``` +inputs.ta-vim.url = "github:techieAgnostic/vim"; +``` + +which exposes the overlay `ta-vim.overlay` which can be added to your `nixpkgs.overlays`. + +the overlay adds the package `ta.vim` which can be used as normal. + +## adding plugins + +plugins that exist in the nixpkg's repository can be added by name to the `vimrcConfig.pathogen.pluginNames` list in order to be loaded. + +plugins that don't exist in nixpkgs can be added manually, in order to do so, first create an input for the git repository you wish to source from, for example, in order to add hoon highlighting: + +``` +inputs.hoon-vim-src = { + url = "github:urbit/urbit"; + flake = false; +}; +``` + +(make sure to add the new `hoon-vim-src` to the `outputs` function arguments. +then add the following to `customPlugins`: + +``` +hoon-vim = pkgs.vimUtils.buildVimPlugin { + name = "hoon-vim"; + src = hoon-vim-src + "/extras/hoon.vim"; +}; +``` + +(the addition to the src path is for repos that contain a vim plugin among other things, and can be left off unless needed). + +now, `hoon-vim` can be added to `vimrcConfig.pathogen.pluginNames` like any other plugin. diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..63423d6 --- /dev/null +++ b/flake.lock @@ -0,0 +1,60 @@ +{ + "nodes": { + "flake-utils": { + "locked": { + "lastModified": 1601282935, + "narHash": "sha256-WQAFV6sGGQxrRs3a+/Yj9xUYvhTpukQJIcMbIi7LCJ4=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "588973065fce51f4763287f0fda87a174d78bf48", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1603758576, + "narHash": "sha256-xKFmWVx+rFInBao3gtmvXcd0LjHD1+0c1Ef5PJDrbuM=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "1dc37370c489b610f8b91d7fdd40633163ffbafd", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "rainbow-vim-src": { + "flake": false, + "locked": { + "lastModified": 1547370678, + "narHash": "sha256-zha3BNZXJSgEWEyh8fcy1+x3Y+c1DV1eTMa/AQ+sj7M=", + "owner": "frazrepo", + "repo": "vim-rainbow", + "rev": "a6c7fd5a2b0193b5dbd03f62ad820b521dea3290", + "type": "github" + }, + "original": { + "owner": "frazrepo", + "repo": "vim-rainbow", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs", + "rainbow-vim-src": "rainbow-vim-src" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..43eb17d --- /dev/null +++ b/flake.nix @@ -0,0 +1,36 @@ +{ + description = "tA's vim setup"; + inputs = { + nixpkgs = { + url = "github:NixOS/nixpkgs/nixos-unstable"; + }; + + flake-utils = { + url = "github:numtide/flake-utils"; + }; + + rainbow-vim-src = { + url = "github:frazrepo/vim-rainbow"; + flake = false; + }; + }; + outputs = { self, nixpkgs, flake-utils, rainbow-vim-src, ... }: + let + customPlugins = pkgs: { + rainbow-vim = pkgs.vimUtils.buildVimPlugin { + name = "rainbow-vim"; + src = rainbow-vim-src; + }; + }; + in flake-utils.lib.eachDefaultSystem (system: + let + pkgs = import nixpkgs { + overlays = [ ((import ./overlay.nix) customPlugins) ]; + inherit system; + }; + in { + defaultPackage = pkgs.ta.vim; + }) // { + overlay = (import ./overlay.nix) customPlugins; + }; +} diff --git a/overlay.nix b/overlay.nix new file mode 100644 index 0000000..10feb14 --- /dev/null +++ b/overlay.nix @@ -0,0 +1,55 @@ +customPlugins: self: super: { + ta = { + vim = super.vim_configurable.customize { + name = "vim"; + vimrcConfig = { + pathogen = { + knownPlugins = (customPlugins super) // super.vimPlugins; + pluginNames = [ + "haskell-vim" + "rainbow-vim" + "vimwiki" + "vim-sexp-mappings-for-regular-people" + "vim-sexp" + "vim-surround" + "vim-repeat" + ]; + }; + customRC = '' + set colorcolumn=80 + set nocompatible + filetype plugin on + filetype indent on + filetype on + syntax on + set encoding=utf-8 + set autoindent + set smartindent + set ignorecase + set smartcase + set hlsearch + set history=100 + set number + set wildmenu + set backspace=eol,indent,start + set tabstop=3 softtabstop=3 expandtab shiftwidth=3 smarttab + + autocmd BufNewFile,BufRead *.rkt set filetype=scheme + autocmd FileType scheme :packadd vim-sexp + autocmd FileType scheme :packadd vim-sexp-for-normies + autocmd FileType scheme :packadd vim-surround + autocmd FileType scheme :packadd vim-repeat + autocmd FileType scheme :packadd paredit-vim + autocmd FileType scheme :packadd vim-tslime + autocmd FileType scheme :packadd racket-vim + + autocmd BufNewFile,BufRead *.hoon set filetype=hoon + autocmd FileType hoon :packadd hoon-vim + + let g:rainbow_active = 1 + let g:rainbow_ctermfgs = [ 'lightblue', 'lightgreen', 'yellow', 'red', 'magenta'] + ''; + }; + }; + }; +}