From b78f27b11c2b8e541bd7af135c0779cb09b3fc84 Mon Sep 17 00:00:00 2001 From: Dave Gallant Date: Fri, 5 Jun 2020 21:54:43 -0400 Subject: [PATCH] Add home.nix --- .config/nixpkgs/home.nix | 233 +++++++++++++++++++++++++++ .config/nixpkgs/overlays/awscli2.nix | 78 +++++++++ .config/nvim/init.vim | 172 -------------------- .zshrc | 47 ------ 4 files changed, 311 insertions(+), 219 deletions(-) create mode 100644 .config/nixpkgs/home.nix create mode 100644 .config/nixpkgs/overlays/awscli2.nix delete mode 100755 .config/nvim/init.vim delete mode 100644 .zshrc diff --git a/.config/nixpkgs/home.nix b/.config/nixpkgs/home.nix new file mode 100644 index 0000000..372ad71 --- /dev/null +++ b/.config/nixpkgs/home.nix @@ -0,0 +1,233 @@ +{ config, pkgs, ... }: + +{ + # Let Home Manager install and manage itself. + programs.home-manager.enable = true; + + home.username = "dgallant"; + home.homeDirectory = "/home/dgallant"; + + home.sessionVariables = { + LANG = "en_US.UTF-8"; + }; + + # This value determines the Home Manager release that your + # configuration is compatible with. This helps avoid breakage + # when a new Home Manager release introduces backwards + # incompatible changes. + home.stateVersion = "20.09"; + + home.packages = with pkgs; [ + awscli2 + bat + black + chromium + direnv + exa + fd + fzf + go + google-cloud-sdk + groovy + hadolint + htop + jdk + jq + nmap + openvpn + python3 + ripgrep + rustup + signal-desktop + slack + spotify + stalonetray + terraform + tflint + tmux + tree + unzip + vlc + zathura + zip + zsh-autosuggestions + zsh-syntax-highlighting + ]; + + programs.zsh = { + enable = true; + enableAutosuggestions = true; + history.size = 1000000; + + localVariables = { + COMPLETITION_WAITING_DOTS = "true"; + ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE = "fg=#838383,underline"; + }; + + initExtra = '' + eval "$(direnv hook zsh)" + eval "$(_RFD_COMPLETE=source_zsh rfd)" + eval "$(starship init zsh)" + + export EDITOR='neovim' + export GPG_TTY=$(tty) + export GOPATH=$HOME/go + source ~/.zsh-syntax-highlighting/zsh-syntax-highlighting.zsh + ''; + + shellAliases = { + ls = "exa -la --git"; + ".." = "cd .."; + config = "/usr/bin/git --git-dir=$HOME/.dotfiles/ --work-tree=$HOME"; + grep = "grep --color=auto --line-buffered"; + }; + + "oh-my-zsh" = { + enable = true; + plugins = [ + "fzf" + "git" + "last-working-dir" + ]; + }; + }; + + programs.neovim = { + enable = true; + viAlias = true; + vimAlias = true; + extraConfig = '' + call plug#begin('~/.vim/plugged') + Plug 'LnL7/vim-nix' + Plug 'ap/vim-css-color' + Plug 'fatih/vim-go' + Plug 'hashivim/vim-terraform' + Plug 'itchyny/lightline.vim' + Plug 'junegunn/fzf' + Plug 'junegunn/fzf.vim' + Plug 'neoclide/coc.nvim', {'branch': 'release'} + Plug 'rust-lang/rust.vim' + Plug 'scrooloose/nerdtree' + Plug 'tpope/vim-commentary' + Plug 'tpope/vim-fugitive' + Plug 'tpope/vim-surround' + Plug 'vifm/vifm.vim' + Plug 'vim-syntastic/syntastic' + Plug 'yuki-ycino/fzf-preview.vim' + call plug#end() + + set autoread + set cursorline + set encoding=utf-8 + set expandtab + set foldlevel=99 + set foldmethod=indent + set hlsearch + set ignorecase + set incsearch + set laststatus=2 + set modelines=0 + set mouse=a + set nocompatible + set noswapfile + set number + set pastetoggle= + set ruler + set shiftwidth=2 + set showcmd + set showmode + set smartcase + set t_Co=256 + set tabstop=2 + set wildmenu + + " Search down into subfolders + " Provides tab-completion for all file-related tasks + set path+=** + + filetype plugin indent on + + " Enable folding with the spacebar + nnoremap za + + " replace visually selected + vnoremap "hy:%s/h//g + + " Custom Commands + command JsonFormat execute "::%!jq '.'" + + " Shortcuts + map r :Rg + map g :Rg + map f :FzfPreviewDirectoryFiles + map n :NERDTree + + noremap y "*y + noremap p "*p + noremap Y "+y + noremap P "+p + + " Python indentation + au BufNewFile,BufRead *.py set tabstop=4 softtabstop=4 shiftwidth=4 textwidth=79 expandtab autoindent fileformat=unix + + let python_highlight_all=1 + + syntax on + colorscheme xoria256 + " Transparency + hi Normal guibg=NONE ctermbg=NONE + + " highlight red lines + highlight ExtraWhitespace ctermbg=red guibg=red + match ExtraWhitespace /\s\+$/ + + " groovy syntax + au BufNewFile,BufRead *.groovy set tabstop=2 shiftwidth=2 expandtab + au BufNewFile,BufRead Jenkinsfile setf groovy + au BufNewFile,BufRead Jenkinsfile set tabstop=2 shiftwidth=2 expandtab + + " vim-go + let g:go_auto_sameids = 0 + let g:go_fmt_command = "goimports" + let g:go_fmt_experimental = 1 + let g:go_highlight_array_whitespace_error = 1 + let g:go_highlight_build_constraints = 1 + let g:go_highlight_chan_whitespace_error = 1 + let g:go_highlight_extra_types = 1 + let g:go_highlight_fields = 1 + let g:go_highlight_format_strings = 1 + let g:go_highlight_function_calls = 1 + let g:go_highlight_function_parameters = 1 + let g:go_highlight_functions = 1 + let g:go_highlight_generate_tags = 1 + let g:go_highlight_operators = 1 + let g:go_highlight_space_tab_error = 1 + let g:go_highlight_string_spellcheck = 1 + let g:go_highlight_trailing_whitespace_error = 0 + let g:go_highlight_types = 1 + let g:go_highlight_variable_assignments = 1 + let g:go_highlight_variable_declarations = 1 + let g:go_metalinter_autosave=1 + let g:go_metalinter_autosave_enabled=['golint', 'govet'] + let g:go_rename_command = 'gopls' + + " vim-terraform + let g:terraform_align=1 + let g:terraform_fmt_on_save=1 + let g:terraform_fold_sections=1 + + " rust.vim + let g:rustfmt_autosave = 1 + + " syntastic + set statusline+=%#warningmsg# + set statusline+=%{SyntasticStatuslineFlag()} + set statusline+=%* + + let g:syntastic_always_populate_loc_list = 1 + let g:syntastic_auto_loc_list = 1 + let g:syntastic_check_on_open = 1 + let g:syntastic_check_on_wq = 0 + ''; + }; +} diff --git a/.config/nixpkgs/overlays/awscli2.nix b/.config/nixpkgs/overlays/awscli2.nix new file mode 100644 index 0000000..dba6c19 --- /dev/null +++ b/.config/nixpkgs/overlays/awscli2.nix @@ -0,0 +1,78 @@ +self: super: +rec { + python3 = with super; super.python3.override { + packageOverrides = self: super: { + botocore = super.botocore.overridePythonAttrs (oldAttrs: rec { + version = "2.0.0dev19"; + src = fetchFromGitHub { + owner = "boto"; + repo = "botocore"; + rev = "ce7b76d296b345d7647f50557606947ad857a786"; + sha256 = "0g9pvcs94v2znjkzzjnz30021q9bm97fxmlhxvql6im3c6adrqb3"; + }; + }); + prompt_toolkit = super.prompt_toolkit.overridePythonAttrs (oldAttrs: rec { + version = "2.0.10"; + src = oldAttrs.src.override { + inherit version; + sha256 = "1nr990i4b04rnlw1ghd0xmgvvvhih698mb6lb6jylr76cs7zcnpi"; + }; + }); + }; + }; + + pythonPackages = python3.pkgs; + + awscli2 = with self; pythonPackages.buildPythonApplication rec { + pname = "awscli"; + version = "2.0.15"; # N.B: if you change this, change botocore to a matching version too + + src = fetchFromGitHub { + owner = "aws"; + repo = "aws-cli"; + rev = version; + sha256 = "030pw7aa1y13awrpwlsq3ib633fh1z4rzkz8b31x7jg7s1hxrsvr"; + }; + + postPatch = '' + substituteInPlace setup.py --replace ",<0.16" "" + substituteInPlace setup.py --replace "cryptography>=2.8.0,<=2.9.0" "cryptography>=2.8.0,<2.10" + ''; + + # No tests included + doCheck = false; + + propagatedBuildInputs = with pythonPackages; [ + bcdoc + botocore + colorama + cryptography + docutils + groff + less + prompt_toolkit + pyyaml + rsa + ruamel_yaml + s3transfer + six + ]; + + postInstall = '' + mkdir -p $out/etc/bash_completion.d + echo "complete -C $out/bin/aws_completer aws" > $out/etc/bash_completion.d/awscli + mkdir -p $out/share/zsh/site-functions + mv $out/bin/aws_zsh_completer.sh $out/share/zsh/site-functions + rm $out/bin/aws.cmd + ''; + + passthru.python3 = python3; # for aws_shell + + meta = with super.lib; { + homepage = "https://aws.amazon.com/cli/"; + description = "Unified tool to manage your AWS services"; + license = licenses.asl20; + maintainers = [ ]; + }; + }; +} diff --git a/.config/nvim/init.vim b/.config/nvim/init.vim deleted file mode 100755 index f92789d..0000000 --- a/.config/nvim/init.vim +++ /dev/null @@ -1,172 +0,0 @@ -" nvim config - -set nocompatible -filetype off - -" disable swap files -set noswapfile - -" Set the runtime path to include Vundle and initialize -set rtp+=~/.vim/bundle/Vundle.vim - -" Plugins -call plug#begin('~/.vim/plugged') -Plug 'LnL7/vim-nix' -Plug 'ap/vim-css-color' -Plug 'fatih/vim-go' -Plug 'hashivim/vim-terraform' -Plug 'itchyny/lightline.vim' -Plug 'junegunn/fzf' -Plug 'junegunn/fzf.vim' -Plug 'neoclide/coc.nvim', {'branch': 'release'} -Plug 'psf/black' -Plug 'rust-lang/rust.vim' -Plug 'scrooloose/nerdtree' -Plug 'tpope/vim-commentary' -Plug 'tpope/vim-fugitive' -Plug 'tpope/vim-surround' -Plug 'vifm/vifm.vim' -Plug 'vim-syntastic/syntastic' -Plug 'yuki-ycino/fzf-preview.vim' -" Initialize plugin system -call plug#end() - -filetype plugin indent on - -" Security -set modelines=0 - -" Show line numbers -set number - -" Show file stats -set ruler - -" Highlight current line -set cursorline - -" Encoding -set encoding=utf-8 - -" ignore case when searching -set ignorecase -set smartcase - -" Status bar -set laststatus=2 - -" Last line -set showmode -set showcmd - -" autoread -set autoread - -" Mouse -set mouse=a - -" Search down into subfolders -" Provides tab-completion for all file-related tasks -set path+=** - -" Display all matching files when we tab complete -set wildmenu - -set tabstop=2 -set shiftwidth=2 -set expandtab - -" Enable folding -set foldmethod=indent -set foldlevel=99 - -" Incremental search -set incsearch - -" highlight search -set hlsearch - -" Enable folding with the spacebar -nnoremap za - -" replace visually selected -vnoremap "hy:%s/h//g - -" Custom Commands -command JsonFormat execute "::%!jq '.'" - -" Shortcuts -map r :Rg -map g :Rg -map f :FzfPreviewDirectoryFiles -map n :NERDTree - -noremap y "*y -noremap p "*p -noremap Y "+y -noremap P "+p - -set pastetoggle= - -" Python indentation -au BufNewFile,BufRead *.py set tabstop=4 softtabstop=4 shiftwidth=4 textwidth=79 expandtab autoindent fileformat=unix - -let python_highlight_all=1 - -syntax on -set t_Co=256 -colorscheme xoria256 -" Transparency -hi Normal guibg=NONE ctermbg=NONE - -" highlight red lines -highlight ExtraWhitespace ctermbg=red guibg=red -match ExtraWhitespace /\s\+$/ - -" groovy syntax -au BufNewFile,BufRead *.groovy set tabstop=2 shiftwidth=2 expandtab -au BufNewFile,BufRead Jenkinsfile setf groovy -au BufNewFile,BufRead Jenkinsfile set tabstop=2 shiftwidth=2 expandtab - -" vim-go -let g:go_auto_sameids = 0 -let g:go_fmt_command = "goimports" -let g:go_fmt_experimental = 1 -let g:go_highlight_array_whitespace_error = 1 -let g:go_highlight_build_constraints = 1 -let g:go_highlight_chan_whitespace_error = 1 -let g:go_highlight_extra_types = 1 -let g:go_highlight_fields = 1 -let g:go_highlight_format_strings = 1 -let g:go_highlight_function_calls = 1 -let g:go_highlight_function_parameters = 1 -let g:go_highlight_functions = 1 -let g:go_highlight_generate_tags = 1 -let g:go_highlight_operators = 1 -let g:go_highlight_space_tab_error = 1 -let g:go_highlight_string_spellcheck = 1 -let g:go_highlight_trailing_whitespace_error = 0 -let g:go_highlight_types = 1 -let g:go_highlight_variable_assignments = 1 -let g:go_highlight_variable_declarations = 1 -let g:go_metalinter_autosave=1 -let g:go_metalinter_autosave_enabled=['golint', 'govet'] -let g:go_rename_command = 'gopls' - -" vim-terraform -let g:terraform_align=1 -let g:terraform_fmt_on_save=1 -let g:terraform_fold_sections=1 - -" rust.vim -let g:rustfmt_autosave = 1 - -" syntastic -set statusline+=%#warningmsg# -set statusline+=%{SyntasticStatuslineFlag()} -set statusline+=%* - -let g:syntastic_always_populate_loc_list = 1 -let g:syntastic_auto_loc_list = 1 -let g:syntastic_check_on_open = 1 -let g:syntastic_check_on_wq = 0 diff --git a/.zshrc b/.zshrc deleted file mode 100644 index c79eab8..0000000 --- a/.zshrc +++ /dev/null @@ -1,47 +0,0 @@ -# oh-my-zsh -export ZSH=$HOME/.oh-my-zsh -plugins=(fzf git zsh-syntax-highlighting last-working-dir zsh-autosuggestions) - -# case-sensitive completion -CASE_SENSITIVE="true" - -ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE="fg=#838383,underline" - -# Disable marking untracked files -# under VCS as dirty. This makes repository status check for large repositories -# much, much faster. -DISABLE_UNTRACKED_FILES_DIRTY="true" - -HISTSIZE=1000000 -SAVEHIST=1000000 - -source $ZSH/oh-my-zsh.sh - -# Aliases -alias config='/usr/bin/git --git-dir=$HOME/.dotfiles/ --work-tree=$HOME' -alias ll='exa -la' -alias grep='grep --color=auto --line-buffered' -alias vi='nvim' -alias vim='nvim' - -export LANG=en_US.UTF-8 -export EDITOR='vim' -export PATH=$PATH:$HOME/.local/bin -export GPG_TTY=$(tty) - -setopt noincappendhistory - -# golang -export GOPATH=$HOME/go - -# fzf -[ -f $HOME/.fzf.zsh ] && source $HOME/.fzf.zsh - -# rfd -eval "$(_RFD_COMPLETE=source_zsh rfd)" - -# broot -source $HOME/.config/broot/launcher/bash/br - -# starship -eval "$(starship init zsh)"