From 9bd7eb2bcb5653310b4b2cb5068b1e994c0cb765 Mon Sep 17 00:00:00 2001 From: kmein Date: Tue, 11 Sep 2018 18:16:33 +0200 Subject: [PATCH] Configure like hell --- art/haskell-grey.png | Bin 0 -> 14671 bytes config.nix | 841 ++++++++++++------------------------------- dot/ghci.nix | 11 + dot/i3.nix | 118 ++++++ dot/i3blocks.nix | 172 +++++++++ dot/mpv.nix | 10 + dot/stack.nix | 10 + dot/terminal.nix | 26 ++ dot/tmux.nix | 39 ++ dot/vim.nix | 153 ++++++++ theme.nix | 25 ++ 11 files changed, 792 insertions(+), 613 deletions(-) create mode 100644 art/haskell-grey.png create mode 100644 dot/ghci.nix create mode 100644 dot/i3.nix create mode 100644 dot/i3blocks.nix create mode 100644 dot/mpv.nix create mode 100644 dot/stack.nix create mode 100644 dot/terminal.nix create mode 100644 dot/tmux.nix create mode 100644 dot/vim.nix create mode 100644 theme.nix diff --git a/art/haskell-grey.png b/art/haskell-grey.png new file mode 100644 index 0000000000000000000000000000000000000000..9f26b662da143f306084b62ab743a74913dd7dbe GIT binary patch literal 14671 zcmeAS@N?(olHy`uVBq!ia0y~yU~gbxVA;UI#=yWJWf1<2fq{W7$=lt9;Xep2*t>i( z0|NtRfk$L90|U1(2s1Lwnj^u$z`$PO>FdgVmrFp5ok8DxaTWsugKTC{a*!1a z3=A8-{oBC=VK=Zbg51Wyz@Xs70P+(914D;E10zIMi6sHTXy6!C1`3JM00D)GeNAi*$NIDo@}4uykR3?l=>f%DdumXf=7@76Xv zef;?Gin_YEAAerHe7R%Ko|w*?&p-d%v2UN;`t|GWv=|r|A{y*LLx$5HJbjva=K1HT zGg8yj(`962bZY+n`&VaUYrFQyo7uBxKYsNp>(9@}KS86Z-5;9R7#Jd&)~{c0IM**c zZQkL-hc|BBy7j})*|TRG&ORHK_HFZKV|h^q1_m7m(8y%Or0?IqfBg1so6u$-waJAw zH8yIKPdYufx3@oj_wLgzpR zRc5mzk;PoY9RKq`bpEf@{48(%{c?2Z&J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_~`KYv=X7)!$En`VY^+(RCqCSy)*3 z^g2*sz`($;;O`$+1Molt)JGt;LJP=gAeI0)V}V#4;Hn(NY5~VLh~)&XFhDG@S3!&h z0g$6WEJy%>Sfj>`h8?K;4oVB72?bOzfkI+5SB&P0(Odz_39!l(#2(ERqq$-ybzq(9;nSp`9;Kco3a`BlailA;asE|`*fp$I*w15UJ zKteMFVCBCs6LhOef)l9I4wCfYfTagcMjns=1B1b+VGN^T#=tO|G#D60vl9cuXsN-_ cFc5_!hd|QSXG_0bOa~Rqp00i_>zopr0P57W5dZ)H literal 0 HcmV?d00001 diff --git a/config.nix b/config.nix index e9dfd73..04f0968 100644 --- a/config.nix +++ b/config.nix @@ -1,661 +1,276 @@ { config, lib, pkgs, ... }: let - uiFont = "Roboto"; - uiFontSize = 10; - defaultTerminal = "${pkgs.lxqt.qterminal}/bin/qterminal"; - white = "#ffffff"; - black = "#000000"; - lightGray = "#aaaaaa"; - darkGray = "#888888"; - red = "#ff0000"; - - spotify_info = pkgs.writeScript "spotify.info" '' - #!/bin/bash - - STATUS=$(${pkgs.dbus}/bin/dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.freedesktop.DBus.Properties.Get string:'org.mpris.MediaPlayer2.Player' string:'PlaybackStatus'|egrep -A 1 "string"|cut -b 26-|cut -d '"' -f 1|egrep -v ^$) - - if [[ "$STATUS" == 'Playing' ]]; then - printf '\uf1bc ' - printf '\uf04b' - elif [[ "$STATUS" == 'Paused' ]]; then - printf '\uf1bc ' - printf '\uf04c' - elif [[ "$STATUS" == 'Stopped' ]]; then - printf '\uf1bc ' - printf '\uf04d' - else - exit 1 - fi - - printf ' ' - - METADATA=$(${pkgs.dbus}/bin/dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.freedesktop.DBus.Properties.Get string:'org.mpris.MediaPlayer2.Player' string:'Metadata') - ARTIST=$(echo "$METADATA" | egrep -A 2 "artist" | egrep -v "artist" | egrep -v "array" | cut -b 27- | cut -d '"' -f 1 | egrep -v ^$) - TITLE=$(echo "$METADATA" | egrep -A 1 "title" | egrep -v "title" | cut -b 44- | cut -d '"' -f 1 | egrep -v ^$) - - printf "%s \u2237 %s" "$ARTIST" "$TITLE" - ''; - battery_info = pkgs.writeScript "battery.info" '' - #!/usr/bin/env bash - cd "/sys/class/power_supply/$BLOCK_INSTANCE/" - - status=$(cat status) - charge_f=$((100 * $(cat charge_now) / $(cat charge_full))) - - if [[ "$charge_f" -lt 20 ]]; then - printf '\uf244' - elif [[ "$charge_f" -lt 40 ]]; then - printf '\uf243' - elif [[ "$charge_f" -lt 60 ]]; then - printf '\uf242' - elif [[ "$charge_f" -lt 80 ]]; then - printf '\uf241' - else - printf '\uf240' - fi - - printf ' ' - - if [[ "$status" == 'Charging' ]]; then - printf '\uf106' - elif [[ "$status" == 'Discharging' ]]; then - printf '\uf107' - elif [[ "$status" == 'Full' ]]; then - printf '\uf0e7' - else - printf '[%s]' "$status" - fi - - printf ' ' - - if [[ "$status" != 'Full' ]]; then - rate_raw=$(($(cat voltage_now) * $(cat power_now))) - rate=$(bc <<< "scale=1; $rate_raw / 10^12") - printf '%s\u2009W, ' "$rate" - fi - - charge_d=$((100 * $(cat charge_now) / $(cat charge_full))) - printf '%s%%\n' "$charge_d" - - if [[ "$status" == 'Discharging' ]]; then - if [[ "$charge_d" -lt 10 ]]; then - printf '\n#E41C28' - elif [[ "$charge_d" -lt 20 ]]; then - printf '\n#EEBF13' - fi - fi - ''; - volume_info = pkgs.writeScript "volume.info" '' - #!/usr/bin/env bash - if [[ "$BLOCK_BUTTON" == 1 ]]; then - ${pkgs.pamixer}/bin/pamixer -i 5 - elif [[ "$BLOCK_BUTTON" == 3 ]]; then - ${pkgs.pamixer}/bin/pamixer -d 5 - elif [[ "$BLOCK_BUTTON" == 2 ]]; then - ${pkgs.pamixer}/bin/pamixer -t - fi - - if $(${pkgs.pamixer}/bin/pamixer --get-mute); then - printf '\uf026 0%%\n\n#EEBF13' - else - volume=$(${pkgs.pamixer}/bin/pamixer --get-volume) - printf '\uf028 %s%%' "$volume" - fi - ''; - fancyDate = pkgs.writeScript "fancy_date.py" '' - #!/usr/bin/env python3 - from datetime import datetime - now = datetime.now() - print(now.strftime("%d\u2009{}\u2009%Y ⟨%V⟩").format(chr(0x2160 + (now.month - 1)))) - ''; - i3blocks_conf = pkgs.writeText "i3blocks.conf" '' - markup=pango - align=center - color=${white} - - [spotify] - command=${spotify_info} - interval=1 - - [separator] - - [volume] - command=${volume_info} - min_width= 100% - interval=once - signal=3 - - [separator] - - [brightness] - command=printf "%.1f%%" $(${pkgs.xorg.xbacklight}/bin/xbacklight) - label= - min_width= 100% - signal=2 - interval=once - - [separator] - - [cpu_usage] - command=cut -d' ' -f 1-3 < /proc/loadavg - label= - interval=2 - - [separator] - - [ram_usage] - command=free -h | grep "Mem" | awk '{print $3}' - label= - interval=2 - align=center - - [separator] - - [battery] - command=${battery_info} - #echo "$(cat /sys/class/power_supply/BAT1/capacity)% ($(cat /sys/class/power_supply/BAT1/status))" - interval=10 - instance=BAT1 - - [separator] - - [date] - #command=date +'%F [%a(%V):%j]' - command=${fancyDate} - interval=30 - label= - - [separator] - - [time] - command=date +'%H:%M' - interval=30 - label= - - [separator] - ''; - i3_conf = pkgs.writeText "i3.conf" '' - set $rofsize 12 - set $mainfont ${uiFont} ${uiFontSize} - - set $accent-color ${darkGray} - set $bg-color ${black} - set $border-color ${black} - set $inactive-bg-color ${black} - set $inactive-text-color ${darkGray} - set $active-text-color ${lightGray} - set $indicator-color ${white} - set $text-color ${white} - set $urgent-color ${red} - set $ws-bg-color ${black} - set $ws-border-color ${black} - set $ws-inactive-bg-color ${black} - - set $terminal ${defaultTerminal} - set $file-manager ${pkgs.gnome3.nautilus}/bin/nautilus - set $browser ${pkgs.google-chrome}/bin/google-chrome-stable - - set $mod Mod4 - - font pango:${uiFont} ${uiFontSize} - floating_modifier $mod - - hide_edge_borders both - new_window pixel 1 - new_float pixel 1 - - bindsym $mod+Return exec $terminal - bindsym $mod+y exec $browser - bindsym $mod+t exec $file-manager - bindsym $mod+Shift+q kill - bindsym $mod+Left focus left - bindsym $mod+Down focus down - bindsym $mod+Up focus up - bindsym $mod+Right focus right - bindsym $mod+p workspace prev - bindsym $mod+n workspace next - bindsym $mod+Shift+Left move left - bindsym $mod+Shift+Down move down - bindsym $mod+Shift+Up move up - bindsym $mod+Shift+Right move right - bindsym $mod+h split h - bindsym $mod+v split v - bindsym $mod+f fullscreen toggle - bindsym $mod+s layout stacking - bindsym $mod+w layout tabbed - bindsym $mod+e layout toggle split - bindsym $mod+Shift+z floating toggle - bindsym $mod+Shift+c reload - bindsym $mod+Shift+r restart - bindsym $mod+d exec ${pkgs.rofi}/bin/rofi -show run - - set $WS1 1 - set $WS2 2 - set $WS3 3 - set $WS4 4 - set $WS5 5 - set $WS6 6 - set $WS7 7 - set $WS8 8 - set $WS9 9 - set $WS10 10 - bindsym $mod+0 workspace $WS10 - bindsym $mod+1 workspace $WS1 - bindsym $mod+2 workspace $WS2 - bindsym $mod+3 workspace $WS3 - bindsym $mod+4 workspace $WS4 - bindsym $mod+5 workspace $WS5 - bindsym $mod+6 workspace $WS6 - bindsym $mod+7 workspace $WS7 - bindsym $mod+8 workspace $WS8 - bindsym $mod+9 workspace $WS9 - bindsym $mod+Shift+0 move container to workspace $WS10 - bindsym $mod+Shift+1 move container to workspace $WS1 - bindsym $mod+Shift+2 move container to workspace $WS2 - bindsym $mod+Shift+3 move container to workspace $WS3 - bindsym $mod+Shift+4 move container to workspace $WS4 - bindsym $mod+Shift+5 move container to workspace $WS5 - bindsym $mod+Shift+6 move container to workspace $WS6 - bindsym $mod+Shift+7 move container to workspace $WS7 - bindsym $mod+Shift+8 move container to workspace $WS8 - bindsym $mod+Shift+9 move container to workspace $WS9 - - bindsym XF86AudioLowerVolume exec --no-startup-id ${pkgs.pamixer}/bin/pamixer -d 5 && pkill -RTMIN+3 i3blocks - bindsym XF86AudioRaiseVolume exec --no-startup-id ${pkgs.pamixer}/bin/pamixer -i 5 && pkill -RTMIN+3 i3blocks - bindsym XF86AudioMute exec --no-startup-id ${pkgs.pamixer}/bin/pamixer -t && pkill -RTMIN+3 i3blocks - bindsym XF86MonBrightnessUp exec --no-startup-id ${pkgs.xorg.xbacklight}/bin/xbacklight + 10 && pkill -RTMIN+2 i3blocks - bindsym XF86MonBrightnessDown exec --no-startup-id ${pkgs.xorg.xbacklight}/bin/xbacklight - 10 && pkill -RTMIN+2 i3blocks - - mode "  " { - bindsym Left resize shrink width 10 px or 10 ppt - bindsym Down resize grow height 10 px or 10 ppt - bindsym Up resize shrink height 10 px or 10 ppt - bindsym Right resize grow width 10 px or 10 ppt - bindsym Escape mode "default" - } - bindsym $mod+r mode "  " - - client.focused $accent-color $bg-color $text-color $indicator-color $accent-color - client.focused_inactive $border-color $inactive-bg-color $inactive-text-color $indicator-color $border-color - client.unfocused $border-color $inactive-bg-color $inactive-text-color $indicator-color $border-color - client.urgent $urgent-color $bg-color $text-color $indicator-color $urgent-color - - bar { - status_command "${pkgs.i3blocks}/bin/i3blocks -c ${i3blocks_conf}" - position top - - font pango:$font,FontAwesome $size - separator_symbol " // " - colors { - separator $inactive-text-color - background $inactive-bg-color - statusline $inactive-text-color - - focused_workspace $ws-border-color $ws-bg-color $text-color - active_workspace $ws-border-color $ws-bg-color $active-text-color - inactive_workspace $ws-border-color $ws-inactive-bg-color $inactive-text-color - urgent_workspace $ws-border-color $ws-bg-color $urgent-color - } - } - - exec --no-startup-id ${pkgs.networkmanagerapplet}/bin/nm-applet - ''; - vim_conf = pkgs.writeText "vim.conf" '' - let mapleader="," - let maplocalleader=";" - - filetype off - - set packpath^=~/.vim - packadd minpac - call minpac#init() - call minpac#add('LnL7/vim-nix') - call minpac#add('MarcWeber/vim-addon-mw-utils') - call minpac#add('Shougo/neocomplete.vim') - call minpac#add('Shougo/vimproc.vim') - call minpac#add('airblade/vim-gitgutter') - call minpac#add('bling/vim-bufferline') - call minpac#add('ctrlpvim/ctrlp.vim') - call minpac#add('dhruvasagar/vim-table-mode') - call minpac#add('fsharp/vim-fsharp') - call minpac#add('garbas/vim-snipmate') - call minpac#add('gerw/vim-latex-suite') - call minpac#add('godlygeek/tabular') - call minpac#add('idris-hackers/idris-vim') - call minpac#add('k-takata/minpac', {'type':'opt'}) - call minpac#add('kien/rainbow_parentheses.vim') - call minpac#add('leafgarland/typescript-vim') - call minpac#add('mattn/emmet-vim') - call minpac#add('mhinz/vim-startify') - call minpac#add('mxw/vim-jsx') - call minpac#add('pangloss/vim-javascript') - call minpac#add('raichoo/purescript-vim') - call minpac#add('rust-lang/rust.vim') - call minpac#add('scrooloose/nerdcommenter') - call minpac#add('scrooloose/nerdtree') - call minpac#add('scrooloose/syntastic') - call minpac#add('tomtom/tlib_vim') - call minpac#add('toyamarinyon/vim-swift') - call minpac#add('tpope/vim-fugitive') - call minpac#add('tpope/vim-git') - call minpac#add('tpope/vim-repeat') - call minpac#add('tpope/vim-speeddating') - call minpac#add('tpope/vim-surround') - call minpac#add('vim-airline/vim-airline') - call minpac#add('vim-airline/vim-airline-themes') - call minpac#add('vim-pandoc/vim-pandoc-syntax') - call minpac#add('vim-scripts/Gundo') - call minpac#add('vim-scripts/SuperTab') - - let g:vimtex_disable_version_warning = 1 - - let g:airline#extensions#tabline#close_symbol = 'X' - let g:airline#extensions#tabline#enabled = 0 - let g:airline#extensions#tabline#left_alt_sep = '' - let g:airline#extensions#tabline#left_sep = '' - let g:airline#extensions#tabline#right_alt_sep = '' - let g:airline#extensions#tabline#right_sep = '' - let g:airline#extensions#tabline#show_close_button = 1 - let g:airline#extensions#tabline#show_tab_type = 0 - let g:airline#extensions#tabline#tab_min_count = 2 - let g:airline#extensions#tabline#tab_nr_type = 0 - let g:airline#extensions#tmuxline#enabled = 0 - let g:airline#extensions#wordcount#enabled = 1 - let g:airline_left_alt_sep = '' - let g:airline_left_sep = '' - let g:airline_right_alt_sep = '' - let g:airline_right_sep = '' - let g:airline_section_z = '%{line(".") + 1}/%{line("$")}' - let g:airline_theme='simple' - - let g:syntastic_always_populate_loc_list = 1 - let g:syntastic_auto_loc_list = 0 - let g:syntastic_check_on_open = 0 - let g:syntastic_check_on_wq = 0 - - nnoremap :GundoToggle - - map ,s :SyntasticToggleMode - map tw :GhcModTypeInsert - map ts :GhcModSplitFunCase - map tq :GhcModType - map te :GhcModTypeClear - let g:haskellmode_completion_ghc = 1 - - let g:SuperTabDefaultCompletionType = '' " '' - - if has("gui_running") - imap =SuperTabAlternateCompletion("\c-x>\c-o>") - else " no gui - if has("unix") - inoremap =SuperTabAlternateCompletion("\c-x>\c-o>") - endif - endif - - vmap a= :Tabularize /= - vmap a; :Tabularize /:: - vmap a- :Tabularize /-> - - - """ {{{ Set commands - syntax on - colorscheme delek - - filetype plugin indent on - - set path=$PWD/** - set wildmenu - set shortmess+=I - set noshowcmd - set nocompatible - set tabstop=4 - set shiftwidth=4 - set expandtab - set number - set nowb - set noswapfile - set mouse=a - set ruler - set ignorecase smartcase - set showmatch - set encoding=utf8 - set ffs=unix,dos,mac - set autoindent smartindent - set nowrap - set laststatus=2 - set noshowmode " vim-airline is installed, no need for that - set linespace=0 - set nohlsearch - set clipboard=unnamedplus,autoselect - set completeopt=menuone,menu,longest - set wildmode=longest,list,full - set nopaste - set title - set titleold="" - set titlestring=VIM:\ %F - set list - set listchars=tab:▸\ ,extends:❯,precedes:❮ - set showbreak=↪ - set norelativenumber - set foldlevelstart=30 - - let g:netrw_banner=0 - let g:netrw_browse_split=4 - let g:netrw_altv=1 " open splits to the right - let g:netrw_liststyle=3 " tree view - let g:netrw_list_hide=netrw_gitignore#Hide() - let g:netrw_list_hide.=',\(^\|\s\s\)\zs\.\S\+' - - call matchadd('colorcolumn', '\%101v', 100) - highlight folded ctermbg=black - highlight colorcolumn ctermbg=red - highlight matchparen cterm=bold ctermbg=black ctermfg=white - - - if exists("+undofile") - " undofile - This allows you to use undos after exiting and restarting - " This, like swap and backups, uses .vim-undo first, then ~/.vim/undo - " :help undo-persistence - " This is only present in 7.3+ - if isdirectory($HOME . '/.vim/undo') == 0 - :silent !mkdir -p ~/.vim/undo > /dev/null 2>&1 - endif - set undodir=./.vim-undo// - set undodir+=~/.vim/undo// - set undofile - endif - """ }}} - - " map m :%s/^M// - - " improve up/down navigation in wrapped lines - nnoremap j gj - nnoremap k gk - nnoremap 0 ^ - - " greek input - nnoremap η h - nnoremap ξ j - nnoremap κ k - nnoremap λ l - nnoremap ι i - " nmap t ok - " nmap T Oj - - function! AdjustTabbingTo2() - set noexpandtab tabstop=4 - retab! - set expandtab tabstop=2 - retab! - endfunction - - " nmap t AdjustTabbingTo2() - - nmap ddkP - nmap ddp - - vmap xkP`[V`] - vmap xp`[V`] - """ }}} - - """ {{{ Practicalities - function! StripTrailingWhitespaces() - let _s=@/ - let l=line(".") - let c=col(".") - - %s/\s\+$//e - - let @/=_s - call cursor(l,c) - endfunction - - if has("autocmd") - autocmd filetype markdown,text set formatprg=par\ -w80 - autocmd filetype haskell set formatprg=hindent - autocmd filetype markdown,text set textwidth=80 - autocmd filetype markdown,text set formatoptions+=t - autocmd bufreadpost * - \ if line("'\"") > 0 && line("'\"") <= line("$") | - \ exe "normal! g`\"" | - \ endif - autocmd bufwritepre * :call StripTrailingWhitespaces() - " autocmd bufnewfile,bufread *.md set filetype=markdown - autocmd bufnewfile,bufread *.asm set filetype=nasm - autocmd bufnewfile,bufread *.bf set filetype=brainfuck - autocmd bufnewfile,bufread *.do set filetype=sh - autocmd bufnewfile,bufread config set filetype=conf - autocmd bufnewfile,bufread *.conf set filetype=conf - autocmd bufnewfile,bufread *.4th set filetype=forth - autocmd bufnewfile,bufread *.tex set filetype=tex - autocmd bufnewfile,bufread *.c set keywordprg=man\ 3 - autocmd bufnewfile,bufread *.h set keywordprg=man\ 3 - - autocmd filetype make setlocal noexpandtab - - autocmd! bufnewfile,buffilepre,bufread *.md set filetype=markdown ".pandoc - autocmd bufreadpre * setlocal foldmethod=indent - autocmd bufwinenter * if &fdm == 'indent' | setlocal foldmethod=manual | endif - endif - - nnoremap @=(foldlevel('.')?'za':"\") - vnoremap zf - - highlight TrailSpace ctermbg=red guibg=darkred - match TrailSpace /\s\+$/ - - command! RandomLine execute 'normal! '.(system('/bin/bash -c "echo -n $RANDOM"') % line('$')).'G' - - - function! s:DiffWithSaved() - let filetype=&ft - diffthis - vnew | r # | normal! 1Gdd - diffthis - execute "setlocal bt=nofile bh=wipe nobl noswf ro ft=" . filetype - endfunction - command! DiffSaved call s:DiffWithSaved() - ''; + fullName = "Kierán Meinhardt"; + fullEmail = "kieran.meinhardt@gmail.com"; + theme = { + # gtk = { name = "Adwaita"; package = pkgs.gnome3.gnome_themes_standard; }; + gtk = { name = "Numix-SX-FullDark"; package = pkgs.numix-sx-gtk-theme; }; + icon = { name = "Papirus-Adapta-Nokto"; package = pkgs.papirus-icon-theme; }; + # icon = { name = "Adwaita"; package = pkgs.gnome3.adwaita-icon-theme; }; + }; + defaultApplications = { + terminal = "${pkgs.xfce.terminal}/bin/xfce4-terminal"; + webBrowser = "${pkgs.google-chrome}/bin/google-chrome-stable"; + fileManager = "${pkgs.gnome3.nautilus}/bin/nautilus"; + }; + wallpaper = pkgs.copyPathToStore ./art/haskell-grey.png; in { imports = [ "${builtins.fetchTarball https://github.com/rycee/home-manager/archive/master.tar.gz}/nixos" ]; - home-manager.users.my_username = { }; - nixpkgs.config.allowUnfree = true; security.sudo.enable = true; - fonts.fonts = with pkgs; [ roboto font-awesome-ttf fira-code eb-garamond lmodern ]; - environment.systemPackages = with pkgs; [ - stack python3 rustup nasm gcc tinycc nodejs ocaml fsharp clojure racket-minimal jo haskellPackages.hasktags perl ruby scala swiProlog jdk haskellPackages.idris ctags + fonts.fonts = with pkgs; [ powerline-fonts roboto font-awesome-ttf fira-code eb-garamond lmodern ]; + environment.systemPackages = [ theme.icon.package theme.gtk.package] ++ (with pkgs; [ + stack haskellPackages.hasktags + rustup + gcc tinycc ctags + python3 mypy + nodejs jo + perl ruby lua + nasm + ocaml fsharp swiProlog haskellPackages.idris + clojure racket-minimal + jdk scala ffmpeg mpv youtubeDL inkscape imagemagick zathura calibre - google-play-music-desktop-player spotify gnome3.gnome-music audacity + spotify gnome3.gnome-music audacity par haskellPackages.pandoc biber - google-chrome firefox lynx w3m + google-chrome firefox lynx w3m firefoxPackages.tor-browser lxappearance - lxqt.qterminal kitty - arc-icon-theme arc-kde-theme arc-theme breeze-qt5 + xfce.terminal xorg.xbacklight pamixer gnome3.nautilus kdeconnect - vim git - wget - htop - zip unzip - ripgrep - tmux + ripgrep tree whois - tree - texlive.combined.scheme-full + wget htop zip unzip tmux + texlive.combined.scheme-minimal rlwrap - lua libreoffice-fresh pmount gnumake franz grive2 geogebra gnuplot maxima - ]; + ]); - /*networking.hostname = "scardanelli";*/ - networking.networkmanager.enable = true; - - services.xserver.enable = true; - services.xserver.layout = "de, gr, ru"; - services.xserver.xkbVariant = "T3, polytonic, phonetic"; - services.xserver.xkbOptions = "terminate:ctrl_alt_bksp, grp:alt_space_toggle"; - i18n.consoleUseXkbConfig = true; - services.xserver.libinput.enable = true; - services.xserver.displayManager.lightdm.enable = true; - services.xserver.displayManager.lightdm.greeters.gtk.clock-format = "%F"; - services.xserver.displayManager.lightdm.greeters.gtk.iconTheme = { package = pkgs.arc-icon-theme; name = "Arc"; }; - services.xserver.displayManager.lightdm.greeters.gtk.theme = { package = pkgs.arc-theme; name = "Arc-Dark"; }; - services.xserver.windowManager.default = "i3"; - services.xserver.windowManager.i3.enable = true; - services.xserver.windowManager.i3.extraPackages = with pkgs; [ i3blocks networkmanagerapplet ]; - services.xserver.windowManager.i3.configFile = i3_conf; - environment.etc.i3blocks_conf.source = i3blocks_conf; - environment.etc.vimrc.source = vim_conf; - - programs.home-manager.enable = true; - programs.rofi = { - enable = true; - lines = 4; - font = uiFont + " " + uiFontSize; - terminal = defaultTerminal; - theme = "Arc-Dark"; + environment.shellAliases = + let rlwrap = cmd: "${pkgs.rlwrap}/bin/rlwrap ${cmd}"; in + { + ip = "${pkgs.iproute}/bin/ip -c"; + vi = "vim"; + ocaml = rlwrap "${pkgs.ocaml}/bin/ocaml"; + tmux = "${pkgs.tmux}/bin/tmux -2"; + clipboard = "${pkgs.xclip}/bin/xclip -se c"; + ghc = "${pkgs.stack}/bin/stack ghc --"; + ghci = "${pkgs.stack}/bin/stack ghc -- --interactive"; + external-ip = "${pkgs.dnsutils}/bin/dig +short myip.opendns.com @resolver1.opendns.com"; }; - services.compton = { enable = true; fade = true; shadow = true; fadeDelta = 2; }; + # networking.hostname = "scardanelli"; + services.xserver = { + enable = true; + layout = "de, gr, ru"; + xkbVariant = "T3, polytonic, phonetic_winkeys"; + xkbOptions = "terminate:ctrl_alt_bksp, grp:alt_space_toggle"; + libinput.enable = true; + displayManager.lightdm = { + enable = true; + background = wallpaper; + greeters.gtk = { + clock-format = "%F"; + iconTheme = theme.icon; + theme = theme.gtk; + extraConfig = with import ./theme.nix; '' + font-name = ${uiFont.name} ${toString uiFont.size} + xft-antialias = true + xft-dpi = 96 + xft-hintstyle = slight + xft-rgba = rgb + ''; + }; + }; + windowManager = { + default = "i3"; + i3 = { + enable = true; + configFile = pkgs.writeText "i3.conf" (import ./dot/i3.nix { + inherit pkgs defaultApplications wallpaper; + }); + }; + }; + }; + i18n.consoleUseXkbConfig = true; + + services.compton = { + enable = true; + fade = true; + shadow = true; + fadeDelta = 2; + menuOpacity = "0.95"; + }; services.openssh.enable = true; hardware.pulseaudio.enable = true; hardware.bluetooth.enable = true; + programs.zsh = { + enable = true; + enableCompletion = true; + autosuggestions.enable = true; + syntaxHighlighting.enable = true; + syntaxHighlighting.highlighters = [ "main" "brackets" "pattern" "cursor" "root" "line" ]; + interactiveShellInit = '' + setopt INTERACTIVE_COMMENTS + setopt MULTIOS + setopt AUTO_PUSHD + setopt AUTO_NAME_DIRS + setopt PUSHD_MINUS + setopt PUSHD_TO_HOME + ''; + promptInit = '' + PROMPT="%{$fg_bold[white]%}%~ \$([[ \$? == 0 ]] && echo \"%{$fg_bold[blue]%}\" || echo \"%{$fg_bold[red]%}\")%#%{$reset_color%} " + RPROMPT='$(git_prompt_info)' + + ZSH_THEME_GIT_PROMPT_PREFIX="%{$reset_color%}%{$fg[green]%}" + ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" + ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[red]%}*" + ''; + ohMyZsh.enable = true; + ohMyZsh.plugins = [ "common-aliases" "git" "git-extras" "history" "jsontools" ]; + }; + programs.bash = { + promptInit = ''PS1="[\$(exit=\$?; [[ \$exit == 0 ]] && echo \"\[\033[1;32m\]\$exit\" || echo \"\033[1;31m\]\$exit\")$(tput sgr0)]$(tput bold) \w $(tput setaf 1)\$$(tput sgr0) ''; + enableCompletion = true; + }; + programs.vim.defaultEditor = true; - programs.zsh.enable = true; - programs.zsh.autosuggestions.enable = true; - programs.zsh.enableCompletion = true; - programs.zsh.syntaxHighlighting.enable = true; - programs.zsh.syntaxHighlighting.highlighters = [ "main" "brackets" "pattern" "cursor" "root" "line" ]; - programs.zsh.ohMyZsh.enable = true; - programs.zsh.ohMyZsh.plugins = [ "common-aliases" "git" "git-extras" "history" "jsontools" ]; - programs.zsh.ohMyZsh.theme = "muse"; users.users.kfm = { createHome = true; - description = "Kierán Meinhardt"; + description = fullName; extraGroups = [ "wheel" "networkmanager" ]; group = "users"; home = "/home/kfm"; shell = pkgs.zsh; - uid = 1234; password = "kfm"; }; + + networking.networkmanager.enable = true; + + home-manager.users.kfm = { + programs.command-not-found.enable = true; + + gtk = { + enable = true; + font = with import ./theme.nix; { package = pkgs.roboto; name = uiFont.name; }; + iconTheme = theme.icon; + theme = theme.gtk; + }; + + programs.git = { + enable = true; + userName = fullName; + userEmail = fullEmail; + aliases = { + br = "branch"; + co = "checkout"; + ci = "commit"; + amend = "commit --amend"; + st = "status"; + unstage = "reset HEAD --"; + sdiff = "diff --staged"; + last = "log -1 HEAD"; + }; + ignores = [ "*~" ".stack-work/" "__pycache__/" ".mypy_cache/" "*.o" "*.hi" "*.aux" ]; + }; + + programs.vim = { + enable = true; + plugins = [ + "ctrlp" + "deoplete-rust" + "deoplete-nvim" + "idris-vim" + "latex-box" + "rust-vim" + "supertab" + "syntastic" + "tabular" + "typescript-vim" + "vim-airline" + "vim-airline-themes" + "vim-commentary" + "vim-eunuch" + "vim-fugitive" + "vim-gitgutter" + "vim-javascript" + "vim-nix" + "vim-pandoc" + "vim-pandoc-after" + "vim-pandoc-syntax" + "vim-repeat" + "vim-sensible" + "vim-startify" + "vim-surround" + ]; + settings = { + smartcase = true; + shiftwidth = 4; + tabstop = 4; + expandtab = true; + number = true; + }; + extraConfig = import ./dot/vim.nix; + }; + + programs.rofi = with import ./theme.nix; { + enable = true; + separator = "solid"; + scrollbar = false; + borderWidth = 0; + lines = 5; + font = "${uiFont.name} ${toString uiFont.size}"; + colors = { + window = { background = black; border = black; separator = gray.dark; }; + rows = { + normal = { + background = black; + foreground = gray.light; + backgroundAlt = black; + highlight = { background = black; foreground = white; }; + }; + }; + }; + }; + + services.dunst = with import ./theme.nix; { + enable = true; + iconTheme = { package = theme.icon.package; name = theme.icon.name; size = "64x64"; }; + settings.global = { + transparency = 20; + font = "${uiFont.name} ${toString uiFont.size}"; + }; + }; + + home.file = { + ".ghci".text = import ./dot/ghci.nix { inherit pkgs; }; + ".tmux.conf".text = import ./dot/tmux.nix; + ".stack/config.yaml".text = import ./dot/stack.nix { + githubUser = "kmein"; + inherit fullName fullEmail; + }; + ".config/zathura/zathurarc".text = "set selection-clipboard clipboard"; + ".config/mpv/input.conf".text = import ./dot/mpv.nix; + ".config/xfce4/terminal/terminalrc".text = import ./dot/terminal.nix { inherit defaultApplications; }; + }; + }; + } diff --git a/dot/ghci.nix b/dot/ghci.nix new file mode 100644 index 0000000..99d1f14 --- /dev/null +++ b/dot/ghci.nix @@ -0,0 +1,11 @@ +{pkgs}: +'' +:set editor vim +:def hoogle \x -> return $ ":!${pkgs.haskellPackages.hoogle}/bin/hoogle --color \"" ++ x ++ "\" " +:def doc \x -> return $ ":!${pkgs.haskellPackages.hoogle}/bin/hoogle --info --color \"" ++ x ++ "\"" +:def search \x -> return $ ":!${pkgs.haskellPackages.hoogle}/bin/hoogle --color \"" ++ x ++ "\" | head" +:def pl \x -> return $ ":!${pkgs.haskellPackages.pointfree}/bin/pointfree -v \"" ++ x ++ "\"" +:def unpl \x -> return $ ":!${pkgs.haskellPackages.pointful}/bin/pointful \"" ++ x ++ "\"" +:set prompt "\o033[1m%s\o033[1;34m λ\o033[0m " +'' +#:def djinn \x -> return $ ":!echo \"" ++ x ++ "\" | ${pkgs.haskellPackages.djinn}/bin/djinn /dev/stdin" diff --git a/dot/i3.nix b/dot/i3.nix new file mode 100644 index 0000000..f76b09d --- /dev/null +++ b/dot/i3.nix @@ -0,0 +1,118 @@ +{ pkgs, defaultApplications, wallpaper }: +let theme = import ../theme.nix; in +with theme; +'' +set $mod Mod4 + +font pango:${uiFont.name} ${toString uiFont.size} +floating_modifier $mod + +hide_edge_borders both +new_window pixel 1 +new_float pixel 1 + +bindsym $mod+Return exec ${defaultApplications.terminal} +bindsym $mod+y exec ${defaultApplications.webBrowser} +bindsym $mod+t exec ${defaultApplications.fileManager} +bindsym $mod+Shift+q kill +bindsym $mod+Left focus left +bindsym $mod+Down focus down +bindsym $mod+Up focus up +bindsym $mod+Right focus right +bindsym $mod+p workspace prev +bindsym $mod+n workspace next +bindsym $mod+Shift+Left move left +bindsym $mod+Shift+Down move down +bindsym $mod+Shift+Up move up +bindsym $mod+Shift+Right move right +bindsym $mod+h split h +bindsym $mod+v split v +bindsym $mod+f fullscreen toggle +bindsym $mod+s layout stacking +bindsym $mod+w layout tabbed +bindsym $mod+e layout toggle split +bindsym $mod+Shift+z floating toggle +bindsym $mod+Shift+c reload +bindsym $mod+Shift+r restart +bindsym $mod+d exec ${pkgs.rofi}/bin/rofi -display-run — -show run + +set $WS1 1 +set $WS2 2 +set $WS3 3 +set $WS4 4 +set $WS5 5 +set $WS6 6 +set $WS7 7 +set $WS8 8 +set $WS9 9 +set $WS10 10 +bindsym $mod+0 workspace $WS10 +bindsym $mod+1 workspace $WS1 +bindsym $mod+2 workspace $WS2 +bindsym $mod+3 workspace $WS3 +bindsym $mod+4 workspace $WS4 +bindsym $mod+5 workspace $WS5 +bindsym $mod+6 workspace $WS6 +bindsym $mod+7 workspace $WS7 +bindsym $mod+8 workspace $WS8 +bindsym $mod+9 workspace $WS9 +bindsym $mod+Shift+0 move container to workspace $WS10 +bindsym $mod+Shift+1 move container to workspace $WS1 +bindsym $mod+Shift+2 move container to workspace $WS2 +bindsym $mod+Shift+3 move container to workspace $WS3 +bindsym $mod+Shift+4 move container to workspace $WS4 +bindsym $mod+Shift+5 move container to workspace $WS5 +bindsym $mod+Shift+6 move container to workspace $WS6 +bindsym $mod+Shift+7 move container to workspace $WS7 +bindsym $mod+Shift+8 move container to workspace $WS8 +bindsym $mod+Shift+9 move container to workspace $WS9 + +bindsym XF86AudioLowerVolume exec --no-startup-id ${pkgs.pamixer}/bin/pamixer -d 5 && pkill -RTMIN+3 i3blocks +bindsym XF86AudioRaiseVolume exec --no-startup-id ${pkgs.pamixer}/bin/pamixer -i 5 && pkill -RTMIN+3 i3blocks +bindsym XF86AudioMute exec --no-startup-id ${pkgs.pamixer}/bin/pamixer -t && pkill -RTMIN+3 i3blocks +bindsym XF86MonBrightnessUp exec --no-startup-id ${pkgs.xorg.xbacklight}/bin/xbacklight + 10 && pkill -RTMIN+2 i3blocks +bindsym XF86MonBrightnessDown exec --no-startup-id ${pkgs.xorg.xbacklight}/bin/xbacklight - 10 && pkill -RTMIN+2 i3blocks + +mode "  " { + bindsym Left resize shrink width 10 px or 10 ppt + bindsym Down resize grow height 10 px or 10 ppt + bindsym Up resize shrink height 10 px or 10 ppt + bindsym Right resize grow width 10 px or 10 ppt + bindsym Escape mode "default" + bindsym Space mode "default" +} +bindsym $mod+r mode "  " + +#class container-border container-bg fg indicator window-border +client.focused ${gray.dark} ${black} ${white} ${white} ${gray.dark} +client.focused_inactive ${black} ${black} ${gray.dark} ${white} ${black} +client.unfocused ${black} ${black} ${gray.dark} ${white} ${black} +client.urgent ${red.light} ${black} ${white} ${white} ${red.light} +client.placeholder ${black} ${black} ${gray.dark} ${white} ${black} + +bar { + status_command "${pkgs.i3blocks}/bin/i3blocks -c ${pkgs.writeTextFile { + name = "i3blocks.conf"; + text = import ./i3blocks.nix { inherit pkgs theme; }; + }}" + position top + + font pango:${uiFont.name},FontAwesome ${toString uiFont.size} + separator_symbol " // " + colors { + separator ${gray.dark} + background ${black} + statusline ${gray.dark} + + # border bg fg + focused_workspace ${black} ${black} ${white} + active_workspace ${black} ${black} ${gray.light} + inactive_workspace ${black} ${black} ${gray.dark} + urgent_workspace ${black} ${black} ${red.light} + binding_mode ${black} ${black} ${red.light} + } +} + +exec --no-startup-id ${pkgs.networkmanagerapplet}/bin/nm-applet +exec --no-startup-id ${pkgs.feh}/bin/feh --bg-fill ${wallpaper} +'' diff --git a/dot/i3blocks.nix b/dot/i3blocks.nix new file mode 100644 index 0000000..62c978d --- /dev/null +++ b/dot/i3blocks.nix @@ -0,0 +1,172 @@ +{ pkgs, theme }: +let + spotify_info = pkgs.writeScript "spotify.info" '' + #!/bin/bash + + STATUS=$(${pkgs.dbus}/bin/dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.freedesktop.DBus.Properties.Get string:'org.mpris.MediaPlayer2.Player' string:'PlaybackStatus'|egrep -A 1 "string"|cut -b 26-|cut -d '"' -f 1|egrep -v ^$) + + if [[ "$STATUS" == 'Playing' ]]; then + printf '\uf1bc ' + printf '\uf04b' + elif [[ "$STATUS" == 'Paused' ]]; then + printf '\uf1bc ' + printf '\uf04c' + elif [[ "$STATUS" == 'Stopped' ]]; then + printf '\uf1bc ' + printf '\uf04d' + else + exit 1 + fi + + printf ' ' + + METADATA=$(${pkgs.dbus}/bin/dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.freedesktop.DBus.Properties.Get string:'org.mpris.MediaPlayer2.Player' string:'Metadata') + ARTIST=$(echo "$METADATA" | egrep -A 2 "artist" | egrep -v "artist" | egrep -v "array" | cut -b 27- | cut -d '"' -f 1 | egrep -v ^$) + TITLE=$(echo "$METADATA" | egrep -A 1 "title" | egrep -v "title" | cut -b 44- | cut -d '"' -f 1 | egrep -v ^$) + + printf "%s \u2237 %s" "$ARTIST" "$TITLE" + ''; + battery_info = pkgs.writeScript "battery.info" '' + #!/usr/bin/env bash + cd "/sys/class/power_supply/$BLOCK_INSTANCE/" + + status=$(cat status) + charge_f=$((100 * $(cat charge_now) / $(cat charge_full))) + + if [[ "$charge_f" -lt 20 ]]; then + printf '\uf244' + elif [[ "$charge_f" -lt 40 ]]; then + printf '\uf243' + elif [[ "$charge_f" -lt 60 ]]; then + printf '\uf242' + elif [[ "$charge_f" -lt 80 ]]; then + printf '\uf241' + else + printf '\uf240' + fi + + printf ' ' + + if [[ "$status" == 'Charging' ]]; then + printf '\uf106' + elif [[ "$status" == 'Discharging' ]]; then + printf '\uf107' + elif [[ "$status" == 'Full' ]]; then + printf '\uf0e7' + else + printf '[%s]' "$status" + fi + + printf ' ' + + if [[ "$status" != 'Full' ]]; then + rate_raw=$(($(cat voltage_now) * $(cat power_now))) + rate=$(bc <<< "scale=1; $rate_raw / 10^12") + printf '%s\u2009W, ' "$rate" + fi + + charge_d=$((100 * $(cat charge_now) / $(cat charge_full))) + printf '%s%%\n' "$charge_d" + + if [[ "$status" == 'Discharging' ]]; then + if [[ "$charge_d" -lt 10 ]]; then + printf '\n#E41C28' + elif [[ "$charge_d" -lt 20 ]]; then + printf '\n#EEBF13' + fi + fi + ''; + volume_info = pkgs.writeScript "volume.info" '' + #!/usr/bin/env bash + if [[ "$BLOCK_BUTTON" == 1 ]]; then + ${pkgs.pamixer}/bin/pamixer -i 5 + elif [[ "$BLOCK_BUTTON" == 3 ]]; then + ${pkgs.pamixer}/bin/pamixer -d 5 + elif [[ "$BLOCK_BUTTON" == 2 ]]; then + ${pkgs.pamixer}/bin/pamixer -t + fi + + if $(${pkgs.pamixer}/bin/pamixer --get-mute); then + printf '\uf026 0%%\n\n#EEBF13' + else + volume=$(${pkgs.pamixer}/bin/pamixer --get-volume) + printf '\uf028 %s%%' "$volume" + fi + ''; + fancyDate = pkgs.writeScript "fancy_date.py" '' + #!/usr/bin/env python3 + from datetime import datetime + now = datetime.now() + print(now.strftime("%d\u2009{}\u2009%Y ⟨%V⟩").format(chr(0x2160 + (now.month - 1)))) + ''; in +with theme; +'' +markup=pango +align=center +color=${white} + +[spotify] +command=${spotify_info} +interval=1 + +[separator] +command=${pkgs.xkblayout-state}/bin/xkblayout-state print %s +label= +interval=2 + +[separator] + +[volume] +command=${volume_info} +min_width= 100% +interval=once +signal=3 + +[separator] + +[brightness] +command=printf "%.1f%%" $(${pkgs.xorg.xbacklight}/bin/xbacklight) +label= +min_width= 100% +signal=2 +interval=once + +[separator] + +[cpu_usage] +command=cut -d' ' -f 1-3 < /proc/loadavg +label= +interval=2 + +[separator] + +[ram_usage] +command=free -h | grep "Mem" | awk '{print $3}' +label= +interval=2 +align=center + +[separator] + +[battery] +command=${battery_info} +#echo "$(cat /sys/class/power_supply/BAT1/capacity)% ($(cat /sys/class/power_supply/BAT1/status))" +interval=10 +instance=BAT1 + +[separator] + +[date] +command=${fancyDate} +interval=30 +label= + +[separator] + +[time] +command=date +'%H:%M' +interval=30 +label= + +[separator] +'' diff --git a/dot/mpv.nix b/dot/mpv.nix new file mode 100644 index 0000000..e1592a2 --- /dev/null +++ b/dot/mpv.nix @@ -0,0 +1,10 @@ +'' +Alt+RIGHT add video-rotate 90 +Alt+LEFT add video-rotate -90 +Alt+- add video-zoom -0.25 +Alt+= add video-zoom 0.25 +Alt+l add video-pan-x -0.05 +Alt+h add video-pan-x 0.05 +Alt+k add video-pan-y 0.05 +Alt+j add video-pan-y -0.05 +'' diff --git a/dot/stack.nix b/dot/stack.nix new file mode 100644 index 0000000..8320c59 --- /dev/null +++ b/dot/stack.nix @@ -0,0 +1,10 @@ +{ fullName, fullEmail, githubUser }: +'' +templates: + params: + author-name: ${fullName} + author-email: ${fullEmail} + category: Data + copyright: 'Copyright: (c) 2018 ${fullName}' + github-username: ${githubUser} +'' diff --git a/dot/terminal.nix b/dot/terminal.nix new file mode 100644 index 0000000..f236cbb --- /dev/null +++ b/dot/terminal.nix @@ -0,0 +1,26 @@ +{ defaultApplications }: +with import ../theme.nix; +'' +[Configuration] +FontName=${terminalFont.regular.name} ${toString terminalFont.size} +MiscAlwaysShowTabs=FALSE +MiscBell=TRUE +MiscMenubarDefault=FALSE +MiscToolbarDefault=FALSE +MiscConfirmClose=FALSE +MiscCursorBlinks=TRUE +MiscCursorShape=TERMINAL_CURSOR_SHAPE_BLOCK +MiscBordersDefault=FALSE +MiscMiddleClickOpensUri=TRUE +MiscMouseWheelZoom=TRUE +MiscRewrapOnResize=TRUE +TitleMode=TERMINAL_TITLE_HIDE +MiscMouseAutohide=FALSE +MiscHighlightUrls=TRUE +BackgroundDarkness=0.95 +BackgroundMode=TERMINAL_BACKGROUND_TRANSPARENT +ColorPalette=${dark};${red.dark};${green.dark};${yellow.dark};${blue.dark};${magenta.dark};${cyan.dark};${light};${dark};${red.light};${green.light};${yellow.light};${blue.light};${magenta.light};${cyan.light};${light} +ColorBackground=${veryDark} +ColorForeground=${light} +ColorCursor=${light} +'' diff --git a/dot/tmux.nix b/dot/tmux.nix new file mode 100644 index 0000000..bfd5102 --- /dev/null +++ b/dot/tmux.nix @@ -0,0 +1,39 @@ +'' +set -g status-interval 2 +set -g status-left-length 32 +set -g status-right-length 150 + +# Appearance +set -g default-terminal "screen-256color" +set -g status-utf8 on +set -g status-bg default +# set -g status-fg white +setw -g window-status-format "#[fg=colour12,bg=colour233] #I #[fg=white,bg=colour237] #W " +setw -g window-status-current-format "#[fg=colour12,bg=colour233] * #[fg=white,bg=colour237,bold] #W " +# setw -g window-status-current-bg colour0 +# setw -g window-status-current-fg colour11 +# Status Bar +set -g status-left "" +# set -g status-right "#[fg=colour196,bg=colour233] LOAD #[fg=white,bg=colour237] #(awk '{print $1, $2, $3}' < /proc/loadavg) #[default] #[fg=colour196,bg=colour233] CPU #[fg=white,bg=colour237] #(ps -A -o pcpu | tail -n+2 | paste -sd+ | bc) #[default] #[fg=colour196,bg=colour233] MEM #[fg=white,bg=colour237] #(ps -A -o pmem | tail -n+2 | paste -sd+ | bc) #[default] #[fg=white,bg=colour237,bold] %Y-%m-%d #[default]#[fg=colour196,bg=colour233] %H:%M " +set -g status-right "#[fg=colour12,bg=colour233] LOAD #[fg=colour255,bg=colour237] #(cut -d' ' -f 1-3 < /proc/loadavg) #[default] #[fg=colour12,bg=colour233] MEM #[fg=colour255,bg=colour237] #(free -h --si | awk 'NR==2{print $3}') #[default] #[fg=colour255,bg=colour237,bold] %Y-%m-%d #[default]#[fg=colour12,bg=colour233] %H:%M " +set -g status-justify left + +# setw -g window-status-current-fg black +# setw -g window-status-fg black +# setw -g window-status-current-bg white +# setw -g window-status-bg white +# setw -g window-status-current-attr bold + +set -g pane-active-border-fg colour237 +set -g pane-border-fg colour237 +set -g pane-active-border-bg default +set -g pane-border-bg default + +set -g status-position bottom + +set -g mouse on + +# displays * +unbind * +bind * list-clients +'' diff --git a/dot/vim.nix b/dot/vim.nix new file mode 100644 index 0000000..ece1e0a --- /dev/null +++ b/dot/vim.nix @@ -0,0 +1,153 @@ +'' +filetype off + +if exists("g:loaded_airline") + set noshowmode laststatus=0 noruler + let g:airline#extensions#tabline#close_symbol = 'X' + let g:airline#extensions#tabline#enabled = 0 + let g:airline#extensions#tabline#left_alt_sep = '' + let g:airline#extensions#tabline#left_sep = '' + let g:airline#extensions#tabline#right_alt_sep = '' + let g:airline#extensions#tabline#right_sep = '' + let g:airline#extensions#tabline#show_close_button = 1 + let g:airline#extensions#tabline#show_tab_type = 0 + let g:airline#extensions#tabline#tab_min_count = 2 + let g:airline#extensions#tabline#tab_nr_type = 0 + let g:airline#extensions#tmuxline#enabled = 0 + let g:airline#extensions#wordcount#enabled = 1 + let g:airline_left_alt_sep = '' + let g:airline_left_sep = '' + let g:airline_right_alt_sep = '' + let g:airline_right_sep = '' + let g:airline_section_z = '%{line(".") + 1}/%{line("$")}' +endif +if exists("g:loaded_airline_themes") + let g:airline_theme='simple' +endif + +if exists("g:loaded_syntastic_plugin") + let g:syntastic_always_populate_loc_list = 1 + let g:syntastic_auto_loc_list = 0 + let g:syntastic_check_on_open = 0 + let g:syntastic_check_on_wq = 0 + map ,s :SyntasticToggleMode +endif + +if exists("g:loaded_gundo") + nnoremap :GundoToggle +endif + +" if supertab +let g:SuperTabDefaultCompletionType = '' +if has("unix") + inoremap =SuperTabAlternateCompletion("\c-x>\c-o>") +endif + +" if tabular +vmap a= :Tabularize /= +vmap a; :Tabularize /:: +vmap a- :Tabularize /-> + +colorscheme delek + +set path=$PWD/** +set completeopt=menu,longest +set wildmode=longest,list,full +set shortmess+=aI +set nowritebackup noswapfile +set mouse=a +set showmatch +set encoding=utf8 +set ffs=unix,dos,mac +set smartindent +set nowrap +set nohlsearch +set clipboard=unnamedplus,autoselect +set nopaste +set list listchars=tab:▸\ ,extends:❯,precedes:❮,nbsp:⍽ showbreak=↪ +set foldlevelstart=30 + +if exists("g:loaded_netrwPlugin") + let g:netrw_banner=0 + let g:netrw_browse_split=4 + let g:netrw_altv=1 " open splits to the right + let g:netrw_liststyle=3 " tree view + let g:netrw_list_hide=netrw_gitignore#Hide() + let g:netrw_list_hide.=',\(^\|\s\s\)\zs\.\S\+' +endif + +call matchadd('colorcolumn', '\%101v', 100) +highlight folded ctermbg=black +highlight colorcolumn ctermbg=red +highlight matchparen cterm=bold ctermbg=black ctermfg=white +highlight TrailSpace ctermbg=red guibg=darkred +match TrailSpace /\s\+$/ + +" undofile - This allows you to use undos after exiting and restarting +" This, like swap and backups, uses .vim-undo first, then ~/.vim/undo +" :help undo-persistence +if exists("+undofile") + if isdirectory($HOME . '/.vim/undo') == 0 + :silent !mkdir -p ~/.vim/undo > /dev/null 2>&1 + endif + set undodir=./.vim-undo// + set undodir+=~/.vim/undo// + set undofile +endif + +nmap ddp +nmap ddkP +vmap xp`[V`] +vmap xkP`[V`] + +nnoremap @=(foldlevel('.')?'za':"\") +vnoremap zf + +command! RandomLine execute 'normal! '.(system('/bin/bash -c "echo -n $RANDOM"') % line('$')).'G' + +function! StripTrailingWhitespaces() + let _s=@/ + let l=line(".") + let c=col(".") + + %s/\s\+$//e + + let @/=_s + call cursor(l,c) +endfunction + +function! s:DiffWithSaved() + let filetype=&ft + diffthis + vnew | r # | normal! 1Gdd + diffthis + execute "setlocal bt=nofile bh=wipe nobl noswf ro ft=" . filetype +endfunction +command! DiffSaved call s:DiffWithSaved() + +if has("autocmd") + autocmd filetype markdown,text set formatprg=par\ -w80 + autocmd filetype haskell set formatprg=hindent + autocmd filetype markdown,text set textwidth=80 + autocmd filetype markdown,text set formatoptions+=t + autocmd bufreadpost * + \ if line("'\"") > 0 && line("'\"") <= line("$") | + \ exe "normal! g`\"" | + \ endif + autocmd bufwritepre * :call StripTrailingWhitespaces() + autocmd bufnewfile,bufread *.md set filetype=markdown.pandoc + autocmd bufnewfile,bufread *.asm set filetype=nasm + autocmd bufnewfile,bufread *.bf set filetype=brainfuck + autocmd bufnewfile,bufread *.do set filetype=sh + autocmd bufnewfile,bufread config set filetype=conf + autocmd bufnewfile,bufread *.conf set filetype=conf + autocmd bufnewfile,bufread *.4th set filetype=forth + autocmd bufnewfile,bufread *.c set keywordprg=man\ 3 + autocmd bufnewfile,bufread *.h set keywordprg=man\ 3 + + autocmd filetype make setlocal noexpandtab + + autocmd bufreadpre * setlocal foldmethod=indent + autocmd bufwinenter * if &fdm == 'indent' | setlocal foldmethod=manual | endif +endif +'' diff --git a/theme.nix b/theme.nix new file mode 100644 index 0000000..541ee03 --- /dev/null +++ b/theme.nix @@ -0,0 +1,25 @@ +{ + uiFont = { name = "Roboto"; size = 10; }; + terminalFont = { + regular = { name = "Roboto Mono for Powerline"; }; + bold = { name = "Roboto Mono Bold for Powerline"; }; + italic = { name = "Roboto Mono Italic for Powerline"; }; + boldItalic = { name = "Roboto Mono Bold Italic for Powerline"; }; + size = 10; + }; + + white = "#ffffff"; + black = "#000000"; + gray = { light = "#aaaaaa"; dark = "#888888"; }; + + # Antares color scheme + dark = "#151515"; + veryDark = "#080808"; + red = { light = "#de575c"; dark = "#de575c"; }; + yellow = { light = "#ebe971"; dark = "#ebe971"; }; + green = { light = "#00b853"; dark = "#00b853"; }; + blue = { light = "#90d0f0"; dark = "#7fc6f0"; }; + magenta = { light = "#cf9ffa"; dark = "#cf9ffa"; }; + cyan = { light = "#4ae5e8"; dark = "#4ae5e8"; }; + light = "#bbbbbb"; +}