commit c1ab1afd4e531c7f6d3233bf96607b9a953c974c Author: dadada Date: Fri Feb 28 17:05:29 2020 +0100 Init diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..128bf97 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +private/ +home.nix diff --git a/colors.nix b/colors.nix new file mode 100644 index 0000000..aaa03e8 --- /dev/null +++ b/colors.nix @@ -0,0 +1,29 @@ +{ + foreground = "#a3a3a3"; + foregroundBold = "#e8e8e8"; + cursor = "#e8e8e8"; + cursorForeground = "#1f2022"; + background = "#1f2022"; + color0 = "#1f2022"; + color8 = "#585858"; + color7 = "#a3a3a3"; + color15 = "#f8f8f8"; + color1 = "#f2241f"; + color9 = "#f2241f"; + color2 = "#67b11d"; + color10 = "#67b11d"; + color3 = "#b1951d"; + color11 = "#b1951d"; + color4 = "#4f97d7"; + color12 = "#4f97d7"; + color5 = "#a31db1"; + color13 = "#a31db1"; + color6 = "#2d9574"; + color14 = "#2d9574"; + color16 = "#ffa500"; + color17 = "#b03060"; + color18 = "#282828"; + color19 = "#444155"; + color20 = "#b8b8b8"; + color21 = "#e8e8e8"; +} diff --git a/common.nix b/common.nix new file mode 100644 index 0000000..f35992b --- /dev/null +++ b/common.nix @@ -0,0 +1,17 @@ +{ config, pkgs, ... }: +{ + imports = [ + ./vim + ./fish.nix + ./tmux.nix + (import ./termite.nix { + config = config; + pkgs = pkgs; + colors = import ./colors.nix; + }) + ./gpg.nix + ./ssh.nix + ./git.nix + ./gtk.nix + ]; +} diff --git a/config.nix b/config.nix new file mode 100644 index 0000000..69baf10 --- /dev/null +++ b/config.nix @@ -0,0 +1 @@ +{ allowUnfree = true; } diff --git a/fish.nix b/fish.nix new file mode 100644 index 0000000..86fbf18 --- /dev/null +++ b/fish.nix @@ -0,0 +1,72 @@ +{ config, pkgs, ... }: +{ + programs.fish = { + enable = true; + # plugins = [ + # { + # name = "fzf"; + # src = pkgs.fetchFromGithub { + # owner = "jethrokuan"; + # repo = "fzf"; + # rev = "7f4c0b6d9545126a1bdf30279e6b1ab6ffedc299"; + # sha256 = "0c5i7sdrsp0q3vbziqzdyqn4fmp235ax4mn4zslrswvn8g3fvdyh"; + # }; + # } + # ]; + interactiveShellInit = '' + # fish git prompt + set __fish_git_prompt_show_informative_status 'yes' + set __fish_git_prompt_showdirtystate 'yes' + set __fish_git_prompt_showstashstate 'yes' + set __fish_git_prompt_showuntrackedfiles 'yes' + set __fish_git_prompt_showupstream 'yes' + set __fish_git_prompt_showcolorhints 'yes' + + set fish_greeting + + # disable path shortening + set fish_prompt_pwd_dir_length 0 + + set -U FZF_LEGACY_KEYBINDINGS 0 + #set -x TERM xterm-256color + + if status is-interactive + and not status is-login + and not set -q TMUX + and string match -qr "^xterm-.*" "$TERM" + exec tmux + end + ''; + promptInit = '' + function fish_prompt + set last_status $status + printf '%s %s:%s ' \ + (set_color red + echo $last_status) \ + (set_color green + hostname) \ + (set_color blue + prompt_pwd) + set_color normal + end + + function fish_right_prompt + printf '%s' (__fish_git_prompt) + end + ''; + shellAliases = { + gst = "git status"; + gco = "git commit"; + glo = "git log"; + gad = "git add"; + ls = "exa"; + ll = "exa -l"; + la = "exa -la"; + mv = "mv -i"; + cp = "cp -i"; + }; + }; + + home.packages = [ pkgs.exa ]; + +} diff --git a/git.nix b/git.nix new file mode 100644 index 0000000..450441b --- /dev/null +++ b/git.nix @@ -0,0 +1,5 @@ +{ config, ... }: +{ + programs.git.enable = true; +} + diff --git a/gpg.nix b/gpg.nix new file mode 100644 index 0000000..040fffb --- /dev/null +++ b/gpg.nix @@ -0,0 +1,21 @@ +{ config, ... }: +{ + programs.gpg = { + enable = true; + settings = { + fixed-list-mode = true; + keyid-format = "0xlong"; + verify-options = "show-uid-validity"; + list-options = "show-uid-validity"; + cert-digest-algo = "SHA256"; + use-agent = true; + keyserver = "hkps://keys.openpgp.org"; + }; + }; + + services.gpg-agent = { + enable = true; + defaultCacheTtl = 1800; + enableSshSupport = false; + }; +} diff --git a/gtk.nix b/gtk.nix new file mode 100644 index 0000000..7f709fb --- /dev/null +++ b/gtk.nix @@ -0,0 +1,10 @@ +{ config, pkgs, ... }: +{ + gtk = { + theme.package = pkgs.gnome-themes-extra; + theme.name = "Adwaita Dark:"; + iconTheme.package = pkgs.adwaita-icon-theme; + iconTheme.name = "Adwaita"; + font.package = pkgs.cantarell-fonts; + }; +} diff --git a/metis.nix b/metis.nix new file mode 100644 index 0000000..0349398 --- /dev/null +++ b/metis.nix @@ -0,0 +1,107 @@ +{ config, pkgs, lib, ... }: +let + userEnv = { + EDITOR = "vim"; + PAGER = "less"; + MAILDIR = "\$HOME/.var/mail"; + MBLAZE = "\$HOME/.config/mblaze"; + MBLAZE_PAGER = "cat"; + NOTMUCH_CONFIG = "\$HOME/.config/notmuch/config"; + PASSWORD_STORE_DIR = "\$HOME/src/password-store"; + SSH_AGENT_SOCKET = "\$XDG_RUNTIME_DIR/ssh-agent"; + }; +in +{ + imports = [ + ./common.nix + ./private/metis + ]; + + # Let Home Manager install and manage itself. + programs.home-manager.enable = true; + + home.sessionVariables = userEnv; + systemd.user.sessionVariables = userEnv; + + home.packages = with pkgs; [ + firefox-bin + chromium + android-studio + bc + brightnessctl + file + fzf + gimp + gnupg + inkscape + inotify-tools + jmtpfs + keepassxc + ldns + libreoffice + mblaze + mpv + nmap + pandoc + pass + pavucontrol + pinentry + playerctl + i3blocks + python3 + python38Packages.dateutil + spotify + sshfs-fuse + tdesktop + texlive.combined.scheme-full + thunderbird-bin + tor-browser-bundle-bin + virtmanager + whois + youtube-dl + zathura + unzip + anki + bluez-tools + ]; + + services.syncthing = { + enable = true; + tray = false; + }; + + services.screen-locker = { + enable = true; + inactiveInterval = 5; + lockCmd = "\${pkgs.swaylock}/bin/swaylock"; + }; + + xdg = { + enable = true; + mimeApps = { + enable = true; + #associations.added = { + #}; + #defaultApplications = { + #}; + }; + userDirs = { + download ="\$HOME/tmp"; + music = "\$HOME/lib/music"; + videos ="\$HOME/lib/videos"; + pictures = "\$HOME/lib/pictures"; + documents = "\$HOME/lib"; + desktop = "$HOME/tmp"; + }; + }; + + # 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. + # + # You can update Home Manager without changing this value. See + # the Home Manager release notes for a list of state version + # changes in each release. + home.stateVersion = "19.09"; +} diff --git a/ssh.nix b/ssh.nix new file mode 100644 index 0000000..10e5e15 --- /dev/null +++ b/ssh.nix @@ -0,0 +1,6 @@ +{ config, ... }: +{ + programs.ssh = { + enable = true; + }; +} diff --git a/termite.nix b/termite.nix new file mode 100644 index 0000000..9ba13c4 --- /dev/null +++ b/termite.nix @@ -0,0 +1,55 @@ +{ config, pkgs, colors, ... }: +{ + programs.termite = { + enable = true; + allowBold = true; + audibleBell = false; + clickableUrl = true; + dynamicTitle = true; + font = "Source Code Pro 10"; + mouseAutohide = false; + scrollOnOutput = false; + scrollOnKeystroke = true; + scrollbackLines = -1; + searchWrap = true; + urgentOnBell = true; + cursorBlink = "off"; + cursorShape = "block"; + sizeHints = false; + scrollbar = "off"; + colorsExtra = '' + foreground = ${colors.foreground} + foreground_bold = ${colors.foregroundBold} + cursor = ${colors.cursor} + cursor_foreground = ${colors.cursorForeground} + background = ${colors.background} + color0 = ${colors.background} + color8 = ${colors.color8} + color7 = ${colors.color7} + color15 = ${colors.color15} + color1 = ${colors.color1} + color9 = ${colors.color9} + color2 = ${colors.color2} + color10 = ${colors.color10} + color3 = ${colors.color3} + color11 = ${colors.color11} + color4 = ${colors.color4} + color12 = ${colors.color12} + color5 = ${colors.color5} + color13 = ${colors.color13} + color6 = ${colors.color6} + color14 = ${colors.color14} + color16 = ${colors.color16} + color17 = ${colors.color17} + color18 = ${colors.color18} + color19 = ${colors.color19} + color20 = ${colors.color20} + color21 = ${colors.color21} + ''; + }; + + # Add font that is used in config + home.packages = [ + pkgs.source-code-pro + ]; +} diff --git a/tmux.nix b/tmux.nix new file mode 100644 index 0000000..3c81c2f --- /dev/null +++ b/tmux.nix @@ -0,0 +1,15 @@ +{ config, ... }: +{ + programs.tmux = { + enable = true; + terminal = "xterm-256color"; + extraConfig = '' + set -g status on + set-option -g set-titles on + set-option -g set-titles-string "#T" + set-option -g automatic-rename on + set-window-option -g mode-keys vi + ''; + }; +} + diff --git a/vim/default.nix b/vim/default.nix new file mode 100644 index 0000000..d3d3ef8 --- /dev/null +++ b/vim/default.nix @@ -0,0 +1,30 @@ +{ config, pkgs, lib, fetchFromGitHub, ... }: +let + myFtplugins = pkgs.vimUtils.buildVimPluginFrom2Nix { + pname = "myFtplugins"; + version = "2010-11-06"; + src = vim/plugins/myFtplugins; + }; +in +{ + programs.vim = { + enable = true; + extraConfig = builtins.readFile ./vimrc; + plugins = [ + pkgs.vimPlugins.vim-nix + #pkgs.vimPlugins.kotlin-vim + pkgs.vimPlugins.ale + pkgs.vimPlugins.fzf-vim + pkgs.vimPlugins.rust-vim + pkgs.vimPlugins.base16-vim + pkgs.vimPlugins.typescript-vim + pkgs.vimPlugins.vim-airline + pkgs.vimPlugins.vim-airline-themes + pkgs.vimPlugins.vim-fish + #pkgs.vimPlugins.vim-gnupg + #pkgs.vimPlugins.vim-l9 + pkgs.vimPlugins.vim-ledger + ]; + }; +} + diff --git a/vim/plugins/myFtplugins/ftplugin/cpp.vim b/vim/plugins/myFtplugins/ftplugin/cpp.vim new file mode 100644 index 0000000..50965d1 --- /dev/null +++ b/vim/plugins/myFtplugins/ftplugin/cpp.vim @@ -0,0 +1 @@ +let b:ale_fixers = ['clang-format', 'remove_trailing_lines', 'trim_whitespace'] diff --git a/vim/plugins/myFtplugins/ftplugin/css.vim b/vim/plugins/myFtplugins/ftplugin/css.vim new file mode 100644 index 0000000..51f2b56 --- /dev/null +++ b/vim/plugins/myFtplugins/ftplugin/css.vim @@ -0,0 +1,3 @@ +setlocal expandtab +setlocal shiftwidth=2 +setlocal softtabstop=2 diff --git a/vim/plugins/myFtplugins/ftplugin/fish.vim b/vim/plugins/myFtplugins/ftplugin/fish.vim new file mode 100644 index 0000000..b1a5c53 --- /dev/null +++ b/vim/plugins/myFtplugins/ftplugin/fish.vim @@ -0,0 +1,2 @@ +" Set up :make to use fish for syntax checking. +compiler fish diff --git a/vim/plugins/myFtplugins/ftplugin/foo.kt b/vim/plugins/myFtplugins/ftplugin/foo.kt new file mode 100644 index 0000000..892968c --- /dev/null +++ b/vim/plugins/myFtplugins/ftplugin/foo.kt @@ -0,0 +1,3 @@ +class Foo { + fun +} diff --git a/vim/plugins/myFtplugins/ftplugin/html.vim b/vim/plugins/myFtplugins/ftplugin/html.vim new file mode 100644 index 0000000..51f2b56 --- /dev/null +++ b/vim/plugins/myFtplugins/ftplugin/html.vim @@ -0,0 +1,3 @@ +setlocal expandtab +setlocal shiftwidth=2 +setlocal softtabstop=2 diff --git a/vim/plugins/myFtplugins/ftplugin/javascript.vim b/vim/plugins/myFtplugins/ftplugin/javascript.vim new file mode 100644 index 0000000..00196be --- /dev/null +++ b/vim/plugins/myFtplugins/ftplugin/javascript.vim @@ -0,0 +1,5 @@ +let b:ale_fixers = ['prettier', 'eslint'] + +setlocal expandtab +setlocal shiftwidth=2 +setlocal softtabstop=2 diff --git a/vim/plugins/myFtplugins/ftplugin/kotlin.vim b/vim/plugins/myFtplugins/ftplugin/kotlin.vim new file mode 100644 index 0000000..62f7206 --- /dev/null +++ b/vim/plugins/myFtplugins/ftplugin/kotlin.vim @@ -0,0 +1,5 @@ +setlocal expandtab +setlocal shiftwidth=4 +setlocal softtabstop=4 +let g:ale_kotlin_languageserver_executable = "/home/tim/src/kotlin-language-server/server/build/install/server/bin/kotlin-language-server" + diff --git a/vim/plugins/myFtplugins/ftplugin/ledger.vim b/vim/plugins/myFtplugins/ftplugin/ledger.vim new file mode 100644 index 0000000..765e06c --- /dev/null +++ b/vim/plugins/myFtplugins/ftplugin/ledger.vim @@ -0,0 +1,3 @@ +setlocal expandtab +setlocal shiftwidth=4 +setlocal softtabstop=4 diff --git a/vim/plugins/myFtplugins/ftplugin/nix.vim b/vim/plugins/myFtplugins/ftplugin/nix.vim new file mode 100644 index 0000000..51f2b56 --- /dev/null +++ b/vim/plugins/myFtplugins/ftplugin/nix.vim @@ -0,0 +1,3 @@ +setlocal expandtab +setlocal shiftwidth=2 +setlocal softtabstop=2 diff --git a/vim/plugins/myFtplugins/ftplugin/python.vim b/vim/plugins/myFtplugins/ftplugin/python.vim new file mode 100644 index 0000000..52a8bc2 --- /dev/null +++ b/vim/plugins/myFtplugins/ftplugin/python.vim @@ -0,0 +1,4 @@ +" Check Python files with flake8 and pylint. +let b:ale_linters = ['flake8', 'pylint'] +" Fix Python files with autopep8 and yapf. +let b:ale_fixers = ['autopep8', 'yapf', 'add_blank_lines_for_python_control_statements', 'autopep8', 'remove_trailing_lines', 'reorder-python-imports', 'trim_whitespace'] diff --git a/vim/plugins/myFtplugins/ftplugin/rust.vim b/vim/plugins/myFtplugins/ftplugin/rust.vim new file mode 100644 index 0000000..7072ec9 --- /dev/null +++ b/vim/plugins/myFtplugins/ftplugin/rust.vim @@ -0,0 +1,2 @@ +let b:ale_linters = {'rust': ['rustc', 'rls']} +let b:ale_fixers = {'rust': ['rustfmt']} diff --git a/vim/plugins/myFtplugins/ftplugin/scss.vim b/vim/plugins/myFtplugins/ftplugin/scss.vim new file mode 100644 index 0000000..51f2b56 --- /dev/null +++ b/vim/plugins/myFtplugins/ftplugin/scss.vim @@ -0,0 +1,3 @@ +setlocal expandtab +setlocal shiftwidth=2 +setlocal softtabstop=2 diff --git a/vim/plugins/myFtplugins/ftplugin/typescript.vim b/vim/plugins/myFtplugins/ftplugin/typescript.vim new file mode 100644 index 0000000..8312237 --- /dev/null +++ b/vim/plugins/myFtplugins/ftplugin/typescript.vim @@ -0,0 +1,5 @@ +let b:ale_fixers = ['prettier', 'eslint', 'tsserver'] + +setlocal expandtab +setlocal shiftwidth=2 +setlocal softtabstop=2 diff --git a/vim/plugins/myFtplugins/ftplugin/yaml.vim b/vim/plugins/myFtplugins/ftplugin/yaml.vim new file mode 100644 index 0000000..51521e2 --- /dev/null +++ b/vim/plugins/myFtplugins/ftplugin/yaml.vim @@ -0,0 +1,4 @@ +setlocal expandtab +setlocal shiftwidth=2 +setlocal softtabstop=2 + diff --git a/vim/vimrc b/vim/vimrc new file mode 100644 index 0000000..e29a369 --- /dev/null +++ b/vim/vimrc @@ -0,0 +1,144 @@ +filetype plugin on +filetype indent on + +set autoread +" :W sudo saves the file +" (useful for handling the permission-denied error) +command W w !sudo tee % > /dev/null + +" no command execution from modeline +set nomodeline + +" Turn on the Wild menu +set wildmenu + +" Enable hidden buffers +set hidden + +" Clipboard copy & paste +"set clipboard=unnamedplus + +" Always show current position +set ruler + +" When searching try to be smart about cases +set smartcase + +" Highlight search results +set hlsearch + +" Inenteremental search +set incsearch + +" Don't redraw while executing macros (good performance config) +set lazyredraw + +" Do not show matching brackets when text indicator is over them +" set noshowmatch +" let loaded_matchparen = 1 + +" No annoying sound on errors +set noerrorbells +set novisualbell + +set wrap +set linebreak +set nolist " list disables linebreak + +" Enable syntax highlighting +syntax enable + +if (has("termguicolors")) + set termguicolors +endif + +set t_Co=256 +set background=dark + +colorscheme base16-spacemacs + +" Use tabs for indent +set smarttab +set smartindent +set autoindent +set copyindent +set preserveindent + +set wildmode=longest,list,full +set wildmenu + +set cursorline +set number +set relativenumber + +" Transparency +"hi Normal guibg=NONE ctermbg=NONE + +"set list! +"set listchars=trail:⛤,extends:⟩,precedes:⟨,nbsp:␣,conceal:… + +" Map leader to do extra key combinations +let mapleader = " " + +" Toggle paste mode on and off +map pp :setlocal paste! + +" Fast saving +nmap w :w! + +" Buffer switching +nmap bb :Buffers +nmap bl :Buffers +nmap bn :bnext +nmap bp :bprevious + +nmap ll :Lines +nmap mm :Marks +nmap ww :Windows +nmap hh :History/ +nmap rr :reg + +" finding files +nmap ff :Files +nmap pp :FufDir + +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 +nmap sp :ALEFindReferences +nmap ss :ALESymbolSearch +nmap gd :ALEGoToDefinition +nmap ?? :ALEHover + +" Enable completion where available. +" This setting must be set before ALE is loaded. +let g:ale_completion_enabled = 1 +let g:ale_warn_about_trailing_whitespace = 1 +let g:ale_warn_about_trailing_lines = 1 +let g:ale_completion_tsserver_autoimport = 1 + +" Use ALE and also some plugin 'foobar' as completion sources for all code. +"let g:deoplete#sources = {'_': ['ale']} +"let g:deoplete#enable_at_startup = 1 + +"let g:ale_lint_on_text_changed = 'never' +" You can disable this option too +" if you don't want linters to run on opening a file +"let g:ale_lint_on_enter = 0 + +" Set airline theme +let g:airline_theme='base16_spacemacs' + +" Load all plugins now. +" Plugins need to be added to runtimepath before helptags can be generated. +packloadall +" Load all of the helptags now, after plugins have been loaded. +" All messages and errors will be ignored. +silent! helptags ALL + +set omnifunc=ale#completion#OmniFunc