nixos-config/home/rothe.nix

406 lines
10 KiB
Nix

{ config, pkgs, lib, ... }:
{
home.username = "rothe";
home.homeDirectory = "/home/rothe";
home.packages = with pkgs; [
flameshot
swaylock
(nerdfonts.override { fonts = [ "RobotoMono" ]; })
];
programs.fish = {
enable = true;
# start sway on login
loginShellInit = ''
if test -z "$DISPLAY" -a $XDG_VTNR = 1
exec sway
end
'';
# disable greeting
shellInit = ''
set fish_greeting
'';
shellAliases = {
"..." = "cd ../..";
"cds" = "cd ~/src/";
"ll" = "ls -lh";
"cal" = "rusti-cal --color -w";
"ip" = "ip -c";
};
};
programs.foot = {
enable = true;
settings = {
main = {
font = "Roboto Mono Nerd Font:size=10";
dpi-aware = "no";
};
# nordiq from https://codeberg.org/dnkl/foot/src/branch/master/themes/
colors = {
background = "0e1420";
foreground = "dbdee9";
regular0 = "5b6272";
regular1 = "bf616a";
regular2 = "a3be8c";
regular3 = "ebcb8b";
regular4 = "81a1c1";
regular5 = "b48ead";
regular6 = "88c0d0";
regular7 = "e5e9f0";
bright0 = "4c566a";
bright1 = "bf616a";
bright2 = "a3be8c";
bright3 = "ebcb8b";
bright4 = "81a1c1";
bright5 = "b48ead";
bright6 = "8fbcbb";
bright7 = "eceff4";
};
};
};
programs.git = {
enable = true;
userEmail = "mail@johannes-rothe.de";
userName = "Johannes Rothe";
aliases = {
ci = "commit";
st = "status";
co = "checkout";
br = "branch";
};
lfs = {
enable = true;
};
difftastic = {
enable = true;
};
extraConfig = {
core = {
editor = "vim";
};
};
};
programs.tmux = {
enable = true;
prefix = "C-a";
historyLimit = 150000;
keyMode = "vi";
customPaneNavigationAndResize = true;
extraConfig = ''
bind-key Space next-window
set -g status-right '#[fg=colour242]#S'
set -g status-left ' '
set -g window-status-format '#I:#W'
set -g window-status-current-format '#I:#W'
set -g allow-rename off
# default statusbar colors
set-option -g status-style bg=colour232,fg=colour239,default
# border
set -g pane-border-style fg=colour234,bg=default
set -g pane-active-border-style fg=colour236,bg=default
# active window title colors
set-window-option -g window-status-current-style fg=colour231,bg=default
set-window-option -g window-status-style fg=colour239,bg=default
# bell
set-window-option -g window-status-bell-style fg=colour232,bg=colour253
# Correct colors
set -g default-terminal "tmux-256color"
set -ga terminal-overrides ",*256col*:Tc"
'';
};
programs.rofi = {
enable = true;
font = "Roboto Mono Nerd Font 10";
theme = "Arc-Dark";
};
programs.ssh = {
enable = true;
extraConfig = ''
AddKeysToAgent yes
SendEnv GIT_COMMITTER_EMAIL GIT_COMMITTER_NAME
'';
};
programs.vim = {
enable = true;
defaultEditor = true;
# List of supported plugins: nix-env -f '<nixpkgs>' -qaP -A vimPlugins
plugins = [
pkgs.vimPlugins.ale
pkgs.vimPlugins.gitgutter
pkgs.vimPlugins.indentLine
pkgs.vimPlugins.nerdtree
pkgs.vimPlugins.python-syntax
pkgs.vimPlugins.rainbow
pkgs.vimPlugins.sonokai
pkgs.vimPlugins.vim-airline
pkgs.vimPlugins.vim-devicons
pkgs.vimPlugins.vim-go
pkgs.vimPlugins.vim-hcl
pkgs.vimPlugins.vim-isort
pkgs.vimPlugins.vim-terraform
pkgs.vimPlugins.YouCompleteMe
];
extraConfig = ''
set number
set colorcolumn=88
set background=dark
set cursorline
" Theme
if has('termguicolors')
set termguicolors
endif
let g:sonokai_style = "atlantis"
let g:sonokai_disable_italic_comment = 1
colorscheme sonokai
let g:airline_theme = "sonokai"
" Filetypes
au BufNewFile,BufRead *.launch set filetype=xml
augroup indent
autocmd FileType python,go,dockerfile,js,toml :set tabstop=4 softtabstop=4 shiftwidth=4 expandtab autoindent fileformat=unix
autocmd FileType terraform,sh,json,yaml,html,css :set tabstop=2 softtabstop=2 shiftwidth=2 expandtab autoindent fileformat=unix
augroup end
augroup spell
autocmd FileType gitcommit :set spell
autocmd FileType markdown :set spell
augroup end
augroup shortcuts
autocmd FileType terraform nnoremap <F9> :! terraform fmt<CR>
autocmd FileType python nnoremap <F9> :Black<CR> :Isort <CR>
autocmd FileType go nnoremap <F9> <Plug>(go-fmt)<Plug>(go-lint)
autocmd FileType go nnoremap <F7> <Plug>(go-build)
autocmd FileType go nnoremap <F8> <Plug>(go-run)
autocmd FileType go nnoremap gd <Plug>(go-def)
augroup end
" YouCompleteMe
let g:ycm_gopls_binary_path = "${pkgs.gopls}/bin/gopls"
" Black
let g:black_linelength = 88
" NERDTREE
" open nerdtree when no file is specified on startup
autocmd StdinReadPre * let s:std_in=1
autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree | endif
" toggle nerdtree keyboard shortcut
map <C-t> :NERDTreeToggle<CR>
" Devicons
let g:webdevicons_conceal_nerdtree_brackets = 1
syntax enable
if exists("g:loaded_webdevicons")
call webdevicons#refresh()
endif
'';
};
programs.waybar = {
enable = true;
settings = {
mainBar = {
position = "bottom";
height = 24;
modules-left = [
"sway/workspaces"
"sway/mode"
];
modules-right = [
"network"
"cpu"
"memory"
"battery"
"tray"
"clock"
];
"network" = {
format-wifi = " {essid} {ipaddr} ({signalStrength}%)";
format-ethernet = "{ipaddr}";
};
"clock" = {
format = "{:%a, %d.%m.%Y CW%V %H:%M}";
};
"cpu" = {
interval = 30;
format = "󰗉 {load}";
};
"memory" = {
interval = 30;
format = " {percentage}%";
};
"battery" = {
interval = 10;
format = "󰁹 {capacity}% ({time})";
format-charging = " {capacity}%";
format-plugged = " {capacity}%";
format-full = " {capacity}%";
states = {
"warning" = 30;
"critical" = 15;
};
};
};
};
style = ./waybar.css;
};
# Automatic display output management
services.kanshi = {
enable = true;
settings = [
{ profile.name = "undocked";
profile.outputs = [
{
criteria = "eDP-1";
status = "enable";
}
];
}
{ profile.name = "home_office";
profile.outputs = [
{
criteria = "eDP-1";
status = "disable";
}
{
criteria = "HDMI-A-2";
status = "enable";
}
];
}
{ profile.name = "office";
profile.outputs = [
{
criteria = "eDP-1";
status = "disable";
}
{
criteria = "DP-1";
status = "enable";
}
];
}
];
};
services.swayidle = {
enable = true;
timeouts = [
{ timeout = 1800; command = "${pkgs.swaylock}/bin/swaylock -f -c 000000"; }
{
timeout = 3600;
command = "${pkgs.sway}/bin/swaymsg 'output * dpms off'";
resumeCommand = "${pkgs.sway}/bin/swaymsg 'output * dpms on'";
}
];
events = [
{ event = "before-sleep"; command = "${pkgs.swaylock}/bin/swaylock -f -c 000000"; }
];
};
services.gammastep = {
enable = true;
latitude = 50.81;
longitude = 6.37;
};
services.mako = {
enable = true;
defaultTimeout = 5000;
};
wayland.windowManager.sway = {
enable = true;
checkConfig = false;
package = pkgs.sway;
wrapperFeatures.gtk = true;
config = let
wallpaper = "~/.wallpapers/voxel-city-by-huntingfluff.jpg";
in {
modifier = "Mod4";
focus.followMouse = false;
bars = [{
command = "waybar";
}];
output = {
"*" = {
bg = "${wallpaper} fill";
};
};
input = {
"*" = {
xkb_layout = "de";
};
};
menu = "rofi -show drun";
startup = [
{ command = "logseq"; }
];
window = {
hideEdgeBorders = "smart";
titlebar = false;
commands = [
{
command = "move scratchpad, resize set 1280 800";
criteria = {
title = "Logseq";
};
}
];
};
keybindings = let
modifier = config.wayland.windowManager.sway.config.modifier;
in lib.mkOptionDefault {
"--release Print" = "exec flameshot gui";
"Mod1+l" = "exec swaylock -f -i ${wallpaper} -s fill";
"${modifier}+m" = "scratchpad show";
"XF86MonBrightnessDown" = "exec light -U 10";
"XF86MonBrightnessUp" = "exec light -A 10";
"XF86AudioRaiseVolume" = "exec 'pactl set-sink-volume @DEFAULT_SINK@ +1%'";
"XF86AudioLowerVolume" = "exec 'pactl set-sink-volume @DEFAULT_SINK@ -1%'";
"XF86AudioMute" = "exec 'pactl set-sink-mute @DEFAULT_SINK@ toggle'";
};
};
};
home.file = {
".wallpapers".source = ./wallpapers;
};
# Add extra variables like $EDITOR
home.sessionVariables = {
};
# This value determines the Home Manager release that your configuration is
# compatible with. This helps avoid breakage when a new Home Manager release
# introduces backwards incompatible changes.
#
# You should not change this value, even if you update Home Manager. If you do
# want to update the value, then make sure to first check the Home Manager
# release notes.
home.stateVersion = "23.05"; # Please read the comment before changing.
# Let Home Manager install and manage itself.
programs.home-manager.enable = true;
}