Restructure to use flakes

This commit is contained in:
Valentin Brandl 2022-02-15 15:44:40 +01:00
parent f74a79d12f
commit 8abcbd0cc7
33 changed files with 1441 additions and 0 deletions

46
flake.nix Normal file
View File

@ -0,0 +1,46 @@
{
inputs = {
home-manager = {
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
nixpkgs = {
url = "github:nixos/nixpkgs/nixos-unstable";
};
flake-utils = {
url = "github:numtide/flake-utils";
};
};
outputs = inputs: {
nixosConfigurations = {
w1n5t0n = import ./machines/w1n5t0n.nix inputs;
};
homeConfigurations = {
me = inputs.home-manager.lib.homeManagerConfiguration {
system = "x86_64-linux";
username = "me";
homeDirectory = "/home/me";
extraSpecialArgs = {
inherit inputs;
system = "x86_64-linux";
hostname = "w1n5t0n";
};
configuration.imports = [ ./users/me.nix ];
};
};
}
//
inputs.flake-utils.lib.eachDefaultSystem (system:
let pkgs = import inputs.nixpkgs {
inherit system;
};
in
{
devShell = pkgs.mkShell {
packages = with pkgs; [
inputs.home-manager.defaultPackage.${system};
];
}
}
);
}

3
home/bat.nix Normal file
View File

@ -0,0 +1,3 @@
{ ... }: {
programs.bat.enable = true;
}

33
home/default.nix Normal file
View File

@ -0,0 +1,33 @@
user:
{ ... }: {
imports = [
./bat.nix
./direnv.nix
./dunst.nix
./feh.nix
./firefox.nix
./flameshot.nix
./fzf.nix
./gnome-keyring.nix
(import ./git.nix user)
./go.nix
./htop.nix
./i3.nix
./lsd.nix
./man.nix
./neovim.nix
./nextcloud.nix
./pasystray.nix
./picom.nix
./polybar.nix
./programs.nix
./qt.nix
./redshift.nix
./rofi.nix
./rust.nix
./tmux.nix
./xdg.nix
./zathura.nix
./zsh.nix
];
}

14
home/direnv.nix Normal file
View File

@ -0,0 +1,14 @@
{ ... }: {
programs.direnv = {
enable = true;
enableZshIntegration = true;
nix-direnv = {
enable = true;
};
};
xdg.configFile."direnv/config.toml".text = ''
[global]
warn_timeout = "1000s"
'';
}

58
home/dunst.nix Normal file
View File

@ -0,0 +1,58 @@
{ pkgs, ... }: {
services.dunst = {
enable = true;
settings = {
global = {
font = "Monospace 8";
allow_markup = true;
format = "<b>%a:</b> %s\n%b";
sort = true;
indicate_hidden = true;
alignment = "left";
bounce_freq = 0;
show_age_threshold = 60;
word_wrap = true;
ignore_newline = false;
geometry = "300x5-30+20";
transparency = 0;
idle_threshold = 120;
monitor = 0;
follow = "keyboard";
sticky_history = true;
line_height = 0;
separator_height = 2;
padding = 8;
horizontal_padding = 8;
separator_color = "frame";
startup_notification = true;
dmenu = "dmenu -p dunst:";
browser = "firefox -new-tab";
};
frame = {
width = 0;
color = "#000000";
};
shortcuts = {
close = "mod4+m";
close_all = "mod4+shift+m";
history = "mod4+n";
context = "mod4+shift+i";
};
urgency_low = {
background = "#222222";
foreground = "#888888";
timeout = 10;
};
urgency_normal = {
background = "#285577";
foreground = "#ffffff";
timeout = 10;
};
urgency_critical = {
background = "#900000";
foreground = "#ffffff";
timeout = 0;
};
};
};
}

3
home/feh.nix Normal file
View File

@ -0,0 +1,3 @@
{ ... }: {
programs.feh.enable = true;
}

5
home/firefox.nix Normal file
View File

@ -0,0 +1,5 @@
{ pkgs, ... }: {
programs.firefox = {
enable = true;
};
}

3
home/flameshot.nix Normal file
View File

@ -0,0 +1,3 @@
{ ... }: {
services.flameshot.enable = true;
}

8
home/fzf.nix Normal file
View File

@ -0,0 +1,8 @@
{ ... }: {
programs.fzf = {
enable = true;
enableZshIntegration = true;
fileWidgetCommand = "fd --type f --no-ignore";
historyWidgedOptions = [ "--reverse" "--sort" "--exact" ];
};
}

25
home/git.nix Normal file
View File

@ -0,0 +1,25 @@
user:
{ ... }: {
programs.git = {
enable = true;
userName = user.git.name;
userEmail = user.git.email;
delta = {
enable = true;
options = {
theme = "base16";
};
};
extraConfig = {
diff = {
compactionHeuristic = true;
};
pull = {
rebase = true;
};
push = {
default = "simple";
};
};
};
}

10
home/gnome-keyring.nix Normal file
View File

@ -0,0 +1,10 @@
{ ... }: {
services.gnome-keyring = {
enable = true;
components = [
"pkcs11"
"secrets"
# "ssh"
];
};
}

3
home/go.nix Normal file
View File

@ -0,0 +1,3 @@
{ ... }: {
programs.go.enable = true;
}

13
home/htop.nix Normal file
View File

@ -0,0 +1,13 @@
{ ... }: {
programs.htop = {
enable = true;
settings = {
hide_kernel_threads = true;
hide_threads = true;
hide_userland_threads = true;
show_program_path = false;
tree_view = true;
vim_mode = true;
};
};
}

157
home/i3.nix Normal file
View File

@ -0,0 +1,157 @@
{ lib, pkgs, ... }:
let
mod = "Mod4";
ws1 = "1: ";
ws2 = "2: ";
ws3 = "3: ";
ws4 = "4: ";
ws5 = "5: ";
ws6 = "6: ";
ws7 = "7: ";
ws8 = "8";
ws9 = "9";
ws10 = "10: ";
mode_system = "System: L : | S : | P : | R : | E : ";
in {
xsession.windowManager.i3 = {
enable = true;
# package = pkgs.i3-gaps;
config = {
modifier = mod;
workspaceAutoBackAndForth = true;
fonts = {
names = [ "NotoSans-Regular" "FontAwesome" ];
style = "Monospace";
size = 12.0;
};
# disable titlebar
focus.newWindow = "none";
assigns = {
"${ws1}" = [
{ class = "^Firefox$"; }
{ class = "firefox"; }
{ class = "Firefox"; }
];
"${ws4}" = [{ class="Pidgin"; }];
"${ws5}" = [{ class="Thunar"; }];
"${ws6}" = [{ class="libreoffice-startcenter"; }];
"${ws7}" = [{ class="Thunderbird"; }];
};
floating = {
criteria = [
{ window_role = "pop-up"; }
{ window_role = "task_dialog"; }
{ title = "Preferences$"; }
{ class = "Keepassx2"; }
{ class = "keepassxc"; }
{ class = "KeePassXC"; }
{ class = "^Pavucontrol$"; }
{ class = "^Pinentry-gtk-2$"; }
];
};
keybindings = lib.mkOptionDefault {
"${mod}+Return" = "exec termite";
"${mod}+Shift+q" = "kill";
"${mod}+h" = "focus left";
"${mod}+j" = "focus down";
"${mod}+k" = "focus up";
"${mod}+l" = "focus right";
"${mod}+Left" = "focus left";
"${mod}+Down" = "focus down";
"${mod}+Up" = "focus up";
"${mod}+Right" = "focus right";
"${mod}+Shift+h" = "move left";
"${mod}+Shift+j" = "move down";
"${mod}+Shift+k" = "move up";
"${mod}+Shift+l" = "move right";
"${mod}+Shift+Left" = "move left";
"${mod}+Shift+Down" = "move down";
"${mod}+Shift+Up" = "move up";
"${mod}+Shift+Right" = "move right";
"${mod}+b" = "split h";
"${mod}+v" = "split v";
"${mod}+f" = "fullscreen toggle";
"${mod}+s" = "layout stacking";
"${mod}+w" = "layout tabbed";
"${mod}+e" = "layout toggle split";
"${mod}+Shift+space" = "floating toggle";
"${mod}+space" = "focus mode_toggle";
"${mod}+a" = "focus parent";
"${mod}+d" = "exec rofi -show drun -matching fuzzy";
"${mod}+Tab" = "exec rofi -show window -matching fuzzy";
"${mod}+1" = "workspace ${ws1}";
"${mod}+2" = "workspace ${ws2}";
"${mod}+3" = "workspace ${ws3}";
"${mod}+4" = "workspace ${ws4}";
"${mod}+5" = "workspace ${ws5}";
"${mod}+6" = "workspace ${ws6}";
"${mod}+7" = "workspace ${ws7}";
"${mod}+8" = "workspace ${ws8}";
"${mod}+9" = "workspace ${ws9}";
"${mod}+0" = "workspace ${ws10}";
"${mod}+Shift+1" = "move container to workspace ${ws1}";
"${mod}+Shift+2" = "move container to workspace ${ws2}";
"${mod}+Shift+3" = "move container to workspace ${ws3}";
"${mod}+Shift+4" = "move container to workspace ${ws4}";
"${mod}+Shift+5" = "move container to workspace ${ws5}";
"${mod}+Shift+6" = "move container to workspace ${ws6}";
"${mod}+Shift+7" = "move container to workspace ${ws7}";
"${mod}+Shift+8" = "move container to workspace ${ws8}";
"${mod}+Shift+9" = "move container to workspace ${ws9}";
"${mod}+Shift+0" = "move container to workspace ${ws10}";
"${mod}+Shift+c" = "reload";
"${mod}+Shift+r" = "restart";
"${mod}+Shift+e" = "exec \"i3-nagbar -t warning -m 'You pressed the exit shortcut. Do you really want to exit i3? This will end your X session.' -b 'Yes, exit i3' 'i3-msg exit'\"";
"${mod}+r" = "mode \"resize\"";
"${mod}+x" = "mode \"${mode_system}\"";
"${mod}+Shift+x" = "exec i3lock-fancy -n";
};
modes = {
resize = {
h = "resize shrink width 10 px or 10 ppt";
j = "resize grow height 10 px or 10 ppt";
k = "resize shrink height 10 px or 10 ppt";
l = "resize grow width 10 px or 10 ppt";
Left = "resize shrink width 10 px or 10 ppt";
Down = "resize grow height 10 px or 10 ppt";
Up = "resize shrink height 10 px or 10 ppt";
Right = "resize grow width 10 px or 10 ppt";
Return = "mode \"default\"";
Escape = "mode \"default\"";
};
"${mode_system}" = {
l = "exec ~/bin/lock.sh, mode \"default\"";
s = "exec $Lock systemctl suspend, mode \"default\"";
p = "exec systemctl poweroff -i, mode \"default\"";
r = "exec systemctl reboot, mode \"default\"";
e = "exec i3-msg exit, mode \"default\"";
# back to normal: Enter or Escape or mod+x again
Return = "mode \"default\"";
Escape = "mode \"default\"";
"${mod}+x" = "mode \"default\"";
};
};
window = {
hideEdgeBorders = "both";
titlebar = false;
};
};
};
}

6
home/lsd.nix Normal file
View File

@ -0,0 +1,6 @@
{ ... }: {
programs.lsd = {
enable = true;
enableAliases = true;
};
}

6
home/man.nix Normal file
View File

@ -0,0 +1,6 @@
{ ... }: {
programs.man = {
enable = true;
generateCaches = true;
};
}

452
home/neovim.nix Normal file
View File

@ -0,0 +1,452 @@
{ pkgs, ... }:
let
config = {
plugins = with pkgs.vimPlugins; [
vim-colors-solarized
coc-nvim
coc-rust-analyzer
coc-pyright
coc-go
ctrlp-vim
editorconfig-vim
vim-gist
goyo-vim
# gopls
neomake
rust-vim
solarized
vim-commentary
vim-dispatch
vim-fugitive
vim-gitgutter
vim-lastplace
vim-nix
vim-polyglot
vim-repeat
# vim-scala
vim-sleuth
vim-surround
vim-trailing-whitespace
# vimtex
vimux
vimwiki
];
enable = true;
extraConfig = ''
set background=dark
" allow switching away from unsaved buffers
set hidden
set history=1000
set updatetime=300
set expandtab
set shiftwidth=2
set tabstop=2
set ignorecase
set smartcase
set number
set relativenumber
set backupdir=$HOME/.vim/backupfiles//
set directory=$HOME/.vim/swapfiles//
set undodir=$HOME/.vim/undofiles//
set undofile
set nocompatible
filetype plugin indent on
" always set autoindenting on
set autoindent
" smart indent; stop indent when closing brackets etc
set smartindent
" two spaces after .?! when joining lines
set joinspaces
" highlight search result
set hlsearch
" incremental search
set incsearch
set nolazyredraw
" delete whitespace, line break and char using <BS>
set backspace=indent,eol,start
" always show curser position
set ruler
" yank into system clipboard
set clipboard=unnamedplus
colorscheme solarized
" true color
set termguicolors
" make true colors work in tmux
let &t_8f = "\<Esc>[38;2;%lu;%lu;%lum"
let &t_8b = "\<Esc>[48;2;%lu;%lu;%lum"
set textwidth=80
set colorcolumn=+1
set signcolumn=yes
" highlight current line
set cursorline
" encoding
set fileencoding=utf-8
" break at last word instead of last char
set linebreak
" autoload file changes
set autoread
set smarttab
set softtabstop=2
set shiftround
" invisible characters
set list
" set listchars=tab:â\ ,eol:¬,trail:â,extends:â¯,precedes:â®
" set showbreak=âª
" code folding settings
" fold based on syntax
set foldmethod=indent
" don't fold by default
set nofoldenable
set foldlevel=1
" smoother redrawing
set ttyfast
" diff with vertical split
set diffopt+=vertical
" show the status line all the time
set laststatus=2
" keep 5 lines on the screen when scrolling
set scrolloff=5
" enhanced command line completion
set wildmenu
" Search down into subfolders
" Provides tab-completion for all file-related tasks
set path+=**
" show incomplete commands
set showcmd
" complete files like a shell
set wildmode=list:longest
" command bar height
set cmdheight=1
" set terminal title
set title
" set shortmess+=TOFwatc
set shortmess+=c
" show matching braces
set showmatch
" how many tenths of a second to blink
set mat=2
" set spell langs
set spelllang=de,en
syntax enable
" let g:polyglot_disabled=['latex']
" highlight clear SpellBad
" highlight SpellBad cterm=undercurl
" " Only do this part when compiled with support for autocommands.
" if has("autocmd")
" " Put these in an autocmd group, so that we can delete them easily.
" augroup vimrcEx
" au!
" autocmd FileType text setlocal foldtext<
" augroup END
" endif " has("autocmd")
" error bells
set errorbells
set visualbell
set timeoutlen=500
" turn on manpages (:Man)
runtime ftplugin/man.vim
" set a map leader for more key combos
let mapleader=','
" clear highlighted search
noremap <space> :nohlsearch<cr>
" enable . command in visual mode
vnoremap . :normal .<cr>
" make the highlighting of tabs and other non-text less annoying
highlight SpecialKey ctermbg=none ctermfg=8
highlight NonText ctermbg=none ctermfg=8
" other color for popup
highlight Pmenu ctermbg=gray guibg=gray
" ctrlp
" order top to bottom
let g:ctrlp_match_window='bottom,order::ttb'
" open files in new buffer
let g:ctrlp_switch_buffer=0
" use ripgrep if available
if executable('rg')
set grepprg=rg\ --color=never
let g:ctrlp_user_command='rg %s --files -i --color=never --glob ""'
let g:ctrlp_use_caching=0
endif
" set textwidth for mails
autocmd FileType mail setlocal textwidth=72
" count wraped lines as one line when doing relative jumps
noremap <silent> <expr> j (v:count == 0 ? 'gj' : 'j')
noremap <silent> <expr> k (v:count == 0 ? 'gk' : 'k')
" scroll the viewport faster
nnoremap <C-e> 3<C-e>
nnoremap <C-y> 3<C-y>
"" Section AutoGroups {{{
"" file type specific settings
augroup configgroup
autocmd!
" automatically resize panes on resize
autocmd VimResized * exe 'normal! \<c-w>='
autocmd BufWritePost .vimrc,.vimrc.local,init.vim source %
" save all files on focus lost, ignoring warnings about untitled buffers
autocmd FocusLost * silent! wa
" make quickfix windows take all the lower section of the screen
" when there are multiple windows open
autocmd FileType qf wincmd J
autocmd! BufWritePost * Neomake
augroup END
" }}}
" Append modeline after last line in buffer.
" Use substitute() instead of printf() to handle '%%s' modeline in LaTeX files.
function! AppendModeline()
let l:modeline = printf(" vim: set filetype=%s ts=%d sw=%d tw=%d %s :",
\ &filetype, &tabstop, &shiftwidth, &textwidth, &expandtab ? 'et' : 'noet')
let l:modeline = substitute(&commentstring, "%s", l:modeline, "")
call append(line("$"), l:modeline)
endfunction
nnoremap <silent> <Leader>ml :call AppendModeline()<CR>
" netrw settings
" disable banner
let g:netrw_banner=0
" open in prior window
let g:netrw_browse_split=4
" open splits to the right
let g:netrw_altv=1
" treeview
let g:netrw_liststyle=3
let g:netrw_list_hide=netrw_gitignore#Hide()
let g:netrw_list_hide.=',\(^\|\s\s\)\zs\.\S\+'
" vimux mappings
" Prompt for a command
map <Leader>vp :VimuxPromptCommand<CR>
" Prompt for a make command
map <Leader>vm :VimuxPromptCommand("make ")<CR>
" Inspect runner pane
map <Leader>vi :VimuxInspectRunner<CR>
" Close runner
map <Leader>vq :VimuxCloseRunner<CR>
" Rerun last command
map <Leader>vv :VimuxRunLastCommand<CR>
" Stop running command
map <Leader>vs :VimuxInterruptRunner<CR>
" close Goyo *and* vim with :q
function! s:goyo_enter()
let b:quitting=0
let b:quitting_bang=0
autocmd QuitPre <buffer> let b:quitting=1
cabbrev <buffer> q! let b:quitting_bang=1 <bar> q!
endfunction
function! s:goyo_leave()
" Quit Vim if this is the only remaining buffer
if b:quitting && len(filter(range(1, bufnr('$')), 'buflisted(v:val)')) == 1
if b:quitting_bang
qa!
else
qa
endif
endif
endfunction
autocmd! User GoyoEnter call <SID>goyo_enter()
autocmd! User GoyoLeave call <SID>goyo_leave()
" run rustfmt when saving a file
let g:rustfmt_autosave=1
au BufRead,BufNewFile *.sbt set filetype=scala
" textwidth for emails
au BufRead /tmp/*mutt-* set tw=72
augroup filetypedetect
" Mail
autocmd BufRead,BufNewFile *mutt-* setfiletype mail
augroup END
let g:coc_global_extensions = [
\ 'coc-explorer',
\ 'coc-snippets',
\ 'coc-pairs'
\ ]
nmap ge :CocCommand explorer<CR>
" Use tab for trigger completion with characters ahead and navigate.
" Use command ':verbose imap <tab>' to make sure tab is not mapped by other plugin.
inoremap <silent><expr> <TAB>
\ pumvisible() ? "\<C-n>" :
\ <SID>check_back_space() ? "\<TAB>" :
\ coc#refresh()
inoremap <expr><S-TAB> pumvisible() ? "\<C-p>" : "\<C-h>"
function! s:check_back_space() abort
let col = col('.') - 1
return !col || getline('.')[col - 1] =~# '\s'
endfunction
" Use <c-space> to trigger completion.
inoremap <silent><expr> <c-space> coc#refresh()
" Use <cr> to confirm completion, `<C-g>u` means break undo chain at current position.
" Coc only does snippet and additional edit on confirm.
inoremap <expr> <cr> pumvisible() ? "\<C-y>" : "\<C-g>u\<CR>"
" Or use `complete_info` if your vim support it, like:
" inoremap <expr> <cr> complete_info()["selected"] != "-1" ? "\<C-y>" : "\<C-g>u\<CR>"
" Use `[g` and `]g` to navigate diagnostics
nmap <silent> [g <Plug>(coc-diagnostic-prev)
nmap <silent> ]g <Plug>(coc-diagnostic-next)
" Remap keys for gotos
nmap <silent> gd <Plug>(coc-definition)
nmap <silent> gy <Plug>(coc-type-definition)
nmap <silent> gi <Plug>(coc-implementation)
nmap <silent> gr <Plug>(coc-references)
" Use K to show documentation in preview window
nnoremap <silent> K :call <SID>show_documentation()<CR>
function! s:show_documentation()
if (index(['vim','help'], &filetype) >= 0)
execute 'h '.expand('<cword>')
else
call CocAction('doHover')
endif
endfunction
" Highlight symbol under cursor on CursorHold
autocmd CursorHold * silent call CocActionAsync('highlight')
" Remap for rename current word
nmap <leader>rn <Plug>(coc-rename)
" Remap for format selected region
xmap <leader>f <Plug>(coc-format-selected)
nmap <leader>f <Plug>(coc-format-selected)
augroup mygroup
autocmd!
" Setup formatexpr specified filetype(s).
autocmd FileType typescript,json setl formatexpr=CocAction('formatSelected')
" Update signature help on jump placeholder
autocmd User CocJumpPlaceholder call CocActionAsync('showSignatureHelp')
augroup end
" Remap for do codeAction of selected region, ex: `<leader>aap` for current paragraph
xmap <leader>a <Plug>(coc-codeaction-selected)
nmap <leader>a <Plug>(coc-codeaction-selected)
" Remap for do codeAction of current line
nmap <leader>ac <Plug>(coc-codeaction)
" Fix autofix problem of current line
nmap <leader>qf <Plug>(coc-fix-current)
" Create mappings for function text object, requires document symbols feature of languageserver.
xmap if <Plug>(coc-funcobj-i)
xmap af <Plug>(coc-funcobj-a)
omap if <Plug>(coc-funcobj-i)
omap af <Plug>(coc-funcobj-a)
" Use <C-d> for select selections ranges, needs server support, like: coc-tsserver, coc-python
nmap <silent> <C-d> <Plug>(coc-range-select)
xmap <silent> <C-d> <Plug>(coc-range-select)
" Use `:Format` to format current buffer
command! -nargs=0 Format :call CocAction('format')
" Use `:Fold` to fold current buffer
command! -nargs=? Fold :call CocAction('fold', <f-args>)
" use `:OR` for organize import of current buffer
command! -nargs=0 OR :call CocAction('runCommand', 'editor.action.organizeImport')
" Add status line support, for integration with other plugin, checkout `:h coc-status`
" set statusline^=%{coc#status()}%{get(b:,'coc_current_function',''')}
" Using CocList
" Show all diagnostics
nnoremap <silent> <space>a :<C-u>CocList diagnostics<cr>
" Manage extensions
nnoremap <silent> <space>e :<C-u>CocList extensions<cr>
" Show commands
nnoremap <silent> <space>c :<C-u>CocList commands<cr>
" Find symbol of current document
nnoremap <silent> <space>o :<C-u>CocList outline<cr>
" Search workspace symbols
nnoremap <silent> <space>s :<C-u>CocList -I symbols<cr>
" Do default action for next item.
nnoremap <silent> <space>j :<C-u>CocNext<CR>
" Do default action for previous item.
nnoremap <silent> <space>k :<C-u>CocPrev<CR>
" Resume latest coc list
nnoremap <silent> <space>p :<C-u>CocListResume<CR>
" properly find root for py projects in workspace
autocmd FileType python let b:coc_root_patterns = ['.git', '.env', 'venv', '.venv', 'setup.cfg', 'setup.py', 'pyproject.toml', 'pyrightconfig.json']
" let g:tex_flavor = 'latex'
'';
};
in {
# Note that this doesnt merge deeply, so you couldnt add to plugins. For that
# you can use the nixos module systems mkMerge with
# programs.neovim = lib.mkMerge [ config { vimAlias = true; } ]
programs.neovim = {
vimAlias = true;
viAlias = true;
coc = {
enable = true;
settings = {
"rust-analyzer.serverPath" = "${pkgs.rust-analyzer}/bin/rust-analyzer";
"gopls.experimentalWorkspaceModule" = true;
};
};
} // config;
programs.vim = config;
# xdg.configFile."nvim/coc-settings.json".text = builtins.toJSON {
# # "go.goplsPath" = "${gopls}/bin/gopls";
# };
}

3
home/nextcloud.nix Normal file
View File

@ -0,0 +1,3 @@
{ ... }: {
services.nextcloud-client.enable = true;
}

3
home/pasystray.nix Normal file
View File

@ -0,0 +1,3 @@
{ ... }: {
services.pasystray.enable = true;
}

6
home/picom.nix Normal file
View File

@ -0,0 +1,6 @@
{ ... }: {
services.picom = {
enable = true;
# inactiveDim = "0.3";
};
}

130
home/polybar.nix Normal file
View File

@ -0,0 +1,130 @@
{ pkgs, ... }: {
services.polybar = {
enable = true;
config = {
"bar/top" = {
monitor = "\${env:MONITOR:}";
# monitor = "\${env:MONITOR:DVI-D-1}";
width = "100%";
height = "34";
background = "#00000000";
foreground = "#ccffffff";
# line-color = "\${bar/top.background}";
line-size = "16";
spacing = "2";
padding-right = "5";
module-margin = "4";
font-0 = "NotoSans-Regular:size=8;-1";
font-1 = "MaterialIcons:size=10;0";
font-2 = "Termsynu:size=8:antialias=false;-2";
font-3 = "FontAwesome:size=10;0";
# modules-left = "powermenu";
modules-left = "i3";
modules-right = "cpu memory volume wired-network date";
tray-position = "right";
tray-padding = "2";
};
"module/volume" = {
type = "internal/pulseaudio";
speaker-mixer = "Speaker";
headphone-mixer = "Headphone";
headphone-id = "9";
format-volume = "<ramp-volume> <label-volume>";
label-muted = " muted";
label-muted-foreground = "#66";
ramp-volume-0 = "";
ramp-volume-1 = "";
ramp-volume-2 = "";
# ramp-volume-3 = "4";
};
"module/i3" = {
type = "internal/i3";
format = "<label-state> <label-mode>";
index-sort = true;
pin-workspaces = true;
};
"module/wired-network" = {
type = "internal/network";
interface = "eno1";
interval = "3.0";
label-connected = "%{T3}%local_ip%%{T-}";
label-disconnected-foreground = "#66";
};
"module/date" = {
type = "internal/date";
date = "%%{F#99}%Y-%m-%d%%{F-} %%{F#fff}%H:%M%%{F-}";
date-alt = "%%{F#fff}%A, %d %B %Y %%{F#fff}%H:%M%%{F#666}:%%{F#fba922}%S%%{F-}";
};
"module/memory" = {
type = "internal/memory";
format = "<label> <bar-used>";
label = "RAM";
bar-used-width = "30";
bar-used-foreground-0 = "#aaff77";
bar-used-foreground-1 = "#aaff77";
bar-used-foreground-2 = "#fba922";
bar-used-foreground-3 = "#ff5555";
bar-used-indicator = "|";
bar-used-indicator-font = "6";
bar-used-indicator-foreground = "#ff";
bar-used-fill = "";
bar-used-fill-font = "6";
bar-used-empty = "";
bar-used-empty-font = "6";
bar-used-empty-foreground = "#444444";
};
"module/cpu" = {
type = "internal/cpu";
interval = "0.5";
format = "<label> <ramp-coreload>";
label = "CPU";
ramp-coreload-0 = "";
ramp-coreload-0-font = "2";
ramp-coreload-0-foreground = "#aaff77";
ramp-coreload-1 = "";
ramp-coreload-1-font = "2";
ramp-coreload-1-foreground = "#aaff77";
ramp-coreload-2 = "";
ramp-coreload-2-font = "2";
ramp-coreload-2-foreground = "#aaff77";
ramp-coreload-3 = "";
ramp-coreload-3-font = "2";
ramp-coreload-3-foreground = "#aaff77";
ramp-coreload-4 = "";
ramp-coreload-4-font = "2";
ramp-coreload-4-foreground = "#fba922";
ramp-coreload-5 = "";
ramp-coreload-5-font = "2";
ramp-coreload-5-foreground = "#fba922";
ramp-coreload-6 = "";
ramp-coreload-6-font = "2";
ramp-coreload-6-foreground = "#ff5555";
ramp-coreload-7 = "";
ramp-coreload-7-font = "2";
ramp-coreload-7-foreground = "#ff5555";
};
};
package = pkgs.polybar.override {
pulseSupport = true;
i3Support = true;
};
script = ''
polybar top &
'';
};
}

37
home/programs.nix Normal file
View File

@ -0,0 +1,37 @@
{ inputs, pkgs, system, ... }: {
home.packages = with pkgs; [
dnsutils
file
gnumake
pkg-config
i3lock-fancy
xfce.thunar
xfce.thunar-volman
# mounting external devices in thunar
gvfs
antigen
nodejs
fortune
httpie
pass
ripgrep
gcc
binutils # ar and stuff
# to view HTML emails in mutt
w3m
# literature/papers
zotero
# to copy from (n)vim into system clipboard under X11
# use wl-copy and wl-pate under wayland
xclip
obs-studio
# unstable.obs-v4l2sink
];
}

6
home/qt.nix Normal file
View File

@ -0,0 +1,6 @@
{ ... }: {
qt = {
enable = true;
platformTheme = "gtk";
};
}

7
home/redshift.nix Normal file
View File

@ -0,0 +1,7 @@
{ ... }: {
services.redshift = {
enable = true;
longitude = "49.01315";
latitude = "12.1119";
};
}

12
home/rofi.nix Normal file
View File

@ -0,0 +1,12 @@
{ ... }: {
programs.rofi = {
enable = true;
# font = "Roboto Mono 14";
extraConfig = {
window-format = "{w} {t}";
matching = "fuzzy";
line-padding = "15";
line-margin = "0";
};
};
}

8
home/rust.nix Normal file
View File

@ -0,0 +1,8 @@
{ pkgs, inputs, system, ... }: {
home.packages = with pkgs; [
cargo-edit
rust-analyzer
rustup
sccache
]
}

67
home/tmux.nix Normal file
View File

@ -0,0 +1,67 @@
{ ... }: {
programs.tmux = {
enable = true;
aggressiveResize = true;
baseIndex = 1;
clock24 = true;
escapeTime = 0;
historyLimit = 50000;
keyMode = "vi";
shortcut = "a";
terminal = "xterm-256color";
extraConfig = ''
bind a last-window
# highlight window when it has new activity
setw -g monitor-activity on
set -g visual-activity on
# renumber windows when one is closed
set -g renumber-windows on
# mouse behavior
set -g mouse on
# Fix to allow mousewheel/trackpad scrolling in tmux 2.1
bind-key -T root WheelUpPane if-shell -F -t = "#{alternate_on}" "send-keys -M" "select-pane -t =; copy-mode -e; send-keys -M"
bind-key -T root WheelDownPane if-shell -F -t = "#{alternate_on}" "send-keys -M" "select-pane -t =; send-keys -M"
# show tmux messages for 4 seconds
set -g display-time 4000
# New Pane
bind c new-window -c "#{pane_current_path}"
# New Session
bind enter new
# Split Panes
bind h split-window -h -c '#{pane_current_path}' # Split panes horizontal
bind v split-window -v -c '#{pane_current_path}' # Split panes vertically
# focus events enabled for terminals that support them
set -g focus-events on
# default statusbar colors
set -g status-fg white
set -g status-bg default
# default window title colors
set-window-option -g window-status-style fg=black,bg=default,dim
# active window title colors
set-window-option -g window-status-current-style fg=white,bg=default,dim
# command/message line colors
set -g message-style fg=white,bg=black,bright
# set -g default-terminal "xterm-256color"
# set-option -ga terminal-overrides ",xterm-*color:Tc"
set -g set-titles on
set -g set-titles-string "[#S] $USER@#H:#{pane_current_path} #{pane_current_command}"
set-window-option -g xterm-keys on
'';
};
}

3
home/xdg.nix Normal file
View File

@ -0,0 +1,3 @@
{ ... }: {
xdg.enable = true;
}

3
home/zathura.nix Normal file
View File

@ -0,0 +1,3 @@
{ ... }: {
programs.zathura.enable = true;
}

50
home/zsh.nix Normal file
View File

@ -0,0 +1,50 @@
{ pkgs, ... }: {
programs.zsh = {
enable = true;
enableAutosuggestions = true;
enableCompletion = true;
autocd = true;
dotDir = ".config/zsh";
history = {
expireDuplicatesFirst = true;
ignoreDups = true;
};
oh-my-zsh = {
enable = true;
# theme = "robbyrussell";
# theme = "agnoster";
# theme = "ys";
# theme = "lambda-mod";
plugins = [
"git"
"gitignore"
"cargo"
"torrent"
];
};
shellAliases = {
sudo = "sudo ";
sprunge = "curl -F 'sprunge=<-' http://sprunge.us";
};
localVariables = {
REPORTTIME = 10;
TIMEFMT = "\nreal\t%*E\nuser\t%*U\nsys\t%*S\nmaxmem\t%M MB\nfaults\t%F";
NIX_PATH = "$HOME/.nix-defexpr/channels\${NIX_PATH:+:}$NIX_PATH";
TERM = "xterm-256color";
RUSTC_WRAPPER = "sccache";
GOROOT = "$HOME/go";
PATH = "$PATH:$HOME/.cargo/bin:$GOROOT/bin:$GOPATH/bin";
};
initExtra = ''
[ -f $HOME/.nix-profile/etc/profile.d/nix.sh ] && . $HOME/.nix-profile/etc/profile.d/nix.sh
source ${pkgs.antigen}/share/antigen/antigen.zsh
# TODO: remove on NixOS
antigen bundle spwhitt/nix-zsh-completions
antigen bundle zsh-users/zsh-autosuggestions
antigen bundle zsh-users/zsh-syntax-highlighting
antigen theme https://github.com/denysdovhan/spaceship-zsh-theme spaceship
# antigen theme https://github.com/halfo/lambda-mod-zsh-theme lambda-mod
antigen apply
'';
};
}

150
maschines/common.nix Normal file
View File

@ -0,0 +1,150 @@
inputs:
{ config, libs, pkgs, ... }: {
nix = {
extraOptions = ''
experimental-features = nix-command flakes
'';
binaryCaches = lib.mkForce [
"https://cache.nixos.org/"
"https://nix-community.cachix.org"
];
binaryCachePublicKeys = [
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
];
};
nixpkgs.config.allowUnfree = true;
networking = {
networkmanager.enable = true;
};
i18n.defaultLocale = "en_GB.UTF-8";
time.timeZone = "Europe/Berlin";
sound.enable = true;
hardware = {
pulseaudio = {
enable = true;
# stop mumble from muting other processes
extraConfig = "unload-module module-role-cork";
};
opengl = {
enable = true;
driSupport = true;
driSupport32Bit = true;
};
};
services = {
dbus.packages = with pkgs; [ gcr ];
unbound.enable = true;
udisks2.enable = true;
# Enable CUPS to print documents.
printing.enable = true;
pipewire = {
enable = true;
pulse.enable = true;
};
# required for nextcloud
gnome.gnome-keyring.enable = true;
# faster entropy generation
haveged.enable = true;
xserver = {
enable = true;
layout = "eu";
xkbOptions = "caps:escape";
displayManager = {
defaultSession = "none+i3";
lightdm.enable = true;
};
windowManager.i3 = {
enable = true;
extraPackages = with pkgs; [
dmenu
rofi
i3status
i3lock
i3blocks
];
};
};
};
systemd.tmpfiles.rules = [
"L+ /lib64/ld-linux-x86-64.so.2 - - - - ${pkgs.stdenv.glibc}/lib64/ld-linux-x86-64.so.2"
];
environment.systemPackages = with pkgs; [
arandr
git
keepassxc
lxappearance
networkmanagerapplet
nextcloud-client
pavucontrol
termite
vim
which
xfce.thunar
xfce.thunar-volman
gvfs
];
virtualisation = {
docker = {
enable = true;
};
# podman = {
# enable = true;
# dockerCompat = true;
# dockerSocket.enable = true;
# };
# lxd.enable = true;
# virtualbox.host.enable = true;
# virtualbox.host.enableExtensionPack = true;
};
programs = {
# enable zsh globally
zsh.enable = true;
gnupg.agent = {
enable = true;
enableSSHSupport = true;
pinentryFlavor = "curses";
};
};
environment.sessionVariables = {
XKB_DEFAULT_OPTIONS = "caps:escape";
XKB_DEFAULT_LAYOUT = "eu";
};
# required for i3
environment.pathsToLink = [ "/libexec" ]; # links /libexec from derivations to /run/current-system/sw
fonts = {
enableDefaultFonts = true;
fonts = with pkgs; [
font-awesome-ttf
nerdfonts
noto-fonts-cjk
noto-fonts-emoji
powerline-fonts
];
fontconfig = {
defaultFonts = {
monospace = [ "JetBrainsMono Nerd Font" "Noto Color Emoji" ];
sansSerif = [ "JetBrainsMono Nerd Font" "Noto Color Emoji" ];
serif = [ "JetBrainsMono Nerd Font" "Noto Color Emoji" ];
};
};
}
}

96
maschines/w1n5t0n.nix Normal file
View File

@ -0,0 +1,96 @@
inputs:
let
system = "x86_64-linux";
hostname = "w1n5t0n";
in
inputs.nixpkgs.lib.nixosSystem {
inherit system;
modules = [
{ system.stateVersion = "21.11"; }
(import ./common.nix inputs)
({ pkgs, lib, ... }: {
networking.hostName = hostname;
users.users.me = {
isNormalUser = true;
createHome = true;
extraGroups = [
"adbusers"
"audio"
"davfs2"
"disk"
"docker"
"networkmanager"
"plugdev"
"users"
"uucp"
"vboxusers"
"video"
"wheel"
];
shell = pkgs.zsh;
};
boot = {
initrd = {
availableKernelModules = [ "xhci_pci" "ehci_pci" "ahci" "nvme" "usbhid" "usb_storage" "sd_mod" ];
kernelModules = [ "dm-snapshot" ];
luks.devices.root = {
device = "/dev/nvme0n1p2";
preLVM = true;
};
};
kernelModules = [ "kvm-intel" ];
# use latest kernel
kernelPackages = pkgs.linuxPackages.latest;
kernel.sysctl = {
# function keys on keychron keyboard won't work otherwise
"module.hid_apple.parameters.fnmode" = "2";
};
# Use the systemd-boot EFI boot loader.
loader = {
systemd-boot.enable = true;
efi.canTouchEfiVariables = true;
};
# mount tmp as tmpfs
tmpOnTmpfs = true;
# Enable NTFS support
supportedFilesystems = [ "ntfs" ];
};
fileSystems."/" = {
device = "/dev/disk/by-uuid/35f68af7-92fe-41ed-9338-8766ad7fbd5f";
fsType = "ext4";
};
fileSystems."/boot" = {
device = "/dev/disk/by-uuid/0DD8-8BF6";
fsType = "vfat";
};
swapDevices = [
{ device = "/dev/disk/by-uuid/c1bdaad5-2080-4e08-b37f-cd74e5edc734"; }
];
powerManagement.cpuFreqGovernor = lib.mkDefault "powersave";
hardware = {
opengl = {
extraPackages = with pkgs; [
rocm-opencl-icd
rocm-opencl-runtime
];
};
};
})
inputs.home-manager.nixosModules.home-manager
{
home-manager = {
useGlobalPkgs = true;
useUserPackages = true;
extraSpecialArgs = {
inherit inputs;
inherit system;
hostname = hostname;
};
users.me = import ../users/me.nix;
};
}
];
}

15
users/me.nix Normal file
View File

@ -0,0 +1,15 @@
{ inputs, pkgs, system, ... }:
import ../home
{
accounts = {
};
git = {
name = "Valentin Brandl";
email = "mail+dev@vbrandl.net";
};
inherit system;
username = "me";
}
{
inherit pkgs;
}