1
0
mirror of https://github.com/kmein/niveum synced 2026-03-16 10:11:08 +01:00

Setup catullus

This commit is contained in:
Kierán Meinhardt
2019-01-30 13:56:34 +01:00
parent 498215fb07
commit 943d707626
8 changed files with 237 additions and 206 deletions

View File

@@ -1,146 +1,5 @@
{ pkgs, config, ... }:
with import ../helpers.nix;
let vim_conf = ''
" if tabular
vmap a= :Tabularize /=<CR>
vmap a; :Tabularize /::<CR>
vmap a- :Tabularize /-><CR>
colorscheme delek
filetype plugin indent on
set title
set nocompatible
set smartcase
set shiftwidth=2 tabstop=2 expandtab
set number
set path=$PWD/**
set completeopt=menu,longest
set wildmode=list:full wildignore+=${commaSep config.constants.ignore}
set shortmess+=aI
set nowritebackup noswapfile
set mouse=a
set showmatch
set encoding=utf8 ffs=unix,dos,mac
set smartindent
set nowrap
set nohlsearch
set clipboard=unnamedplus
set nopaste
set list listchars=tab:\ ,extends:,precedes:,nbsp:,trail:· 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 colorcolumn ctermbg=red
" 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 | vmap <C-j> xp`[V`]
nmap <C-k> ddkP | vmap <C-k> xkP`[V`]
nnoremap <silent> <Space> @=(foldlevel('.')?'za':"\<Space>")<CR>
vnoremap <Space> zf
command! RandomLine execute 'normal! '.(system('/bin/sh -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 bufnewfile,bufread *.4th set filetype=forth
autocmd bufnewfile,bufread *.asm set filetype=nasm
autocmd bufnewfile,bufread *.c set keywordprg=man\ 3
autocmd bufnewfile,bufread *.conf set filetype=conf
autocmd bufnewfile,bufread *.fs :packadd vim-fsharp | set filetype=fsharp
autocmd bufnewfile,bufread *.h set keywordprg=man\ 3
autocmd bufnewfile,bufread *.md set filetype=markdown.pandoc | set nospell
autocmd bufnewfile,bufread *.nix :packadd vim-nix | set filetype=nix
autocmd bufnewfile,bufread *.rust :packadd rust-vim deoplete-rust
autocmd bufnewfile,bufread *.tex :packadd vimtex | set filetype=tex
autocmd bufnewfile,bufread *.ts :packadd vim-typescript
autocmd bufnewfile,bufread *.journal :packadd vim-ledger | set filetype=ledger shiftwidth=4
autocmd bufnewfile,bufread config set filetype=conf
autocmd bufnewfile,bufread *.elm :packadd elm-vim | set filetype=elm shiftwidth=4
autocmd filetype haskell set formatprg=hindent
autocmd filetype python set formatprg=black
autocmd filetype javascript *.js :packadd vim-javascript
autocmd filetype make setlocal noexpandtab
autocmd filetype markdown,text set formatoptions+=t
autocmd filetype markdown,text set formatprg=par\ -w80
autocmd filetype markdown,text set textwidth=80
autocmd bufreadpost *
\ if line("'\"") > 0 && line("'\"") <= line("$") |
\ exe "normal! g`\"" |
\ endif
autocmd bufreadpre * setlocal foldmethod=indent
autocmd bufwritepre * :call <SID>StripTrailingWhitespaces()
autocmd bufwinenter * if &fdm == 'indent' | setlocal foldmethod=manual | endif
endif
if exists("g:loaded_startify")
let g:startify_custom_header = \'\'
endif
"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(".")}/%{line("$")} %{col(".")}'
"endif
"if exists("g:loaded_airline_themes")
let g:airline_theme='base16'
"endif
'';
let vimConfig = import ../dot/vim.nix { inherit config pkgs; };
in {
environment.variables.EDITOR = pkgs.lib.mkForce "nvim";
environment.shellAliases.vi = "nvim";
@@ -158,25 +17,9 @@ in {
nixpkgs.config.packageOverrides = pkgs: {
nvim = pkgs.neovim.override {
configure = {
customRC = vim_conf;
customRC = vimConfig.vimrc;
packages.nvim = with pkgs.vimPlugins; {
start = [
ctrlp
deoplete-nvim
supertab
syntastic
tabular
vim-airline vim-airline-themes
vim-commentary
vim-eunuch
vim-fugitive
vim-gitgutter
vim-pandoc vim-pandoc-after vim-pandoc-syntax
vim-repeat
vim-sensible
vim-startify
vim-surround
];
start = vimConfig.startPackages;
opt = [
elm-vim
deoplete-rust

30
configs/htop.nix Normal file
View File

@@ -0,0 +1,30 @@
{ configs, pkgs, ... }:
{
environment.etc.htoprc.text = ''
fields=0 48 17 18 38 39 40 2 46 47 49 1
sort_key=46
sort_direction=1
hide_threads=0
hide_kernel_threads=1
hide_userland_threads=0
shadow_other_users=1
show_thread_names=1
show_program_path=1
highlight_base_name=1
highlight_megabytes=1
highlight_threads=1
tree_view=1
header_margin=1
detailed_cpu_time=0
cpu_count_from_zero=0
update_process_names=0
account_guest_in_cpu_meter=1
color_scheme=0
delay=15
left_meters=LeftCPUs2 RightCPUs2 Memory Swap
left_meter_modes=1 1 1 1
right_meters=Uptime Tasks LoadAverage Battery
right_meter_modes=2 2 2 2
'';
environment.systemPackages = [ pkgs.htop ];
}

View File

@@ -40,10 +40,6 @@ in {
programs.ssh = {
enable = true;
matchBlocks = {
lestrade = {
hostname = "lestrade.local";
user = "pi";
};
scardanelli = {
hostname = "scardanelli.local";
user = "kfm";

15
configs/users.nix Normal file
View File

@@ -0,0 +1,15 @@
{ config, pkgs, ... }:
{
users.mutableUsers = false;
users.users.kfm = {
name = "kfm";
description = config.constants.user.name;
home = "/home/kfm";
createHome = true;
group = "users";
extraGroups = [ "wheel" "audio" "docker" ];
hashedPassword = "$6$w9hXyGFl/.IZBXk$5OiWzS1G.5hImhh1YQmZiCXYNAJhi3X6Y3uSLupJNYYXPLMsQpx2fwF4Xr2uYzGMV8Foqh8TgUavx1APD9rcb/";
shell = pkgs.zsh;
};
}

View File

@@ -1,26 +0,0 @@
''
fields=0 48 17 18 38 39 40 2 46 47 49 1
sort_key=46
sort_direction=1
hide_threads=0
hide_kernel_threads=1
hide_userland_threads=0
shadow_other_users=1
show_thread_names=1
show_program_path=1
highlight_base_name=1
highlight_megabytes=1
highlight_threads=1
tree_view=1
header_margin=1
detailed_cpu_time=0
cpu_count_from_zero=0
update_process_names=0
account_guest_in_cpu_meter=1
color_scheme=0
delay=15
left_meters=LeftCPUs2 RightCPUs2 Memory Swap
left_meter_modes=1 1 1 1
right_meters=Uptime Tasks LoadAverage Battery
right_meter_modes=2 2 2 2
''

162
dot/vim.nix Normal file
View File

@@ -0,0 +1,162 @@
{ config, pkgs, ... }:
with import ../helpers.nix;
{
startPackages = with pkgs.vimPlugins; [
ctrlp
deoplete-nvim
supertab
syntastic
tabular
vim-airline vim-airline-themes
vim-commentary
vim-eunuch
vim-fugitive
vim-gitgutter
vim-pandoc vim-pandoc-after vim-pandoc-syntax
vim-repeat
vim-sensible
vim-startify
vim-surround
];
vimrc = ''
" if tabular
vmap a= :Tabularize /=<CR>
vmap a; :Tabularize /::<CR>
vmap a- :Tabularize /-><CR>
colorscheme delek
filetype plugin indent on
set title
set nocompatible
set smartcase
set shiftwidth=2 tabstop=2 expandtab
set number
set path=$PWD/**
set completeopt=menu,longest
set wildmode=list:full wildignore+=${commaSep config.constants.ignore}
set shortmess+=aI
set nowritebackup noswapfile
set mouse=a
set showmatch
set encoding=utf8 ffs=unix,dos,mac
set smartindent
set nowrap
set nohlsearch
set clipboard=unnamedplus
set nopaste
set list listchars=tab:\ ,extends:,precedes:,nbsp:,trail:· 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 colorcolumn ctermbg=red
" 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 | vmap <C-j> xp`[V`]
nmap <C-k> ddkP | vmap <C-k> xkP`[V`]
nnoremap <silent> <Space> @=(foldlevel('.')?'za':"\<Space>")<CR>
vnoremap <Space> zf
command! RandomLine execute 'normal! '.(system('/bin/sh -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 bufnewfile,bufread *.4th set filetype=forth
autocmd bufnewfile,bufread *.asm set filetype=nasm
autocmd bufnewfile,bufread *.c set keywordprg=man\ 3
autocmd bufnewfile,bufread *.conf set filetype=conf
autocmd bufnewfile,bufread *.fs :packadd vim-fsharp | set filetype=fsharp
autocmd bufnewfile,bufread *.h set keywordprg=man\ 3
autocmd bufnewfile,bufread *.md set filetype=markdown.pandoc | set nospell
autocmd bufnewfile,bufread *.nix :packadd vim-nix | set filetype=nix
autocmd bufnewfile,bufread *.rust :packadd rust-vim deoplete-rust
autocmd bufnewfile,bufread *.tex :packadd vimtex | set filetype=tex
autocmd bufnewfile,bufread *.ts :packadd vim-typescript
autocmd bufnewfile,bufread *.journal :packadd vim-ledger | set filetype=ledger shiftwidth=4
autocmd bufnewfile,bufread config set filetype=conf
autocmd bufnewfile,bufread *.elm :packadd elm-vim | set filetype=elm shiftwidth=4
autocmd filetype haskell set formatprg=hindent
autocmd filetype python set formatprg=black
autocmd filetype javascript *.js :packadd vim-javascript
autocmd filetype make setlocal noexpandtab
autocmd filetype markdown,text set formatoptions+=t
autocmd filetype markdown,text set formatprg=par\ -w80
autocmd filetype markdown,text set textwidth=80
autocmd bufreadpost *
\ if line("'\"") > 0 && line("'\"") <= line("$") |
\ exe "normal! g`\"" |
\ endif
autocmd bufreadpre * setlocal foldmethod=indent
autocmd bufwritepre * :call <SID>StripTrailingWhitespaces()
autocmd bufwinenter * if &fdm == 'indent' | setlocal foldmethod=manual | endif
endif
if exists("g:loaded_startify")
let g:startify_custom_header = \'\'
endif
"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(".")}/%{line("$")} %{col(".")}'
"endif
"if exists("g:loaded_airline_themes")
let g:airline_theme='base16'
"endif
'';
}

View File

@@ -6,6 +6,7 @@ in {
"${builtins.fetchTarball https://github.com/rycee/home-manager/archive/master.tar.gz}/nixos"
./options.nix
configs/hu-berlin.nix
configs/users.nix
configs/shells.nix
configs/editors.nix
configs/graphics.nix
@@ -43,19 +44,6 @@ in {
'';
};
users.mutableUsers = false;
users.users.kfm = {
name = "kfm";
description = config.constants.user.name;
home = "/home/kfm";
createHome = true;
group = "users";
extraGroups = [ "wheel" "audio" "docker" ];
hashedPassword = "$6$w9hXyGFl/.IZBXk$5OiWzS1G.5hImhh1YQmZiCXYNAJhi3X6Y3uSLupJNYYXPLMsQpx2fwF4Xr2uYzGMV8Foqh8TgUavx1APD9rcb/";
shell = pkgs.zsh;
};
systemd.services.google-drive = {
description = "Google Drive synchronisation service";
wants = [ "network-online.target" ];
@@ -99,7 +87,6 @@ in {
".config/mpv/input.conf".text = import dot/mpv.nix;
".config/Typora/themes/base.user.css".text = import dot/typora.nix;
".ghc/ghci.conf".text = import dot/ghci.nix { inherit pkgs; };
".config/htop/htoprc".text = import dot/htop.nix;
".stack/config.yaml".text = import dot/stack.nix { user = config.constants.user; };
".zshrc".text = "# nothing to see here";
};

View File

@@ -1,9 +1,33 @@
{ config, pkgs, ... }:
{
imports = [];
let vimConfig = import ../../dot/vim.nix { inherit config pkgs; };
in {
imports = [
../configs/users.nix
../configs/htop.nix
../configs/shells.nix
];
boot.loader.grub.enable = false;
boot.loader.generic-extlinux-compatible.enable = true;
networking.hostName = "catullus";
network.wireless = {
enable = true;
networks.Aether = { pskRaw = "e1b18af54036c5c9a747fe681c6a694636d60a5f8450f7dec0d76bc93e2ec85a"; };
};
services.openssh.enable = true;
programs.tmux.enable = true;
environment.systemPackages = with pkgs; [
git
(vim_configurable.customize {
name = "kvim";
vimrcConfig = {
customRC = vimConfig.vimrc;
packages.kvim.start = vimConfig.startPackages;
};
})
];
}