1
0
mirror of https://github.com/kmein/niveum synced 2026-03-16 18:21:07 +01:00

Configure like hell

This commit is contained in:
kmein
2018-09-11 18:16:33 +02:00
parent 58c4b4cc73
commit 9bd7eb2bcb
11 changed files with 792 additions and 613 deletions

11
dot/ghci.nix Normal file
View File

@@ -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"

118
dot/i3.nix Normal file
View File

@@ -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}
''

172
dot/i3blocks.nix Normal file
View File

@@ -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]
''

10
dot/mpv.nix Normal file
View File

@@ -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
''

10
dot/stack.nix Normal file
View File

@@ -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}
''

26
dot/terminal.nix Normal file
View File

@@ -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}
''

39
dot/tmux.nix Normal file
View File

@@ -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
''

153
dot/vim.nix Normal file
View File

@@ -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<CR>
endif
if exists("g:loaded_gundo")
nnoremap <F5> :GundoToggle<CR>
endif
" if supertab
let g:SuperTabDefaultCompletionType = '<c-n>'
if has("unix")
inoremap <Nul> <c-r>=SuperTabAlternateCompletion("\<lt>c-x>\<lt>c-o>")<cr>
endif
" if tabular
vmap a= :Tabularize /=<CR>
vmap a; :Tabularize /::<CR>
vmap a- :Tabularize /-><CR>
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 <C-j> ddp
nmap <C-k> ddkP
vmap <C-j> xp`[V`]
vmap <C-k> xkP`[V`]
nnoremap <silent> <Space> @=(foldlevel('.')?'za':"\<Space>")<CR>
vnoremap <Space> zf
command! RandomLine execute 'normal! '.(system('/bin/bash -c "echo -n $RANDOM"') % line('$')).'G'
function! <SID>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 <SID>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
''