diff --git a/flake.nix b/flake.nix index 49a7238..6498b99 100644 --- a/flake.nix +++ b/flake.nix @@ -23,9 +23,18 @@ }; }; homeConfigurations = { - rothe = home-manager.lib.homeManagerConfiguration { + "rothe@lift" = home-manager.lib.homeManagerConfiguration { inherit pkgs; - modules = [ ./home/rothe.nix ]; + modules = [ + ./home/rothe.nix + ./home/wayland + ]; + }; + "rothe@johannes-powermachine" = home-manager.lib.homeManagerConfiguration { + inherit pkgs; + modules = [ + ./home/rothe.nix + ]; }; }; }; diff --git a/home/rothe.nix b/home/rothe.nix index 81e0505..5c9daae 100644 --- a/home/rothe.nix +++ b/home/rothe.nix @@ -4,403 +4,9 @@ home.username = "rothe"; home.homeDirectory = "/home/rothe"; - - home.packages = with pkgs; [ - flameshot - swaylock - roboto-mono - (nerdfonts.override { fonts = [ "RobotoMono" ]; }) + imports = [ + ./terminal ]; - fonts.fontconfig.enable = true; - - 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 = "2E3440"; - foreground = "D8DEE9"; - regular0 = "5b6272"; - regular1 = "bf616a"; - regular2 = "a3be8c"; - regular3 = "ebcb8b"; - regular4 = "81a1c1"; - regular5 = "b48ead"; - regular6 = "88c0d0"; - regular7 = "e5e9f0"; - bright0 = "5E5C64"; - bright1 = "F66151"; - bright2 = "33DA7A"; - bright3 = "E9AD0C"; - bright4 = "2A7BDE"; - bright5 = "C061CB"; - bright6 = "33C7DE"; - bright7 = "FFFFFF"; - }; - }; - }; - - 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; - background = "dark"; - }; - 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 '' -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 - set encoding=utf-8 - - " 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 :! terraform fmt - autocmd FileType python nnoremap :Black :Isort - autocmd FileType go nnoremap (go-fmt)(go-lint) - autocmd FileType go nnoremap (go-build) - autocmd FileType go nnoremap (go-run) - autocmd FileType go nnoremap gd (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 :NERDTreeToggle - - " 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; - }; - - programs.newsboat = { - enable = true; - extraConfig = " - urls-source \"miniflux\"\n - miniflux-url \"https://feeds.johannes-rothe.de/\"\n - miniflux-login \"johannes\"\n - miniflux-passwordfile ~/.minifluxpw\n - "; - }; - - - # 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 = { diff --git a/home/terminal/default.nix b/home/terminal/default.nix new file mode 100644 index 0000000..6462a77 --- /dev/null +++ b/home/terminal/default.nix @@ -0,0 +1,191 @@ +{ config, pkgs, lib, ... }: + +{ + home.packages = with pkgs; [ + roboto-mono + (nerdfonts.override { fonts = [ "RobotoMono" ]; }) + ]; + fonts.fontconfig.enable = true; + + 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.git = { + enable = true; + userEmail = "mail@johannes-rothe.de"; + userName = "Johannes Rothe"; + aliases = { + a = "add"; + ci = "commit"; + ca = "commit --amend --no-edit"; + st = "status"; + co = "checkout"; + br = "branch"; + }; + lfs = { + enable = true; + }; + difftastic = { + enable = true; + background = "dark"; + }; + 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.vim = { + enable = true; + defaultEditor = true; + # List of supported plugins: nix-env -f '' -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 + set encoding=utf-8 + + " 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 :! terraform fmt + autocmd FileType python nnoremap :Black :Isort + autocmd FileType go nnoremap (go-fmt)(go-lint) + autocmd FileType go nnoremap (go-build) + autocmd FileType go nnoremap (go-run) + autocmd FileType go nnoremap gd (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 :NERDTreeToggle + + " Devicons + let g:webdevicons_conceal_nerdtree_brackets = 1 + syntax enable + if exists("g:loaded_webdevicons") + call webdevicons#refresh() + endif + ''; + }; + + programs.ssh = { + enable = true; + extraConfig = '' + AddKeysToAgent yes + SendEnv GIT_COMMITTER_EMAIL GIT_COMMITTER_NAME + ''; + }; + + programs.newsboat = { + enable = true; + extraConfig = " + urls-source \"miniflux\"\n + miniflux-url \"https://feeds.johannes-rothe.de/\"\n + miniflux-login \"johannes\"\n + miniflux-passwordfile ~/.minifluxpw\n + "; + }; +} + diff --git a/home/wayland/default.nix b/home/wayland/default.nix new file mode 100644 index 0000000..0db9eae --- /dev/null +++ b/home/wayland/default.nix @@ -0,0 +1,218 @@ +{ config, pkgs, lib, ... }: + +{ + home.packages = with pkgs; [ + flameshot + swaylock + ]; + + 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 = "2E3440"; + foreground = "D8DEE9"; + regular0 = "5b6272"; + regular1 = "bf616a"; + regular2 = "a3be8c"; + regular3 = "ebcb8b"; + regular4 = "81a1c1"; + regular5 = "b48ead"; + regular6 = "88c0d0"; + regular7 = "e5e9f0"; + bright0 = "5E5C64"; + bright1 = "F66151"; + bright2 = "33DA7A"; + bright3 = "E9AD0C"; + bright4 = "2A7BDE"; + bright5 = "C061CB"; + bright6 = "33C7DE"; + bright7 = "FFFFFF"; + }; + }; + }; + + programs.rofi = { + enable = true; + font = "Roboto Mono Nerd Font 10"; + theme = "Arc-Dark"; + }; + + 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; + }; +} diff --git a/home/wallpapers/voxel-city-by-huntingfluff.jpg b/home/wayland/wallpapers/voxel-city-by-huntingfluff.jpg similarity index 100% rename from home/wallpapers/voxel-city-by-huntingfluff.jpg rename to home/wayland/wallpapers/voxel-city-by-huntingfluff.jpg diff --git a/home/waybar.css b/home/wayland/waybar.css similarity index 100% rename from home/waybar.css rename to home/wayland/waybar.css