diff options
Diffstat (limited to 'makefu/2configs')
36 files changed, 1020 insertions, 66 deletions
diff --git a/makefu/2configs/bgt/download.binaergewitter.de.nix b/makefu/2configs/bgt/download.binaergewitter.de.nix index f223081e9..77c9ddc81 100644 --- a/makefu/2configs/bgt/download.binaergewitter.de.nix +++ b/makefu/2configs/bgt/download.binaergewitter.de.nix @@ -37,6 +37,11 @@ in { ''; }; services.nginx = { + appendHttpConfig = '' + types { + audio/ogg oga ogg opus; + } + ''; enable = lib.mkDefault true; recommendedGzipSettings = true; recommendedOptimisation = true; diff --git a/makefu/2configs/bureautomation/automation/bureau-shutdown.nix b/makefu/2configs/bureautomation/automation/bureau-shutdown.nix index 007f6064a..b9aa710c3 100644 --- a/makefu/2configs/bureautomation/automation/bureau-shutdown.nix +++ b/makefu/2configs/bureautomation/automation/bureau-shutdown.nix @@ -34,18 +34,18 @@ } { alias = "Turn off Fernseher after last in group left"; trigger = [ - { # trigger when movement was detected at the time - platform = "state"; - entity_id = "group.team"; - from = "home"; - to = "not_home"; - } - { # trigger at 18:00 no matter what - # to avoid 'everybody left before 18:00:00' - platform = "time"; - at = "18:00:00"; - } - ]; + { # trigger when movement was detected at the time + platform = "state"; + entity_id = "group.team"; + from = "home"; + to = "not_home"; + } + { # trigger at 18:00 no matter what + # to avoid 'everybody left before 18:00:00' + platform = "time"; + at = "18:00:00"; + } + ]; action = [ { service = "homeassistant.turn_off"; @@ -58,7 +58,7 @@ } { service = "notify.telegrambot"; - data = { + data_template = { title = "Bureau Shutdown"; message = "All devices are turned off due to {{ trigger.platform }}"; }; diff --git a/makefu/2configs/bureautomation/camera/comic.nix b/makefu/2configs/bureautomation/camera/comic.nix new file mode 100644 index 000000000..a847b0add --- /dev/null +++ b/makefu/2configs/bureautomation/camera/comic.nix @@ -0,0 +1,6 @@ +[ + { name = "Poorly Drawn Lines"; + platform = "generic"; + still_image_url = http://127.0.0.1:8123/local/lines.png ; + } +] diff --git a/makefu/2configs/bureautomation/comic-updater.nix b/makefu/2configs/bureautomation/comic-updater.nix new file mode 100644 index 000000000..5f26bc2c7 --- /dev/null +++ b/makefu/2configs/bureautomation/comic-updater.nix @@ -0,0 +1,28 @@ +{ config, lib, pkgs, buildPythonPackage, ... }: + +let + mq = "192.168.8.11"; + pkg = pkgs.ampel; +in { + systemd.services.comic-updater = { + startAt = "daily"; + description = "Send led change to message queue"; + after = [ "network-online.target" ] ++ (lib.optional config.services.mosquitto.enable "mosquitto.service"); + path = with pkgs; [ wget xmlstarlet ]; + wantedBy = [ "multi-user.target" ]; + serviceConfig = { + User = "hass"; + WorkingDirectory = config.services.home-assistant.configDir; + ExecStart = pkgs.writeDash "update-poorly-drawn-lines" '' + set -euf + mkdir -p www/ + cd www/ + pic=$(wget -O- http://www.poorlydrawnlines.com/feed/ \ + | xml sel -t -v '/rss/channel/item/content:encoded' \ + | head -n 2 | sed -n 's/.*src="\([^"]\+\)".*/\1/p' ) + wget "$pic" -nc && cp -v "$(basename "$pic")" lines.png + ''; + PrivateTmp = true; + }; + }; +} diff --git a/makefu/2configs/bureautomation/default.nix b/makefu/2configs/bureautomation/default.nix index 8ec9dacc2..d745d894a 100644 --- a/makefu/2configs/bureautomation/default.nix +++ b/makefu/2configs/bureautomation/default.nix @@ -1,12 +1,14 @@ { config, pkgs, lib, ... }: let kodi-host = "192.168.8.11"; - ten_hours = import ./combination/10h_timers.nix { inherit lib; }; # provides: timer automation script - mittagessen = import ./combination/mittagessen.nix { inherit lib; }; # provides: automation script - matrix = import ./combination/matrix.nix { inherit lib; }; # provides: matrix automation + ten_hours = import ./multi/10h_timers.nix { inherit lib; }; # provides: timer automation script + mittagessen = import ./multi/mittagessen.nix { inherit lib; }; # provides: automation script + matrix = import ./multi/matrix.nix { inherit lib; }; # provides: matrix automation + aramark = import ./multi/aramark.nix { inherit lib; }; # provides: pommes sensor in { imports = [ ./ota.nix + ./comic-updater.nix ]; networking.firewall.allowedTCPPorts = [ 8123 ]; state = [ "/var/lib/hass/known_devices.yaml" ]; @@ -113,7 +115,8 @@ in { ]; binary_sensor = (import ./binary_sensor/buttons.nix) ++ - (import ./binary_sensor/motion.nix); + (import ./binary_sensor/motion.nix) ++ + aramark.binary_sensor; sensor = [{ platform = "version"; }] ++ @@ -122,10 +125,12 @@ in { (import ./sensor/airquality.nix) ++ ((import ./sensor/outside.nix) {inherit lib;}) ++ (import ./sensor/influxdb.nix) ++ - (import ./sensor/tasmota_firmware.nix); + (import ./sensor/tasmota_firmware.nix) ++ + aramark.sensor; camera = - (import ./camera/verkehrskamera.nix); + (import ./camera/verkehrskamera.nix) + ++ (import ./camera/comic.nix); # not yet released #person = @@ -174,6 +179,7 @@ in { "group.team" "group.nachtlicht" "group.switches" + "group.aramark" ]; }; automation = []; @@ -195,7 +201,6 @@ in { "device_tracker.carsten_phone" "device_tracker.thierry_phone" "device_tracker.frank_phone" - "device_tracker.anthony_phone" # "person.thorsten" # "person.felix" # "person.ecki" @@ -205,6 +210,7 @@ in { "camera.Baumarkt" "camera.Autobahn_Heilbronn" "camera.Autobahn_Singen" + "camera.poorly_drawn_lines" ]; nachtlicht = [ "switch.nachtlicht_a" @@ -212,6 +218,21 @@ in { "switch.nachtlicht_c" "switch.nachtlicht_d" ]; + Aramark = [ + "binary_sensor.pommes" + "sensor.menu_1" + "sensor.menu_1_text" + "sensor.menu_1_preis" + "sensor.menu_2" + "sensor.menu_2_text" + "sensor.menu_2_preis" + "sensor.aktion" + "sensor.aktion_text" + "sensor.aktion_preis" + "sensor.mercato" + "sensor.mercato_text" + "sensor.mercato_preis" + ]; sensors = [ "media_player.kodi" "script.blitz_10s" @@ -221,6 +242,7 @@ in { "sensor.easy2_dht22_humidity" "sensor.easy2_dht22_temperature" "sensor.air_quality" + # "binary_sensor.aramark_pommes" # "binary_sensor.redbutton" ]; outside = [ diff --git a/makefu/2configs/bureautomation/lib/scripts.nix b/makefu/2configs/bureautomation/lib/scripts.nix new file mode 100644 index 000000000..d8665f94f --- /dev/null +++ b/makefu/2configs/bureautomation/lib/scripts.nix @@ -0,0 +1,18 @@ +{ lib, ... }: +{ + multi_flash = { entity, delays ? [ 500 ], alias ? "${entity}_multi_flash_${toString (lib.length delays)}" }: + { + inherit alias; + sequence = lib.flatten (builtins.map (delay: [ + { service = "homeassistant.turn_on"; + data.entity_id = entity; + } + { delay.milliseconds = delay; } + { service = "homeassistant.turn_off"; + data.entity_id = entity; + } + { delay.milliseconds = delay; } + ] + ) delays); + }; +} diff --git a/makefu/2configs/bureautomation/combination/10h_timers.nix b/makefu/2configs/bureautomation/multi/10h_timers.nix index dec5347a6..53bfd3725 100644 --- a/makefu/2configs/bureautomation/combination/10h_timers.nix +++ b/makefu/2configs/bureautomation/multi/10h_timers.nix @@ -1,7 +1,6 @@ {lib, ... }: let - persons = [ "frank" "daniel" "thorsten" "carsten" "thierry" "ecki" "felix" - "anthony" # antony + persons = [ "frank" "daniel" "thorsten" "carsten" "ecki" "felix" "thierry" # tjeri ]; random_zu_lange = name: ''{{ [ @@ -45,7 +44,7 @@ let "Im Kalender von ${name} sind heute acht Meetings eingeplant, von denen zwei bereits verpasst wurden", "Das Postfach von ${name} beinhaltet einhundertachtundzwanzig ungelesene E-Mails.", "Nachricht von Serge: ${name}, bitte melden Sie sich Umgehend bei mir im Büro!", - "Luftqualität hat sich durch das Eintreffen von ${name} um zweihunder Punkte verschlechtert, bitte alle Fenster öffnen.", + "Luftqualität hat sich durch das Eintreffen von ${name} um zweihundert Punkte verschlechtert, bitte alle Fenster öffnen.", "Die Tür geht auf, wer mag das sein? Schon schreitet hier der ${name} ein. Das Volk, es jubelt, Dirnen schmachten. Fürs Festmahl beginnt man schon zu schlachten. Er wird nur nach dem besten streben! Der ${name}, er soll lange leben!", "${name} arbeitet gern für seinen Konzern", "${name} ist nur froh im Großraumbüro", @@ -147,8 +146,8 @@ let entity_id = [ "timer.${name}_10h" ] ; } { service = "homeassistant.turn_on"; - entity_id = [ - # "script.buzz_${name}" + entity_id = [ + "switch.fernseher" "script.blitz_10s" "script.announce_${name}" ]; diff --git a/makefu/2configs/bureautomation/combination/README.md b/makefu/2configs/bureautomation/multi/README.md index baad87fda..baad87fda 100644 --- a/makefu/2configs/bureautomation/combination/README.md +++ b/makefu/2configs/bureautomation/multi/README.md diff --git a/makefu/2configs/bureautomation/multi/aramark.nix b/makefu/2configs/bureautomation/multi/aramark.nix new file mode 100644 index 000000000..ebe2cde81 --- /dev/null +++ b/makefu/2configs/bureautomation/multi/aramark.nix @@ -0,0 +1,24 @@ +{ lib, ... }: +let + aramark = topic: name: + { platform = "mqtt"; + inherit name; + state_topic = "/aramark/thales-deutschland/${topic}"; + }; + aramark_menue = menue: + [ + (aramark "${menue}/title" menue) + (aramark "${menue}/description" "${menue} Text") + ((aramark "${menue}/price" "${menue} Preis") // { unit_of_measurement = "€"; }) + ]; +in +{ + sensor = (aramark_menue "Menü 1") + ++ (aramark_menue "Menü 2") + ++ (aramark_menue "Mercato") + ++ (aramark_menue "Aktion"); + binary_sensor = + [ + ((aramark "pommes" "Pommes" ) // { payload_on = "True"; payload_off = "False"; }) + ]; +} diff --git a/makefu/2configs/bureautomation/combination/matrix.nix b/makefu/2configs/bureautomation/multi/matrix.nix index 85ba31986..85ba31986 100644 --- a/makefu/2configs/bureautomation/combination/matrix.nix +++ b/makefu/2configs/bureautomation/multi/matrix.nix diff --git a/makefu/2configs/bureautomation/combination/mittagessen.nix b/makefu/2configs/bureautomation/multi/mittagessen.nix index 3ec70998d..3ec70998d 100644 --- a/makefu/2configs/bureautomation/combination/mittagessen.nix +++ b/makefu/2configs/bureautomation/multi/mittagessen.nix diff --git a/makefu/2configs/editor/neovim/default.nix b/makefu/2configs/editor/neovim/default.nix new file mode 100644 index 000000000..c288212e9 --- /dev/null +++ b/makefu/2configs/editor/neovim/default.nix @@ -0,0 +1,67 @@ +{pkgs, config, ...}: +{ + fonts.fonts = [ pkgs.font-awesome_5 ]; + # Neovim dependencies + home-manager.users.makefu = { + home.packages = with pkgs; [ + ctags # dependencie + jq # For fixing json files + xxd # .bin files will be displayed with xxd + shellcheck # Shell linting + # ansible-lint # Ansible linting + unzip # To vim into unzipped files + # nodePackages.jsonlint # json linting + #ccls # C/C++ language server + #clang-tools # C++ fixer + cargo + + # Go support + #go + #gotools + #gocode + ]; + + home.file.".config/pycodestyle".text= '' + [pycodestyle] + max-line-length = 125 + ''; + programs.neovim = { + enable = true; + withPython3 = true; + # withNodeJs = true; + extraPython3Packages = (ps: with ps; [ python-language-server pyls-mypy black libxml2]); + configure = { + customRC = builtins.readFile ./vimrc; + packages.myVimPackage = with pkgs.vimPlugins; + { + # loaded on launch + start = [ + undotree + vim-addon-nix + + nerdtree # file manager + commentary # comment stuff out based on language + fugitive # full git integration + vim-airline-themes # lean & mean status/tabline + vim-airline # status bar + gitgutter # git diff in the gutter (sign column) + vim-trailing-whitespace # trailing whitspaces in red + tagbar # F3 function overview + ReplaceWithRegister # For better copying/replacing + polyglot # Language pack + vim-indent-guides # for displaying indent levels + deoplete-nvim # general autocompletion + deoplete-go + ale + molokai # color scheme + ]; + # manually loadable by calling `:packadd $plugin-name` + opt = []; + # To automatically load a plugin when opening a filetype, add vimrc lines like: + # autocmd FileType php :packadd phpCompletion + }; + }; + }; + }; +} + diff --git a/makefu/2configs/editor/neovim/vimrc b/makefu/2configs/editor/neovim/vimrc new file mode 100644 index 000000000..2a0a59f01 --- /dev/null +++ b/makefu/2configs/editor/neovim/vimrc @@ -0,0 +1,469 @@ +"***************************************************************************** +"" Functions +"***************************************************************************** + +function! GetBufferList() + redir =>buflist + silent! ls! + redir END + return buflist +endfunction + +function! ToggleList(bufname, pfx) + let buflist = GetBufferList() + for bufnum in map(filter(split(buflist, '\n'), 'v:val =~ "'.a:bufname.'"'), 'str2nr(matchstr(v:val, "\\d\\+"))') + if bufwinnr(bufnum) != -1 + exec(a:pfx.'close') + return + endif + endfor + if a:pfx == 'l' && len(getloclist(0)) == 0 + echohl ErrorMsg + echo "Location List is Empty." + return + endif + let winnr = winnr() + exec(a:pfx.'open') + if winnr() != winnr + wincmd p + endif +endfunction + + +"***************************************************************************** +"" Basic Setup +"*****************************************************************************" +" General +let no_buffers_menu=1 +syntax on +set ruler +set number +set mousemodel=popup +set t_Co=256 +set guioptions=egmrti +set gfn=Monospace\ 10 + +" TODO: Testing if this works against automatically setting paste mode +" Issue: https://github.com/neovim/neovim/issues/7994 +au InsertLeave * set nopaste + + +set undofile +"maximum number of changes that can be undone +set undolevels=1000000 +"maximum number lines to save for undo on a buffer reload +set undoreload=10000000 + +set backupdir=~/.vim/backup +set directory=~/.vim/tmp +set undodir =~/.vim/undo + +" create Backup/tmp/undo dirs +set backupdir=~/.vim/backup +set directory=~/.vim/tmp + +function! InitBackupDir() + let l:parent = $HOME . '/.vim/' + let l:backup = l:parent . 'backup/' + let l:tmpdir = l:parent . 'tmp/' + let l:undodir= l:parent . 'undo/' + + + if !isdirectory(l:parent) + call mkdir(l:parent) + endif + if !isdirectory(l:backup) + call mkdir(l:backup) + endif + if !isdirectory(l:tmpdir) + call mkdir(l:tmpdir) + endif + if !isdirectory(l:undodir) + call mkdir(l:undodir) + endif +endfunction +call InitBackupDir() + +augroup Binary + " edit binaries in xxd-output, xxd is part of vim + au! + au BufReadPre *.bin let &bin=1 + au BufReadPost *.bin if &bin | %!xxd + au BufReadPost *.bin set ft=xxd | endif + au BufWritePre *.bin if &bin | %!xxd -r + au BufWritePre *.bin endif + au BufWritePost *.bin if &bin | %!xxd + au BufWritePost *.bin set nomod | endif +augroup END + +" Encoding +set encoding=utf-8 +set fileencoding=utf-8 +set fileencodings=utf-8 +set bomb +set binary + +" Fix backspace indent +set backspace=indent,eol,start + +" Tabs. May be overriten by autocmd rules +set tabstop=4 +set softtabstop=0 +set shiftwidth=4 +set expandtab + +" Map leader to , +let mapleader=',' + +" Required for operations modifying multiple buffers like rename. +set hidden + +" Searching +set hlsearch +set incsearch +set ignorecase +set smartcase + +" Directories for swp files +set nobackup +set noswapfile + +set fileformats=unix,dos,mac + +" File overview +set wildmode=list:longest,list:full +set wildignore+=*.o,*.obj,.git,*.rbc,*.pyc,__pycache__ + +" Shell to emulate +if exists('$SHELL') + set shell=$SHELL +else + set shell=/bin/bash +endif + +" Set color scheme +colorscheme molokai + +"Show always Status bar +set laststatus=2 + +" Use modeline overrides +set modeline +set modelines=10 + +" Set terminal title +set title +set titleold="Terminal" +set titlestring=%F + +" search will center on the line it's found in. +nnoremap n nzzzv +nnoremap N Nzzzv + + + +"***************************************************************************** +"" Abbreviations +"***************************************************************************** +" no one is really happy until you have this shortcuts +cnoreabbrev W! w! +cnoreabbrev Q! q! +cnoreabbrev Qall! qall! +cnoreabbrev Wq wq +cnoreabbrev Wa wa +cnoreabbrev wQ wq +cnoreabbrev WQ wq +cnoreabbrev W w +cnoreabbrev Q q +cnoreabbrev Qall qall + +" NERDTree configuration +let g:NERDTreeChDirMode=2 +let g:NERDTreeIgnore=['\.rbc$', '\~$', '\.pyc$', '\.db$', '\.sqlite$', '__pycache__'] +let g:NERDTreeSortOrder=['^__\.py$', '\/$', '*', '\.swp$', '\.bak$', '\~$'] +let g:NERDTreeShowBookmarks=1 +let g:nerdtree_tabs_focus_on_files=1 +let g:NERDTreeMapOpenInTabSilent = '<RightMouse>' +let g:NERDTreeWinSize = 50 +set wildignore+=*/tmp/*,*.so,*.swp,*.zip,*.pyc,*.db,*.sqlite +nnoremap <silent> <F1> :NERDTreeFind<CR> +nnoremap <silent> <F2> :NERDTreeToggle<CR> + + +" open terminal emulation +nnoremap <silent> <leader>sh :terminal<CR>:startinsert<CR> + +"***************************************************************************** +"" Autocmd Rules +"***************************************************************************** +"" The PC is fast enough, do syntax highlight syncing from start unless 200 lines +augroup vimrc-sync-fromstart + autocmd! + autocmd BufEnter * :syntax sync maxlines=200 +augroup END + +" Nasm filetype +augroup nasm + autocmd! + autocmd BufRead,BufNewFile *.nasm set ft=nasm +augroup END + +" Binary filetype +augroup Binary + au! + au BufReadPre *.bin,*.exe,*.elf let &bin=1 + au BufReadPost *.bin,*.exe,*.elf if &bin | %!xxd + au BufReadPost *.bin,*.exe,*.elf set ft=xxd | endif + au BufWritePre *.bin,*.exe,*.elf if &bin | %!xxd -r + au BufWritePre *.bin,*.exe,*.elf endif + au BufWritePost *.bin,*.exe,*.elf if &bin | %!xxd + au BufWritePost *.bin,*.exe,*.elf set nomod | endif +augroup END + +" Binary filetype +augroup fasm + au! + au BufReadPost *.fasm set ft=fasm +augroup END + +augroup deoplete-update + autocmd! + autocmd VimEnter * UpdateRemotePlugin +augroup END + + + +"" Remember cursor position +augroup vimrc-remember-cursor-position + autocmd! + autocmd BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g`\"" | endif +augroup END + +"" txt +" augroup vimrc-wrapping +" autocmd! +" autocmd BufRead,BufNewFile *.txt call s:setupWrapping() +" augroup END + +"" make/cmake +augroup vimrc-make-cmake + autocmd! + autocmd FileType make setlocal noexpandtab + autocmd BufNewFile,BufRead CMakeLists.txt setlocal filetype=cmake +augroup END + +set autoread + +"***************************************************************************** +"" Mappings +"***************************************************************************** + +" Split +noremap <Leader>h :<C-u>split<CR> +noremap <Leader>v :<C-u>vsplit<CR> + +" Git +noremap <Leader>ga :Gwrite<CR> +noremap <Leader>gc :Gcommit<CR> +noremap <Leader>gsh :Gpush<CR> +noremap <Leader>gll :Gpull<CR> +noremap <Leader>gs :Gstatus<CR> +noremap <Leader>gb :Gblame<CR> +noremap <Leader>gd :Gvdiff<CR> +noremap <Leader>gr :Gremove<CR> + +" Tabs +nnoremap <Tab> gt +nnoremap <S-Tab> gT +nnoremap <silent> <S-t> :tabnew<CR> + +" Set working directory +nnoremap <leader>. :lcd %:p:h<CR> + +" Opens an edit command with the path of the currently edited file filled in +noremap <Leader>e :e <C-R>=expand("%:p:h") . "/" <CR> + +" Opens a tab edit command with the path of the currently edited file filled +noremap <Leader>te :tabe <C-R>=expand("%:p:h") . "/" <CR> + +" Tagbar +nmap <silent> <F3> :TagbarToggle<CR> +let g:tagbar_autofocus = 1 + +" Copy/Paste/Cut +set clipboard^=unnamed,unnamedplus + +noremap YY "+y<CR> +noremap <leader>p "+gP<CR> +noremap XX "+x<CR> + +" Enable mouse for vim +set mouse=a + +" Buffer nav +noremap <leader>z :bp<CR> +noremap <leader>q :bp<CR> +noremap <leader>x :bn<CR> +noremap <leader>w :bn<CR> + +" Close buffer +noremap <leader>c :bd<CR> + +" Clean search (highlight) +nnoremap <silent> <leader><space> :noh<cr> + +" Switching windows +noremap <C-j> <C-w>j +noremap <C-k> <C-w>k +noremap <C-l> <C-w>l +noremap <C-h> <C-w>h + +" Vmap for maintain Visual Mode after shifting > and < +vmap < <gv +vmap > >gv + +" Move visual block +vnoremap J :m '>+1<CR>gv=gv +vnoremap K :m '<-2<CR>gv=gv + +" Open current line on GitHub +nnoremap <Leader>o :.Gbrowse<CR> + + +" Save on strg+s if not in paste mode +nmap <c-s> :w<CR> +vmap <c-s> <Esc><c-s>gv +imap <c-s> <Esc><c-s> + +" Quit on strg+q in normal mode +nnoremap <c-q> :q<cr> + +" Strg+d to replace word under cursor +nnoremap <c-d> :%s/\<<C-r><C-w>\>//g<Left><Left> + +" Strg+f ro find word under cursor +nnoremap <c-f> :/<C-r><C-w><Left><Left> + +" Remove unneccessary spaces +nnoremap <silent> <F8> :let _s=@/ <Bar> :%s/\s\+$//e <Bar> :let @/=_s <Bar> :nohl <Bar> :unlet _s <CR> + +" undotree +nnoremap <F5> :UndotreeToggle<CR> + +" Reindent whole file with F6 +map <F6> mzgg=G`z + +nnoremap <F9> :set invpaste paste?<CR> +set pastetoggle=<F2> +set showmode + +" save on focus lost +au FocusLost * :wa + +" Toggle location list +nmap <silent> <F4> :call ToggleList("Quickfix List", 'c')<CR> + +" Replacing text in visual mode doesn't copy it anymore +xmap p <Plug>ReplaceWithRegisterVisual +xmap <MiddleMouse> <Plug>ReplaceWithRegisterVisual + +"" Opens an edit command with the path of the currently edited file filled in +noremap <Leader>e :e <C-R>=expand("%:p:h") . "/" <CR> + +" Use tab for navigatin in autocompletion window +inoremap <expr> <Tab> pumvisible() ? "\<C-n>" : "\<Tab>" +inoremap <expr> <S-Tab> pumvisible() ? "\<C-p>" : "\<S-Tab>" + +" ALE mappings +nmap <Leader>i <Plug>(ale_hover) +nmap <Leader>d <Plug>(ale_go_to_definition_in_tab) +nmap <Leader>rf <Plug>(ale_find_references) +nmap <silent><F7> <Plug>(ale_fix) + +"***************************************************************************** +"" Plugin settings +"***************************************************************************** + +" vim-airline +set statusline+=%{fugitive#statusline()} +let g:airline_theme = 'powerlineish' +let g:airline#extensions#syntastic#enabled = 1 +let g:airline#extensions#branch#enabled = 1 +let g:airline#extensions#tabline#enabled = 1 +let g:airline#extensions#tagbar#enabled = 1 +let g:airline_skip_empty_sections = 1 +let g:airline#extensions#ale#enabled = 1 + +" show indent lines +let g:indent_guides_enable_on_vim_startup = 1 +let g:indent_guides_auto_colors = 0 +hi IndentGuidesOdd ctermbg=235 +hi IndentGuidesEven ctermbg=235 +let g:indent_guides_guide_size = 1 +let g:indent_guides_start_level = 2 + +" Enable autocompletion +let g:deoplete#enable_at_startup = 1 +set completeopt=noinsert,menuone,noselect +let g:deoplete#sources = {} +let g:deoplete#sources._ = ['ale', 'file', 'omni', 'buffer'] + +" Ale no preview on hover +let g:ale_close_preview_on_insert = 0 +let g:ale_cursor_detail = 0 + +" Ale skip if file size over 2G +let g:ale_maximum_file_size = "2147483648" +let g:ale_set_quickfix = 1 + +" Ale language server +let g:ale_linters = { + \ 'python': ['pyls'], + \ 'cpp': ['ccls'], + \ 'c': ['gcc'], + \ 'xml': ['xmllint'], + \ 'rust': ['cargo'], + \ 'go': ['gofmt'], + \ } + +" ALE fixers +let g:ale_fixers = { '*': ['remove_trailing_lines', 'trim_whitespace'] } +let g:ale_fixers.python = ['black'] +let g:ale_fixers.go = ['gofmt'] +let g:ale_fixers.c = ['clang-format'] +let g:ale_fixers.cpp = ['clang-format'] +let g:ale_fixers.json = ['jq'] +let g:ale_fixers.xml = ['xmllint'] + +let g:ale_completion_enabled = 1 +let g:ale_sign_error = '⤫' +let g:ale_sign_warning = '⚠' +let g:ale_lint_on_insert_leave = 1 + +"***************************************************************************** +"" Shortcuts overview +"***************************************************************************** +" Shortcuts overview +" F1 --> Filetree find +" F2 --> Filetree toggle +" F3 --> Function overview +" F4 --> Toggle error bar + +" F5 --> undotree +" F6 --> Reindent whole file +" F7 --> Format and lint file +" F8 --> Remove trailing whitespaces +" F9 --> toggle paste +" ,i --> Information about function +" ,d --> Jump to definition +" ,r --> Rename in all occurences +" ,rf --> Find references of function/variable +" ,e --> Change current file +" ,te --> Open file in new tab +" u --> Undo +" strg+f --> Find current selected word +" strg+d --> Replace current selected word +" strg+s --> Save file +" strg+q --> Close current file +" space+, --> Stop highlighting words after search + diff --git a/makefu/2configs/editor/vim.nix b/makefu/2configs/editor/vim.nix index d14a611b4..52ccd0ddd 100644 --- a/makefu/2configs/editor/vim.nix +++ b/makefu/2configs/editor/vim.nix @@ -22,7 +22,7 @@ in { vimrcConfig.vam.knownPlugins = pkgs.vimPlugins // customPlugins; vimrcConfig.vam.pluginDictionaries = [ { names = [ "undotree" - # "YouCompleteMe" + "YouCompleteMe" "UltiSnips" "vim-better-whitespace" ]; } # vim-nix handles indentation better but does not perform sanity { names = [ "vim-addon-nix" ]; ft_regex = "^nix\$"; } diff --git a/makefu/2configs/editor/vimrc b/makefu/2configs/editor/vimrc index 8cdab55db..309e81a05 100644 --- a/makefu/2configs/editor/vimrc +++ b/makefu/2configs/editor/vimrc @@ -96,3 +96,17 @@ augroup Binary au BufWritePost *.bin if &bin | %!xxd au BufWritePost *.bin set nomod | endif augroup END + + +" youcompleteme +let g:ycm_collect_identifiers_from_tags_files = 1 " Let YCM read tags from Ctags file +let g:ycm_use_ultisnips_completer = 1 " Default 1, just ensure +let g:ycm_seed_identifiers_with_syntax = 1 " Completion for programming language's keyword +let g:ycm_complete_in_comments = 1 " Completion in comments +let g:ycm_complete_in_strings = 1 " Completion in string + +" utilsnips +let g:UltiSnipsExpandTrigger = "<c-j>" +let g:UltiSnipsJumpForwardTrigger = "<c-j>" +let g:UltiSnipsJumpBackwardTrigger = "<c-p>" +let g:UltiSnipsListSnippets = "<c-k>" "List possible snippets based on current file diff --git a/makefu/2configs/elchos/log.nix b/makefu/2configs/elchos/log.nix index 34bd2494d..50b40816b 100644 --- a/makefu/2configs/elchos/log.nix +++ b/makefu/2configs/elchos/log.nix @@ -1,6 +1,5 @@ { config, lib, pkgs, ... }: -with import <stockholm/lib>; let in { networking.firewall.allowedTCPPorts = [ 80 443 514 ]; diff --git a/makefu/2configs/git/cgit-retiolum.nix b/makefu/2configs/git/cgit-retiolum.nix index 0ff855980..2a6e41ad8 100644 --- a/makefu/2configs/git/cgit-retiolum.nix +++ b/makefu/2configs/git/cgit-retiolum.nix @@ -3,8 +3,9 @@ with import <stockholm/lib>; let - repos = priv-repos // krebs-repos // connector-repos // krebsroot-repos; + repos = pub-repos // priv-repos // krebs-repos // connector-repos // krebsroot-repos; rules = concatMap krebs-rules (attrValues krebs-repos) + ++ concatMap priv-rules (attrValues pub-repos) ++ concatMap priv-rules (attrValues priv-repos) ++ concatMap connector-rules (attrValues connector-repos) ++ concatMap krebsroot-rules (attrValues krebsroot-repos); @@ -13,6 +14,12 @@ let hydra-stockholm = { }; }; + pub-repos = mapAttrs make-pub-repo { + yacos-backend = { + cgit.desc = "Yet Another Check-Out System"; + }; + }; + krebs-repos = mapAttrs make-krebs-repo { stockholm = { cgit.desc = "Make all the systems into 1systems!"; @@ -59,6 +66,11 @@ let public = false; }; + make-pub-repo = name: { ... }: { + inherit name; + public = true; + }; + make-krebs-repo = with git; name: { cgit ? {}, ... }: { inherit cgit name; public = true; diff --git a/makefu/2configs/gui/base.nix b/makefu/2configs/gui/base.nix index 63ce6201a..5b46c7e2d 100644 --- a/makefu/2configs/gui/base.nix +++ b/makefu/2configs/gui/base.nix @@ -11,7 +11,6 @@ # if this is not enough, check out main-laptop.nix -with import <stockholm/lib>; let mainUser = config.krebs.build.user.name; in @@ -37,8 +36,9 @@ in displayManager.auto.user = mainUser; desktopManager.xterm.enable = false; }; + environment.systemPackages = [ pkgs.gnome3.defaultIconTheme ]; # lid switch is handled via button presses - services.logind.extraConfig = mkDefault "HandleLidSwitch=ignore"; + services.logind.lidSwitch = lib.mkDefault "ignore"; makefu.awesome.enable = true; i18n.consoleFont = "Lat2-Terminus16"; diff --git a/makefu/2configs/hw/tp-x230.nix b/makefu/2configs/hw/tp-x230.nix index ec4e05d1b..a6ded0a3e 100644 --- a/makefu/2configs/hw/tp-x230.nix +++ b/makefu/2configs/hw/tp-x230.nix @@ -23,5 +23,11 @@ with import <stockholm/lib>; hardware.pulseaudio.extraConfig = '' load-module module-alsa-sink device=hw:0,3 sink_properties=device.description="HDMIOutput" sink_name="HDMI" ''; + # load graphical equalizer module + # load-module module-equalizer-sink + + # combine multiple sinks to one: + # list all sinks: pactl list short sinks + # pacmd load-module module-combine-sink sink_name=combined sink_properties=device.description=CombinedSink slaves=sink1,sink2 channels=2 } diff --git a/makefu/2configs/hw/tp-x2x0.nix b/makefu/2configs/hw/tp-x2x0.nix index b4b2562fe..5570bec55 100644 --- a/makefu/2configs/hw/tp-x2x0.nix +++ b/makefu/2configs/hw/tp-x2x0.nix @@ -10,6 +10,8 @@ "kvm-intel" ]; + # hardware.opengl.extraPackages = [ pkgs.intel-media-driver ]; + networking.wireless.enable = lib.mkDefault true; hardware.enableAllFirmware = true; diff --git a/makefu/2configs/logging/filter/dnsmasq.conf b/makefu/2configs/logging/filter/dnsmasq.conf new file mode 100644 index 000000000..1570b1c60 --- /dev/null +++ b/makefu/2configs/logging/filter/dnsmasq.conf @@ -0,0 +1,19 @@ + +if ( [program] == "dnsmasq") { + grok { + patterns_dir => ["${./patterns}"] + match => { + "message" => [ + "^%{logdate:LOGDATE} dnsmasq\[[\d]+\]\: query\[[\w]+\] %{domain:DOMAIN} from %{clientip:CLIENTIP}" + , "^%{logdate:LOGDATE} dnsmasq\[[\d]+\]\: reply %{domain:DOMAIN} is %{ip:IP}" + , "^%{logdate:LOGDATE} dnsmasq\[[\d]+\]\: %{blocklist:BLOCKLIST} %{domain:DOMAIN} is %{ip:IP}" + ] + } + } + date { + match => [ "LOGDATE", "MMM dd HH:mm:ss", "MMM d HH:mm:ss", "ISO8601" ] + } + geoip { + source => "IP" + } +} diff --git a/makefu/2configs/logging/patterns/dnsmasq b/makefu/2configs/logging/patterns/dnsmasq new file mode 100644 index 000000000..c1e700d5e --- /dev/null +++ b/makefu/2configs/logging/patterns/dnsmasq @@ -0,0 +1,15 @@ +BLOCKLIST [\/\w\.]+ +DOMAIN [\w\.\-]+ +DNSID \d+ +PORT \d+ +DNSRESPONSE cached|reply|forwarded|query +# TODO: there are some strange responses for certain queries like <CNAME> or ... +IPORWORD %{IP}|[<>\.\/\w>]+ + +# TODO use public suffix list by mozilla +TLD [a-z]{2,63} +# matches CCSLD and TLD together (e.g. co.uk ) +CCSLD_TLD [a-z]+\.uk +# actually after a CCTLD this would be the third level domain ... +PUBLIC_SUFFIX (xn--)?%{FUNCTIONAL_SLD}\.(%{CCSLD_TLD}|%{TLD}) +FUNCTIONAL_SLD [a-z0-9-]{1,63} diff --git a/makefu/2configs/logging/server.nix b/makefu/2configs/logging/server.nix index 90f8e6680..f2fccec25 100644 --- a/makefu/2configs/logging/server.nix +++ b/makefu/2configs/logging/server.nix @@ -1,18 +1,29 @@ {pkgs, config, ...}: -with import <stockholm/lib>; let es-port = 9200; kibana-port = 5601; + primaryName = "log.${config.krebs.build.host.name}"; + serverAliases = [ "${primaryName}.r" "${primaryName}.lan" ]; in { + + services.nginx.virtualHosts.${primaryName} = { + inherit serverAliases; + locations."/" = { + proxyPass = "http://localhost:5601/"; + extraConfig = '' + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + ''; + }; + }; services.elasticsearch = { enable = true; - listenAddress = "0.0.0.0"; port = es-port; }; services.kibana = { enable = true; - listenAddress = "0.0.0.0"; port = kibana-port; }; @@ -20,4 +31,110 @@ in { iptables -A INPUT -i retiolum -p tcp --dport ${toString es-port} -j ACCEPT iptables -A INPUT -i retiolum -p tcp --dport ${toString kibana-port} -j ACCEPT ''; + + # send logs directly to elasticsearch + services.journalbeat = { + enable = true; + package = pkgs.journalbeat7; + extraConfig = '' + logging: + to_syslog: true + level: info + metrics.enabled: false + template.enabled: false + output.logstash: + hosts: [ "127.0.0.1:5044" ] + template.enabled: false + index: journalbeat + journalbeat.inputs: + - paths: [] + seek: cursor + ''; + }; + + services.logstash = { + enable = true; + # package = pkgs.logstash5; + # plugins = [ pkgs.logstash-contrib ]; + inputConfig = + '' + syslog { + timezone => "Etc/UTC" + } + beats { + port => 5044 + } + ''; + filterConfig = + '' + # Assume Beats + if [syslog] { + mutate { + add_field => { "program" => "%{[syslog][identifier]}" } + } + } + '' + + '' + if ![program] { + mutate { + add_field => { "program" => "unknown" } + } + } + '' + + '' + if ([program] == "logstash") { + drop {} + } + '' + + '' + if ( [program] == "dnsmasq") { + grok { + patterns_dir => ["${./patterns}"] + match => { + "message" => [ + "^%{DNSID:dnsid} %{IP:client}/%{PORT} %{DNSRESPONSE:dnstype}\[[\w]+\] %{DOMAIN:domain} from %{IP}" + , "^%{DNSID:dnsid} %{IP:client}/%{PORT} %{DNSRESPONSE:dnstype} %{DOMAIN:domain} is %{IPORWORD:resolved_ip}" + , "^%{DNSID:dnsid} %{IP:client}/%{PORT} %{DNSRESPONSE:dnstype} %{DOMAIN:domain} to %{IP:upstream_dns}" + ] + } + } + if [resolved_ip] { + geoip { + source => "resolved_ip" + } + } + mutate { + rename => { "host" => "syslog_host" } + } + # Target is to parse the the first and second significant part of the domain + grok { + patterns_dir => ["${./patterns}"] + match => { "domain" => [ "%{PUBLIC_SUFFIX:dns_suffix}$" ] } + } + if [client] { + mutate { copy => { "client" => "clientip" } } + dns { + reverse => [ "client"] + action => "replace" + hostsfile => [ "/etc/hosts" ] + hit_cache_ttl => 1600 + failed_cache_ttl => 60 + } + } + } + '' + '' + if ( [program] == "proftpd") { + kv { + field_split => " " + } + } + ''; + outputConfig = + '' + #stdout { + # codec => rubydebug + #} + elasticsearch { } + ''; + }; } diff --git a/makefu/2configs/nginx/euer.wiki.nix b/makefu/2configs/nginx/euer.wiki.nix index 280622259..732c27784 100644 --- a/makefu/2configs/nginx/euer.wiki.nix +++ b/makefu/2configs/nginx/euer.wiki.nix @@ -75,6 +75,7 @@ in { services.nginx = { enable = mkDefault true; + recommendedGzipSettings = true; virtualHosts = { "${ext-dom}" = { #serverAliases = [ @@ -83,14 +84,6 @@ in { #]; forceSSL = true; enableACME = true; - # recommendedGzipSettings = true; - extraConfig = '' - gzip on; - gzip_buffers 4 32k; - gzip_types text/plain application/x-javascript text/css; - default_type text/plain; - - ''; locations = { "/" = { root = wiki-dir; diff --git a/makefu/2configs/nginx/misa-felix-hochzeit.ml.nix b/makefu/2configs/nginx/misa-felix-hochzeit.ml.nix index 752612342..d54deeea2 100644 --- a/makefu/2configs/nginx/misa-felix-hochzeit.ml.nix +++ b/makefu/2configs/nginx/misa-felix-hochzeit.ml.nix @@ -2,8 +2,7 @@ { services.nginx = { enable = lib.mkDefault true; - virtualHosts."misa-felix-hochzeit.ml" = { - serverAliases = [ "misa-felix.ml" "www.misa-felix.ml" ]; + virtualHosts."misa-felix.ml" = { forceSSL = true; enableACME = true; locations = { diff --git a/makefu/2configs/share/gum.nix b/makefu/2configs/share/gum.nix index cc59ce3cc..55080b2a7 100644 --- a/makefu/2configs/share/gum.nix +++ b/makefu/2configs/share/gum.nix @@ -35,5 +35,6 @@ in { }; networking.firewall.extraCommands = '' iptables -A INPUT -i retiolum -p tcp --dport 445 -j ACCEPT + iptables -A INPUT -i wiregrill -p tcp --dport 445 -j ACCEPT ''; } diff --git a/makefu/2configs/share/temp-share-samba.nix b/makefu/2configs/share/temp-share-samba.nix index 0907c2dbf..ac0eaa978 100644 --- a/makefu/2configs/share/temp-share-samba.nix +++ b/makefu/2configs/share/temp-share-samba.nix @@ -1,4 +1,10 @@ {config, ... }:{ + services.avahi = { + enable = true; + interfaces = [ config.makefu.server.primary-itf ]; + publish.enable = true; + publish.userServices = true; + }; networking.firewall.allowedUDPPorts = [ 137 138 ]; networking.firewall.allowedTCPPorts = [ 139 445 ]; users.users.smbguest = { @@ -17,6 +23,12 @@ browseable = "yes"; "guest ok" = "yes"; }; + movies = { + path = "/home/makefu/movies"; + "read only" = "yes"; + browseable = "yes"; + "guest ok" = "yes"; + }; }; extraConfig = '' guest account = smbguest diff --git a/makefu/2configs/shiori.nix b/makefu/2configs/shiori.nix new file mode 100644 index 000000000..fd6bc9aad --- /dev/null +++ b/makefu/2configs/shiori.nix @@ -0,0 +1,29 @@ +{config, lib, pkgs, ...}: +let + web_port = 9011; + statedir = "/var/lib/shiori"; +in { + state = [ statedir ]; + systemd.services.shiori = { + description = "Shiori Server"; + after = [ "network-online.target" ]; + environment = { + SHIORI_DIR = statedir; + }; + wantedBy = [ "multi-user.target" ]; + serviceConfig = { + DynamicUser = true; + StateDirectory = "shiori"; + ExecStart = "${pkgs.shiori}/bin/shiori serve -a 127.0.0.1 -p ${toString web_port}"; + PrivateTmp = true; + }; + }; + services.nginx.virtualHosts."bookmark.euer.krebsco.de" = { + forceSSL = true; + enableACME = true; + + locations."/" = { + proxyPass = "http://127.0.0.1:${toString web_port}/"; + }; + }; +} diff --git a/makefu/2configs/sickbeard/default.nix b/makefu/2configs/sickbeard/default.nix new file mode 100644 index 000000000..629558b89 --- /dev/null +++ b/makefu/2configs/sickbeard/default.nix @@ -0,0 +1,20 @@ +{ }: +{ services.sickbeard = let + pkg = pkgs.callPackage ./sickgear.nix {}; +in { + enable = true; + package = pkg; + user = "sickbeard"; + group = "download"; + port = 8280; +}; +services.nginx.virtualHosts."sick.makefu.r" = { + locations."/".proxyPass = http://localhost:8280; + extraConfig = '' + if ( $server_addr = "${external-ip}" ) { + return 403; + } + ''; +}; +users.users.sickbeard.extraGroups = [ "nginx" ]; + } diff --git a/makefu/2configs/sickbeard/sickgear.nix b/makefu/2configs/sickbeard/sickgear.nix new file mode 100644 index 000000000..1b7a57e8b --- /dev/null +++ b/makefu/2configs/sickbeard/sickgear.nix @@ -0,0 +1,35 @@ +{ stdenv, fetchFromGitHub, python2, makeWrapper }: + +let + pythonEnv = python2.withPackages(ps: with ps; [ cheetah ]); +in stdenv.mkDerivation rec { + pname = "sickgear"; + version = "0.20.0"; + + src = fetchFromGitHub { + owner = "SickGear"; + repo = "SickGear"; + rev = "release_${version}"; + sha256 = "1zg95szvfbmwinx1z5nlbmyck7ximvyna0x71yflmadkgf88nv0k"; + }; + + dontBuild = true; + doCheck = false; + + nativeBuildInputs = [ makeWrapper ]; + buildInputs = [ pythonEnv ]; + + installPhase = '' + mkdir -p $out/bin + cp -R {autoProcessTV,gui,lib,sickbeard,sickgear.py,SickBeard.py} $out/ + + makeWrapper $out/SickBeard.py $out/bin/sickgear + ''; + + meta = with stdenv.lib; { + description = "The most reliable stable TV fork of the great Sick-Beard to fully automate TV enjoyment with innovation"; + license = licenses.gpl3; + homepage = "https://github.com/SickGear/SickGear"; + maintainers = with stdenv.lib.maintainers; [ rembo10 ]; + }; +} diff --git a/makefu/2configs/stats/arafetch.nix b/makefu/2configs/stats/arafetch.nix index 6ab9d3774..a078e3646 100644 --- a/makefu/2configs/stats/arafetch.nix +++ b/makefu/2configs/stats/arafetch.nix @@ -2,18 +2,19 @@ with import <stockholm/lib>; let pkg = with pkgs.python3Packages;buildPythonPackage rec { - rev = "775d0c2"; + rev = "cce2394"; name = "arafetch-${rev}"; propagatedBuildInputs = [ requests docopt influxdb beautifulsoup4 + paho-mqtt ]; src = pkgs.fetchgit { url = "http://cgit.euer.krebsco.de/arafetch"; inherit rev; - sha256 = "0z35avn7vmbd1661ca1zkc9i4lwcm03kpwgiqxddpkp1yxhl548p"; + sha256 = "sha256:0zdz8sqn9n8i69rqngcg7nakmvahf1i5dwajzjpylsh1x5csv2gs"; }; }; home = "/var/lib/arafetch"; @@ -24,13 +25,25 @@ in { createHome = true; }; + systemd.services.ara2mqtt = { + startAt = "05:00:00"; + after = [ "network-online.target" ]; + path = [ pkg ]; + serviceConfig = { + User = "arafetch"; + # Restart = "always"; + WorkingDirectory = home; + PrivateTmp = true; + ExecStart = pkgs.writeDash "daily-mqtt" '' + ara2mqtt db/thales-deutschland.json --cantine thales-deutschland --host localhost + ''; + }; + }; systemd.services.arafetch = { startAt = "Mon,Wed,Fri 09:15:00"; wantedBy = [ "multi-user.target" ]; after = [ "network-online.target" ]; - environment = { - OUTDIR = home; - }; + environment.OUTDIR = home; path = [ pkg pkgs.git pkgs.wget ]; serviceConfig = { User = "arafetch"; @@ -38,7 +51,6 @@ in { WorkingDirectory = home; PrivateTmp = true; ExecStart = pkgs.writeDash "start-weekrun" '' - set -x weekrun || echo "weekrun failed!" find $OUTDIR/db -name \*.json | while read path;do file=''${path##*/} diff --git a/makefu/2configs/stats/telegraf/default.nix b/makefu/2configs/stats/telegraf/default.nix index 049a9c037..c60539c71 100644 --- a/makefu/2configs/stats/telegraf/default.nix +++ b/makefu/2configs/stats/telegraf/default.nix @@ -1,16 +1,24 @@ {...}: let url = "http://localhost:8086"; + mqtt_server = "localhost:1883"; in { services.telegraf = { enable = true; extraConfig = { - agent.debug = true; + agent.debug = false; outputs = { influxdb = [{ urls = [ url ]; database = "telegraf"; }]; + mqtt = [{ + servers = [ mqtt_server ]; + topic_prefix = "/telegraf"; + data_format = "json"; + qos = 0; + batch = false; + }]; }; }; }; diff --git a/makefu/2configs/tools/dev.nix b/makefu/2configs/tools/dev.nix index 23da9d577..43892ed2c 100644 --- a/makefu/2configs/tools/dev.nix +++ b/makefu/2configs/tools/dev.nix @@ -6,31 +6,37 @@ ps.python-language-server # the following plugins are optional, they provide type checking, import sorting and code formatting ps.pyls-mypy ps.pyls-isort ps.pyls-black - ps.virtualenv + ps.virtualenv ps.pyserial ps.virtualenv ])) - picocom - python3.pkgs.pyserial - python3.pkgs.virtualenv # embedded + picocom gi flashrom mosquitto - libcoap nodemcu-uploader esptool - cac-api - cac-panel - krebszones - ovh-zone - whatsupnix - brain - gen-oath-safe - cdrtools # nix related nix-index nix-review + brain + whatsupnix + nixpkgs-pytools # git-related + git-preview tig (pkgs.callPackage ./init-host {}) + # used more than once + imagemagick + qrencode + exiftool + cac-api + cac-panel + krebszones + ovh-zone + gen-oath-safe + cdrtools + # network related + sshuttle + pciutils ]; } diff --git a/makefu/2configs/torrent.nix b/makefu/2configs/torrent.nix index ca368dbf0..74f1e5fe8 100644 --- a/makefu/2configs/torrent.nix +++ b/makefu/2configs/torrent.nix @@ -35,7 +35,9 @@ in { rtorrent.members = [ "download" ]; }; - krebs.rtorrent = { + krebs.rtorrent = let + d = config.makefu.dl-dir; + in { enable = true; web = { enable = true; @@ -45,7 +47,17 @@ in { rutorrent.enable = true; enableXMLRPC = true; listenPort = peer-port; - downloadDir = config.makefu.dl-dir; + downloadDir = d + "/finished/incoming"; + watchDir = d + "/watch"; + # TODO: maybe test out multiple watch dirs with tags: https://github.com/rakshasa/rtorrent/wiki/TORRENT-Watch-directories + extraConfig = '' + # log.add_output = "debug", "rtorrent-systemd" + # log.add_output = "dht_debug", "rtorrent-systemd" + # log.add_output = "tracker_debug", "rtorrent-systemd" + log.add_output = "rpc_events", "rtorrent-systemd" + # log.add_output = "rpc_dump", "rtorrent-systemd" + system.daemon.set = true + ''; # dump old torrents into watch folder to have them re-added }; diff --git a/makefu/2configs/virtualisation/docker.nix b/makefu/2configs/virtualisation/docker.nix index 951bdbf26..b830bc39e 100644 --- a/makefu/2configs/virtualisation/docker.nix +++ b/makefu/2configs/virtualisation/docker.nix @@ -5,5 +5,5 @@ docker docker_compose ]; - users.extraUsers.${config.krebs.build.user.name}.extraGroups = [ "docker" ]; + users.users.${config.krebs.build.user.name}.extraGroups = [ "docker" ]; } diff --git a/makefu/2configs/wireguard/server.nix b/makefu/2configs/wireguard/server.nix index e38fa05cb..ae10f34a2 100644 --- a/makefu/2configs/wireguard/server.nix +++ b/makefu/2configs/wireguard/server.nix @@ -47,6 +47,11 @@ in { # wireguard server allowedIPs = [ "10.244.0.6/32" ]; publicKey = "OFhCF56BrV9tjqW1sxqXEKH/GdqamUT1SqZYSADl5GA="; } + { + # mobile + allowedIPs = [ "10.244.0.7/32" ]; + publicKey = "Y6fOW2QDt0SsHT7hSVzzJYQVB3JI/txO4/FDB54Z52A="; + } ]; }; } |