From 0f0c0073176bb85d82dcd9de90fc9b77cf8768dc Mon Sep 17 00:00:00 2001 From: Patrick Neff Date: Mon, 8 Apr 2024 16:13:03 +0200 Subject: [PATCH] Merge previous flakes --- configs/home-manager/direnv/stdlib.sh | 29 + configs/home-manager/lf/colors | 174 +++++ configs/home-manager/lf/icons | 357 ++++++++++ configs/home-manager/zsh/zshrc.zsh | 102 +++ flake.lock | 647 ++++++++++++++++++ flake.nix | 138 ++++ hosts/pi0.odie.intranet/configuration.nix | 6 + .../hardware-configuration.nix | 45 ++ hosts/pi0.odie.intranet/home.nix | 6 + hosts/vm/configuration.nix | 45 ++ hosts/vm/hardware-configuration.nix | 52 ++ hosts/wsl-dev/configuration.nix | 14 + lib/default.nix | 8 + lib/mkHomeConfiguration.nix | 28 + lib/mkNixVim.nix | 10 + lib/mkNixVimLib.nix | 11 + lib/mkNixVimModule.nix | 8 + lib/mkPkgs.nix | 10 + lib/mkSystem.nix | 23 + modules/home-manager/base.nix | 17 + modules/home-manager/desktop.nix | 14 + .../desktop/awesome/awesomewm.nix | 87 +++ .../desktop/awesome/config/rc.nix | 625 +++++++++++++++++ .../desktop/awesome/config/theme.nix | 134 ++++ .../home-manager/desktop/awesome/default.nix | 22 + modules/home-manager/desktop/default.nix | 59 ++ .../home-manager/desktop/firefox/default.nix | 40 ++ .../desktop/keepassxc/default.nix | 10 + .../home-manager/desktop/kitty/default.nix | 24 + .../desktop/nextcloud-client/default.nix | 5 + .../home-manager/desktop/nixGL/default.nix | 12 + .../home-manager/desktop/picom/default.nix | 38 + modules/home-manager/desktop/rofi/default.nix | 140 ++++ modules/home-manager/desktop/theme/cursor.nix | 31 + .../home-manager/desktop/theme/default.nix | 9 + modules/home-manager/desktop/theme/gtk.nix | 27 + modules/home-manager/dev.nix | 5 + modules/home-manager/development/default.nix | 12 + .../development/gitea/default.nix | 10 + .../development/neovim-ide/default.nix | 16 + modules/home-manager/mpd/default.nix | 13 + modules/home-manager/mpd/mpd.nix | 5 + modules/home-manager/mpd/ncmpcpp.nix | 22 + modules/home-manager/shell.nix | 5 + modules/home-manager/shell/bat/default.nix | 14 + .../home-manager/shell/borgmatic/default.nix | 60 ++ .../home-manager/shell/borgmatic/excludes.nix | 258 +++++++ modules/home-manager/shell/btop/default.nix | 8 + modules/home-manager/shell/default.nix | 40 ++ modules/home-manager/shell/direnv/default.nix | 14 + modules/home-manager/shell/fzf/default.nix | 15 + modules/home-manager/shell/git/default.nix | 100 +++ modules/home-manager/shell/lf/default.nix | 56 ++ modules/home-manager/shell/lsd/default.nix | 7 + modules/home-manager/shell/ssh/default.nix | 26 + .../home-manager/shell/starship/default.nix | 336 +++++++++ modules/home-manager/shell/tldr/default.nix | 8 + modules/home-manager/shell/tmux/default.nix | 90 +++ modules/home-manager/shell/zoxide/default.nix | 10 + modules/home-manager/shell/zsh/default.nix | 45 ++ modules/nixos/base/bootloader/default.nix | 5 + modules/nixos/base/bootloader/systemdboot.nix | 5 + modules/nixos/base/default.nix | 16 + modules/nixos/base/home-manager/default.nix | 11 + modules/nixos/base/i18n/default.nix | 11 + modules/nixos/base/network/default.nix | 10 + modules/nixos/base/nixos/default.nix | 16 + .../nixos/base/power-management/default.nix | 30 + modules/nixos/base/programs/default.nix | 26 + .../nixos/base/raspberry-pi/cec/default.nix | 15 + modules/nixos/base/raspberry-pi/default.nix | 11 + modules/nixos/base/ssh/default.nix | 9 + modules/nixos/base/user/default.nix | 53 ++ modules/nixos/default.nix | 6 + modules/nixos/desktop/default.nix | 16 + modules/nixos/desktop/fonts/default.nix | 33 + .../nixos/desktop/networkmanager/default.nix | 5 + modules/nixos/desktop/sound/default.nix | 18 + modules/nixos/desktop/xorg/default.nix | 35 + modules/nixos/desktop/xorg/i18n.nix | 8 + modules/nixos/wsl/default.nix | 18 + modules/nixvim/autocommands/default.nix | 8 + .../nixvim/autocommands/filetype_options.nix | 43 ++ .../autocommands/remember_cursor_position.nix | 35 + .../nixvim/autocommands/set_conceal_level.nix | 34 + .../nixvim/autocommands/yank_highlight.nix | 23 + modules/nixvim/colorscheme.nix | 44 ++ modules/nixvim/default.nix | 15 + modules/nixvim/keymaps.nix | 75 ++ modules/nixvim/options.nix | 198 ++++++ modules/nixvim/plugins/codeium.nix | 12 + modules/nixvim/plugins/dap.nix | 130 ++++ modules/nixvim/plugins/default.nix | 26 + modules/nixvim/plugins/fugitive.nix | 3 + modules/nixvim/plugins/gitsigns.nix | 3 + modules/nixvim/plugins/harpoon.nix | 15 + modules/nixvim/plugins/indent-blankline.nix | 25 + modules/nixvim/plugins/lastplace.nix | 3 + modules/nixvim/plugins/lsp/cmp.nix | 236 +++++++ modules/nixvim/plugins/lsp/default.nix | 7 + modules/nixvim/plugins/lsp/languages/c.nix | 5 + .../nixvim/plugins/lsp/languages/default.nix | 20 + .../nixvim/plugins/lsp/languages/emmet.nix | 25 + .../nixvim/plugins/lsp/languages/eslint.nix | 9 + modules/nixvim/plugins/lsp/languages/go.nix | 58 ++ modules/nixvim/plugins/lsp/languages/html.nix | 15 + modules/nixvim/plugins/lsp/languages/htmx.nix | 7 + modules/nixvim/plugins/lsp/languages/json.nix | 7 + modules/nixvim/plugins/lsp/languages/lua.nix | 7 + modules/nixvim/plugins/lsp/languages/nix.nix | 10 + .../nixvim/plugins/lsp/languages/python.nix | 8 + modules/nixvim/plugins/lsp/languages/rust.nix | 19 + modules/nixvim/plugins/lsp/languages/sql.nix | 5 + .../plugins/lsp/languages/tailwindcss.nix | 7 + .../nixvim/plugins/lsp/languages/templ.nix | 7 + .../plugins/lsp/languages/typescript.nix | 7 + modules/nixvim/plugins/lsp/languages/yaml.nix | 5 + modules/nixvim/plugins/lsp/lsp.nix | 22 + modules/nixvim/plugins/lualine.nix | 102 +++ modules/nixvim/plugins/mini.nix | 47 ++ modules/nixvim/plugins/neo-tree.nix | 47 ++ modules/nixvim/plugins/neorg.nix | 59 ++ modules/nixvim/plugins/noice.nix | 77 +++ modules/nixvim/plugins/none-ls.nix | 15 + modules/nixvim/plugins/rainbow-delimiters.nix | 16 + modules/nixvim/plugins/telescope.nix | 66 ++ modules/nixvim/plugins/todo-comments.nix | 3 + modules/nixvim/plugins/treesitter.nix | 7 + modules/nixvim/plugins/trouble.nix | 33 + modules/nixvim/plugins/undotree.nix | 3 + modules/nixvim/plugins/vim-tmux-navigator.nix | 3 + modules/nixvim/plugins/which-key.nix | 3 + modules/nixvim/snippets/go.lua | 8 + pkgs/nixvim/default.nix | 21 + pkgs/tmuxPlugins/catppuccin.nix | 11 + profiles/home-manager/desktop-dev.nix | 19 + profiles/home-manager/desktop.nix | 18 + profiles/home-manager/shell-dev.nix | 18 + profiles/home-manager/shell.nix | 17 + 139 files changed, 6310 insertions(+) create mode 100644 configs/home-manager/direnv/stdlib.sh create mode 100644 configs/home-manager/lf/colors create mode 100644 configs/home-manager/lf/icons create mode 100644 configs/home-manager/zsh/zshrc.zsh create mode 100644 flake.lock create mode 100644 flake.nix create mode 100644 hosts/pi0.odie.intranet/configuration.nix create mode 100644 hosts/pi0.odie.intranet/hardware-configuration.nix create mode 100644 hosts/pi0.odie.intranet/home.nix create mode 100644 hosts/vm/configuration.nix create mode 100644 hosts/vm/hardware-configuration.nix create mode 100644 hosts/wsl-dev/configuration.nix create mode 100644 lib/default.nix create mode 100644 lib/mkHomeConfiguration.nix create mode 100644 lib/mkNixVim.nix create mode 100644 lib/mkNixVimLib.nix create mode 100644 lib/mkNixVimModule.nix create mode 100644 lib/mkPkgs.nix create mode 100644 lib/mkSystem.nix create mode 100644 modules/home-manager/base.nix create mode 100644 modules/home-manager/desktop.nix create mode 100644 modules/home-manager/desktop/awesome/awesomewm.nix create mode 100644 modules/home-manager/desktop/awesome/config/rc.nix create mode 100644 modules/home-manager/desktop/awesome/config/theme.nix create mode 100644 modules/home-manager/desktop/awesome/default.nix create mode 100644 modules/home-manager/desktop/default.nix create mode 100644 modules/home-manager/desktop/firefox/default.nix create mode 100644 modules/home-manager/desktop/keepassxc/default.nix create mode 100644 modules/home-manager/desktop/kitty/default.nix create mode 100644 modules/home-manager/desktop/nextcloud-client/default.nix create mode 100644 modules/home-manager/desktop/nixGL/default.nix create mode 100644 modules/home-manager/desktop/picom/default.nix create mode 100644 modules/home-manager/desktop/rofi/default.nix create mode 100644 modules/home-manager/desktop/theme/cursor.nix create mode 100644 modules/home-manager/desktop/theme/default.nix create mode 100644 modules/home-manager/desktop/theme/gtk.nix create mode 100644 modules/home-manager/dev.nix create mode 100644 modules/home-manager/development/default.nix create mode 100644 modules/home-manager/development/gitea/default.nix create mode 100644 modules/home-manager/development/neovim-ide/default.nix create mode 100644 modules/home-manager/mpd/default.nix create mode 100644 modules/home-manager/mpd/mpd.nix create mode 100644 modules/home-manager/mpd/ncmpcpp.nix create mode 100644 modules/home-manager/shell.nix create mode 100644 modules/home-manager/shell/bat/default.nix create mode 100644 modules/home-manager/shell/borgmatic/default.nix create mode 100644 modules/home-manager/shell/borgmatic/excludes.nix create mode 100644 modules/home-manager/shell/btop/default.nix create mode 100644 modules/home-manager/shell/default.nix create mode 100644 modules/home-manager/shell/direnv/default.nix create mode 100644 modules/home-manager/shell/fzf/default.nix create mode 100644 modules/home-manager/shell/git/default.nix create mode 100644 modules/home-manager/shell/lf/default.nix create mode 100644 modules/home-manager/shell/lsd/default.nix create mode 100644 modules/home-manager/shell/ssh/default.nix create mode 100644 modules/home-manager/shell/starship/default.nix create mode 100644 modules/home-manager/shell/tldr/default.nix create mode 100644 modules/home-manager/shell/tmux/default.nix create mode 100644 modules/home-manager/shell/zoxide/default.nix create mode 100644 modules/home-manager/shell/zsh/default.nix create mode 100644 modules/nixos/base/bootloader/default.nix create mode 100644 modules/nixos/base/bootloader/systemdboot.nix create mode 100644 modules/nixos/base/default.nix create mode 100644 modules/nixos/base/home-manager/default.nix create mode 100644 modules/nixos/base/i18n/default.nix create mode 100644 modules/nixos/base/network/default.nix create mode 100644 modules/nixos/base/nixos/default.nix create mode 100644 modules/nixos/base/power-management/default.nix create mode 100644 modules/nixos/base/programs/default.nix create mode 100644 modules/nixos/base/raspberry-pi/cec/default.nix create mode 100644 modules/nixos/base/raspberry-pi/default.nix create mode 100644 modules/nixos/base/ssh/default.nix create mode 100644 modules/nixos/base/user/default.nix create mode 100644 modules/nixos/default.nix create mode 100644 modules/nixos/desktop/default.nix create mode 100644 modules/nixos/desktop/fonts/default.nix create mode 100644 modules/nixos/desktop/networkmanager/default.nix create mode 100644 modules/nixos/desktop/sound/default.nix create mode 100644 modules/nixos/desktop/xorg/default.nix create mode 100644 modules/nixos/desktop/xorg/i18n.nix create mode 100644 modules/nixos/wsl/default.nix create mode 100644 modules/nixvim/autocommands/default.nix create mode 100644 modules/nixvim/autocommands/filetype_options.nix create mode 100644 modules/nixvim/autocommands/remember_cursor_position.nix create mode 100644 modules/nixvim/autocommands/set_conceal_level.nix create mode 100644 modules/nixvim/autocommands/yank_highlight.nix create mode 100644 modules/nixvim/colorscheme.nix create mode 100644 modules/nixvim/default.nix create mode 100644 modules/nixvim/keymaps.nix create mode 100644 modules/nixvim/options.nix create mode 100644 modules/nixvim/plugins/codeium.nix create mode 100644 modules/nixvim/plugins/dap.nix create mode 100644 modules/nixvim/plugins/default.nix create mode 100644 modules/nixvim/plugins/fugitive.nix create mode 100644 modules/nixvim/plugins/gitsigns.nix create mode 100644 modules/nixvim/plugins/harpoon.nix create mode 100644 modules/nixvim/plugins/indent-blankline.nix create mode 100644 modules/nixvim/plugins/lastplace.nix create mode 100644 modules/nixvim/plugins/lsp/cmp.nix create mode 100644 modules/nixvim/plugins/lsp/default.nix create mode 100644 modules/nixvim/plugins/lsp/languages/c.nix create mode 100644 modules/nixvim/plugins/lsp/languages/default.nix create mode 100644 modules/nixvim/plugins/lsp/languages/emmet.nix create mode 100644 modules/nixvim/plugins/lsp/languages/eslint.nix create mode 100644 modules/nixvim/plugins/lsp/languages/go.nix create mode 100644 modules/nixvim/plugins/lsp/languages/html.nix create mode 100644 modules/nixvim/plugins/lsp/languages/htmx.nix create mode 100644 modules/nixvim/plugins/lsp/languages/json.nix create mode 100644 modules/nixvim/plugins/lsp/languages/lua.nix create mode 100644 modules/nixvim/plugins/lsp/languages/nix.nix create mode 100644 modules/nixvim/plugins/lsp/languages/python.nix create mode 100644 modules/nixvim/plugins/lsp/languages/rust.nix create mode 100644 modules/nixvim/plugins/lsp/languages/sql.nix create mode 100644 modules/nixvim/plugins/lsp/languages/tailwindcss.nix create mode 100644 modules/nixvim/plugins/lsp/languages/templ.nix create mode 100644 modules/nixvim/plugins/lsp/languages/typescript.nix create mode 100644 modules/nixvim/plugins/lsp/languages/yaml.nix create mode 100644 modules/nixvim/plugins/lsp/lsp.nix create mode 100644 modules/nixvim/plugins/lualine.nix create mode 100644 modules/nixvim/plugins/mini.nix create mode 100644 modules/nixvim/plugins/neo-tree.nix create mode 100644 modules/nixvim/plugins/neorg.nix create mode 100644 modules/nixvim/plugins/noice.nix create mode 100644 modules/nixvim/plugins/none-ls.nix create mode 100644 modules/nixvim/plugins/rainbow-delimiters.nix create mode 100644 modules/nixvim/plugins/telescope.nix create mode 100644 modules/nixvim/plugins/todo-comments.nix create mode 100644 modules/nixvim/plugins/treesitter.nix create mode 100644 modules/nixvim/plugins/trouble.nix create mode 100644 modules/nixvim/plugins/undotree.nix create mode 100644 modules/nixvim/plugins/vim-tmux-navigator.nix create mode 100644 modules/nixvim/plugins/which-key.nix create mode 100644 modules/nixvim/snippets/go.lua create mode 100644 pkgs/nixvim/default.nix create mode 100644 pkgs/tmuxPlugins/catppuccin.nix create mode 100644 profiles/home-manager/desktop-dev.nix create mode 100644 profiles/home-manager/desktop.nix create mode 100644 profiles/home-manager/shell-dev.nix create mode 100644 profiles/home-manager/shell.nix diff --git a/configs/home-manager/direnv/stdlib.sh b/configs/home-manager/direnv/stdlib.sh new file mode 100644 index 0000000..96a0d09 --- /dev/null +++ b/configs/home-manager/direnv/stdlib.sh @@ -0,0 +1,29 @@ +layout_postgres() { + PGHOST="$(direnv_layout_dir)/postgres" + export PGHOST + + if [[ ! -d "$PGHOST" ]]; then + mkdir -p "$PGHOST" + fi + + PGDATA="$PGHOST/data" + export PGDATA + + if [[ ! -d "$PGDATA" ]]; then + initdb + cat >>"$PGDATA/postgresql.conf" <<-EOF + listen_addresses = '' + unix_socket_directories = '$PGHOST' + EOF + fi +} + +layout_symfony() { + PATH_add bin +} + +layout_python() { + PYTHONPATH_add src +} + +# vim: ft=sh diff --git a/configs/home-manager/lf/colors b/configs/home-manager/lf/colors new file mode 100644 index 0000000..b65d3f0 --- /dev/null +++ b/configs/home-manager/lf/colors @@ -0,0 +1,174 @@ +# vim:ft=dircolors +# (This is not a dircolors file but it helps to highlight colors and comments) + +# default values from dircolors +# (entries with a leading # are not implemented in lf) +# #no 00 # NORMAL +# fi 00 # FILE +# #rs 0 # RESET +# di 01;34 # DIR +# ln 01;36 # LINK +# #mh 00 # MULTIHARDLINK +# pi 40;33 # FIFO +# so 01;35 # SOCK +# #do 01;35 # DOOR +# bd 40;33;01 # BLK +# cd 40;33;01 # CHR +# or 40;31;01 # ORPHAN +# #mi 00 # MISSING +# su 37;41 # SETUID +# sg 30;43 # SETGID +# #ca 30;41 # CAPABILITY +# tw 30;42 # STICKY_OTHER_WRITABLE +# ow 34;42 # OTHER_WRITABLE +# st 37;44 # STICKY +# ex 01;32 # EXEC + +# default values from lf (with matching order) +# ln 01;36 # LINK +# or 31;01 # ORPHAN +# tw 01;34 # STICKY_OTHER_WRITABLE +# ow 01;34 # OTHER_WRITABLE +# st 01;34 # STICKY +# di 01;34 # DIR +# pi 33 # FIFO +# so 01;35 # SOCK +# bd 33;01 # BLK +# cd 33;01 # CHR +# su 01;32 # SETUID +# sg 01;32 # SETGID +# ex 01;32 # EXEC +# fi 00 # FILE + +# file types (with matching order) +ln 01;36 # LINK +or 31;01 # ORPHAN +tw 34 # STICKY_OTHER_WRITABLE +ow 34 # OTHER_WRITABLE +st 01;34 # STICKY +di 01;34 # DIR +pi 33 # FIFO +so 01;35 # SOCK +bd 33;01 # BLK +cd 33;01 # CHR +su 01;32 # SETUID +sg 01;32 # SETGID +ex 01;32 # EXEC +fi 00 # FILE + +# archives or compressed (dircolors defaults) +*.tar 01;31 +*.tgz 01;31 +*.arc 01;31 +*.arj 01;31 +*.taz 01;31 +*.lha 01;31 +*.lz4 01;31 +*.lzh 01;31 +*.lzma 01;31 +*.tlz 01;31 +*.txz 01;31 +*.tzo 01;31 +*.t7z 01;31 +*.zip 01;31 +*.z 01;31 +*.dz 01;31 +*.gz 01;31 +*.lrz 01;31 +*.lz 01;31 +*.lzo 01;31 +*.xz 01;31 +*.zst 01;31 +*.tzst 01;31 +*.bz2 01;31 +*.bz 01;31 +*.tbz 01;31 +*.tbz2 01;31 +*.tz 01;31 +*.deb 01;31 +*.rpm 01;31 +*.jar 01;31 +*.war 01;31 +*.ear 01;31 +*.sar 01;31 +*.rar 01;31 +*.alz 01;31 +*.ace 01;31 +*.zoo 01;31 +*.cpio 01;31 +*.7z 01;31 +*.rz 01;31 +*.cab 01;31 +*.wim 01;31 +*.swm 01;31 +*.dwm 01;31 +*.esd 01;31 + +# image formats (dircolors defaults) +*.jpg 01;35 +*.jpeg 01;35 +*.mjpg 01;35 +*.mjpeg 01;35 +*.gif 01;35 +*.bmp 01;35 +*.pbm 01;35 +*.pgm 01;35 +*.ppm 01;35 +*.tga 01;35 +*.xbm 01;35 +*.xpm 01;35 +*.tif 01;35 +*.tiff 01;35 +*.png 01;35 +*.svg 01;35 +*.svgz 01;35 +*.mng 01;35 +*.pcx 01;35 +*.mov 01;35 +*.mpg 01;35 +*.mpeg 01;35 +*.m2v 01;35 +*.mkv 01;35 +*.webm 01;35 +*.ogm 01;35 +*.mp4 01;35 +*.m4v 01;35 +*.mp4v 01;35 +*.vob 01;35 +*.qt 01;35 +*.nuv 01;35 +*.wmv 01;35 +*.asf 01;35 +*.rm 01;35 +*.rmvb 01;35 +*.flc 01;35 +*.avi 01;35 +*.fli 01;35 +*.flv 01;35 +*.gl 01;35 +*.dl 01;35 +*.xcf 01;35 +*.xwd 01;35 +*.yuv 01;35 +*.cgm 01;35 +*.emf 01;35 +*.ogv 01;35 +*.ogx 01;35 + +# audio formats (dircolors defaults) +*.aac 00;36 +*.au 00;36 +*.flac 00;36 +*.m4a 00;36 +*.mid 00;36 +*.midi 00;36 +*.mka 00;36 +*.mp3 00;36 +*.mpc 00;36 +*.ogg 00;36 +*.ra 00;36 +*.wav 00;36 +*.oga 00;36 +*.opus 00;36 +*.spx 00;36 +*.xspf 00;36 diff --git a/configs/home-manager/lf/icons b/configs/home-manager/lf/icons new file mode 100644 index 0000000..404f9e5 --- /dev/null +++ b/configs/home-manager/lf/icons @@ -0,0 +1,357 @@ +# vim:ft=conf + +# These examples require Nerd Fonts or a compatible font to be used. +# See https://www.nerdfonts.com for more information. + +# default values from lf (with matching order) +# ln l # LINK +# or l # ORPHAN +# tw t # STICKY_OTHER_WRITABLE +# ow d # OTHER_WRITABLE +# st t # STICKY +# di d # DIR +# pi p # FIFO +# so s # SOCK +# bd b # BLK +# cd c # CHR +# su u # SETUID +# sg g # SETGID +# ex x # EXEC +# fi - # FILE + +# file types (with matching order) +ln  # LINK +or  # ORPHAN +tw t # STICKY_OTHER_WRITABLE +ow  # OTHER_WRITABLE +st t # STICKY +di  # DIR +pi p # FIFO +so s # SOCK +bd b # BLK +cd c # CHR +su u # SETUID +sg g # SETGID +ex  # EXEC +fi  # FILE + +# file extensions (vim-devicons) +*.styl  +*.sass  +*.scss  +*.htm  +*.html  +*.slim  +*.haml  +*.ejs  +*.css  +*.less  +*.md  +*.mdx  +*.markdown  +*.rmd  +*.json  +*.webmanifest  +*.js  +*.mjs  +*.jsx  +*.rb  +*.gemspec  +*.rake  +*.php  +*.py  +*.pyc  +*.pyo  +*.pyd  +*.coffee  +*.mustache  +*.hbs  +*.conf  +*.ini  +*.yml  +*.yaml  +*.toml  +*.bat  +*.mk  +*.jpg  +*.jpeg  +*.bmp  +*.png  +*.webp  +*.gif  +*.ico  +*.twig  +*.cpp  +*.c++  +*.cxx  +*.cc  +*.cp  +*.c  +*.cs 󰌛 +*.h  +*.hh  +*.hpp  +*.hxx  +*.hs  +*.lhs  +*.nix  +*.lua  +*.java  +*.sh  +*.fish  +*.bash  +*.zsh  +*.ksh  +*.csh  +*.awk  +*.ps1  +*.ml λ +*.mli λ +*.diff  +*.db  +*.sql  +*.dump  +*.clj  +*.cljc  +*.cljs  +*.edn  +*.scala  +*.go  +*.dart  +*.xul  +*.sln  +*.suo  +*.pl  +*.pm  +*.t  +*.rss  +'*.f#'  +*.fsscript  +*.fsx  +*.fs  +*.fsi  +*.rs  +*.rlib  +*.d  +*.erl  +*.hrl  +*.ex  +*.exs  +*.eex  +*.leex  +*.heex  +*.vim  +*.ai  +*.psd  +*.psb  +*.ts  +*.tsx  +*.jl  +*.pp  +*.vue  +*.elm  +*.swift  +*.xcplayground  +*.tex 󰙩 +*.r 󰟔 +*.rproj 󰗆 +*.sol 󰡪 +*.pem  + +# file names (vim-devicons) (case-insensitive not supported in lf) +*gruntfile.coffee  +*gruntfile.js  +*gruntfile.ls  +*gulpfile.coffee  +*gulpfile.js  +*gulpfile.ls  +*mix.lock  +*dropbox  +*.ds_store  +*.gitconfig  +*.gitignore  +*.gitattributes  +*.gitlab-ci.yml  +*.bashrc  +*.zshrc  +*.zshenv  +*.zprofile  +*.vimrc  +*.gvimrc  +*_vimrc  +*_gvimrc  +*.bashprofile  +*favicon.ico  +*license  +*node_modules  +*react.jsx  +*procfile  +*dockerfile  +*docker-compose.yml  +*rakefile  +*config.ru  +*gemfile  +*makefile  +*cmakelists.txt  +*robots.txt 󰚩 + +# file names (case-sensitive adaptations) +*Gruntfile.coffee  +*Gruntfile.js  +*Gruntfile.ls  +*Gulpfile.coffee  +*Gulpfile.js  +*Gulpfile.ls  +*Dropbox  +*.DS_Store  +*LICENSE  +*React.jsx  +*Procfile  +*Dockerfile  +*Docker-compose.yml  +*Rakefile  +*Gemfile  +*Makefile  +*CMakeLists.txt  + +# file patterns (vim-devicons) (patterns not supported in lf) +# .*jquery.*\.js$  +# .*angular.*\.js$  +# .*backbone.*\.js$  +# .*require.*\.js$  +# .*materialize.*\.js$  +# .*materialize.*\.css$  +# .*mootools.*\.js$  +# .*vimrc.*  +# Vagrantfile$  + +# file patterns (file name adaptations) +*jquery.min.js  +*angular.min.js  +*backbone.min.js  +*require.min.js  +*materialize.min.js  +*materialize.min.css  +*mootools.min.js  +*vimrc  +Vagrantfile  + +# archives or compressed (extensions from dircolors defaults) +*.tar  +*.tgz  +*.arc  +*.arj  +*.taz  +*.lha  +*.lz4  +*.lzh  +*.lzma  +*.tlz  +*.txz  +*.tzo  +*.t7z  +*.zip  +*.z  +*.dz  +*.gz  +*.lrz  +*.lz  +*.lzo  +*.xz  +*.zst  +*.tzst  +*.bz2  +*.bz  +*.tbz  +*.tbz2  +*.tz  +*.deb  +*.rpm  +*.jar  +*.war  +*.ear  +*.sar  +*.rar  +*.alz  +*.ace  +*.zoo  +*.cpio  +*.7z  +*.rz  +*.cab  +*.wim  +*.swm  +*.dwm  +*.esd  + +# image formats (extensions from dircolors defaults) +*.jpg  +*.jpeg  +*.mjpg  +*.mjpeg  +*.gif  +*.bmp  +*.pbm  +*.pgm  +*.ppm  +*.tga  +*.xbm  +*.xpm  +*.tif  +*.tiff  +*.png  +*.svg  +*.svgz  +*.mng  +*.pcx  +*.mov  +*.mpg  +*.mpeg  +*.m2v  +*.mkv  +*.webm  +*.ogm  +*.mp4  +*.m4v  +*.mp4v  +*.vob  +*.qt  +*.nuv  +*.wmv  +*.asf  +*.rm  +*.rmvb  +*.flc  +*.avi  +*.fli  +*.flv  +*.gl  +*.dl  +*.xcf  +*.xwd  +*.yuv  +*.cgm  +*.emf  +*.ogv  +*.ogx  + +# audio formats (extensions from dircolors defaults) +*.aac  +*.au  +*.flac  +*.m4a  +*.mid  +*.midi  +*.mka  +*.mp3  +*.mpc  +*.ogg  +*.ra  +*.wav  +*.oga  +*.opus  +*.spx  +*.xspf  + +# other formats +*.pdf  diff --git a/configs/home-manager/zsh/zshrc.zsh b/configs/home-manager/zsh/zshrc.zsh new file mode 100644 index 0000000..3203dc3 --- /dev/null +++ b/configs/home-manager/zsh/zshrc.zsh @@ -0,0 +1,102 @@ +zle -N up-line-or-beginning-search +zle -N down-line-or-beginning-search + +zstyle ':completion:*' completer _extensions _complete _approximate +zstyle ':completion:*' use-cache on +zstyle ':completion:*' cache-path "$XDG_CACHE_HOME/zsh/.zcompcache" +zstyle ':completion:*' matcher-list '' 'm:{a-zA-Z}={A-Za-z}' 'r:|[._-]=* r:|=*' 'l:|=* r:|=*' +zstyle ':completion:*:messages' format ' %F{purple} -- %d --%f' +zstyle ':completion:*:warnings' format ' %F{red}-- no matches found --%f' +zstyle ':completion:*:*:*:*:descriptions' format '%F{green}-- %d --%f' +zstyle ':completion:*:*:*:*:corrections' format '%F{yellow}!- %d (errors: %e) -!%f' +zstyle ':completion:*' menu select +zstyle ':completion:*' group-name '' +zstyle ':completion:*' list-colors ''${(s.:.)LS_COLORS} +zstyle ':completion:*' file-list all +zstyle ':completion:complete:*' gain-privileges 1 +# disable sort when completing `git checkout` +zstyle ':completion:*:git-checkout:*' sort false +# set descriptions format to enable group support +zstyle ':completion:*:descriptions' format '[%d]' + +zmodload zsh/complist +bindkey -M menuselect 'h' vi-backward-char +bindkey -M menuselect 'k' vi-up-line-or-history +bindkey -M menuselect 'j' vi-down-line-or-history +bindkey -M menuselect 'l' vi-forward-char + +typeset -g -A key + +key[Home]="${terminfo[khome]}" +key[End]="${terminfo[kend]}" +key[Insert]="${terminfo[kich1]}" +key[Backspace]="${terminfo[kbs]}" +key[Delete]="${terminfo[kdch1]}" +key[Up]="${terminfo[kcuu1]}" +key[Down]="${terminfo[kcud1]}" +key[Left]="${terminfo[kcub1]}" +key[Right]="${terminfo[kcuf1]}" +key[PageUp]="${terminfo[kpp]}" +key[PageDown]="${terminfo[knp]}" +key[Shift-Tab]="${terminfo[kcbt]}" + +# setup key accordingly +[[ -n "${key[Home]}" ]] && bindkey -- "${key[Home]}" beginning-of-line +[[ -n "${key[End]}" ]] && bindkey -- "${key[End]}" end-of-line +[[ -n "${key[Insert]}" ]] && bindkey -- "${key[Insert]}" overwrite-mode +[[ -n "${key[Backspace]}" ]] && bindkey -- "${key[Backspace]}" backward-delete-char +[[ -n "${key[Delete]}" ]] && bindkey -- "${key[Delete]}" delete-char +[[ -n "${key[Left]}" ]] && bindkey -- "${key[Left]}" backward-char +[[ -n "${key[Right]}" ]] && bindkey -- "${key[Right]}" forward-char +[[ -n "${key[PageUp]}" ]] && bindkey -- "${key[PageUp]}" beginning-of-buffer-or-history +[[ -n "${key[PageDown]}" ]] && bindkey -- "${key[PageDown]}" end-of-buffer-or-history +[[ -n "${key[Shift-Tab]}" ]] && bindkey -- "${key[Shift-Tab]}" reverse-menu-complete + +#[[ -n "${key[Up]}" ]] && bindkey -- "${key[Up]}" up-line-or-beginning-search +#[[ -n "${key[Down]}" ]] && bindkey -- "${key[Down]}" down-line-or-beginning-search +[[ -n "${key[Up]}" ]] && bindkey -- "${key[Up]}" history-substring-search-up +[[ -n "${key[Down]}" ]] && bindkey -- "${key[Down]}" history-substring-search-down + + +# Finally, make sure the terminal is in application mode, when zle is +# active. Only then are the values from $terminfo valid. +if (( ${+terminfo[smkx]} && ${+terminfo[rmkx]} )); then + autoload -Uz add-zle-hook-widget + function zle_application_mode_start { echoti smkx } + function zle_application_mode_stop { echoti rmkx } + add-zle-hook-widget -Uz zle-line-init zle_application_mode_start + add-zle-hook-widget -Uz zle-line-finish zle_application_mode_stop +fi + +_fzf_compgen_path() { + fd --hidden --follow --exclude ".git" . "$1" +} + +# Use fd to generate the list for directory completion +_fzf_compgen_dir() { + fd --type d --hidden --follow --exclude ".git" . "$1" +} + + +function gi() { + curl -sLw '\n' "https://www.toptal.com/developers/gitignore/api/$*" +} + +_gitignoreio_get_command_list() { + curl -sL https://www.toptal.com/developers/gitignore/api/list | tr "," "\n" +} + +_gitignoreio () { + compset -P '*,' + compadd -S '' "$(_gitignoreio_get_command_list)" +} + +compdef _gitignoreio gi + +compdef _symfony_complete symfony +compdef _symfony_complete composer +compdef _symfony_complete console +compdef _symfony_complete artisan +compdef _symfony_complete phpstan +compdef _symfony_complete php-cs-fixer +compdef _symfony_complete phpspec diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..2275f07 --- /dev/null +++ b/flake.lock @@ -0,0 +1,647 @@ +{ + "nodes": { + "base16-schemes": { + "flake": false, + "locked": { + "lastModified": 1696158499, + "narHash": "sha256-5yIHgDTPjoX/3oDEfLSQ0eJZdFL1SaCfb9d6M0RmOTM=", + "owner": "tinted-theming", + "repo": "base16-schemes", + "rev": "a9112eaae86d9dd8ee6bb9445b664fba2f94037a", + "type": "github" + }, + "original": { + "owner": "tinted-theming", + "repo": "base16-schemes", + "type": "github" + } + }, + "devshell": { + "inputs": { + "flake-utils": "flake-utils_4", + "nixpkgs": [ + "nixvim", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1711099426, + "narHash": "sha256-HzpgM/wc3aqpnHJJ2oDqPBkNsqWbW0WfWUO8lKu8nGk=", + "owner": "numtide", + "repo": "devshell", + "rev": "2d45b54ca4a183f2fdcf4b19c895b64fbf620ee8", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "devshell", + "type": "github" + } + }, + "flake-compat": { + "flake": false, + "locked": { + "lastModified": 1696426674, + "narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "0f9255e01c2351cc7d116c072cb317785dd33b33", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, + "flake-compat_2": { + "locked": { + "lastModified": 1696426674, + "narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=", + "rev": "0f9255e01c2351cc7d116c072cb317785dd33b33", + "revCount": 57, + "type": "tarball", + "url": "https://api.flakehub.com/f/pinned/edolstra/flake-compat/1.0.1/018afb31-abd1-7bff-a5e4-cff7e18efb7a/source.tar.gz" + }, + "original": { + "type": "tarball", + "url": "https://flakehub.com/f/edolstra/flake-compat/1.tar.gz" + } + }, + "flake-compat_3": { + "flake": false, + "locked": { + "lastModified": 1696426674, + "narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "0f9255e01c2351cc7d116c072cb317785dd33b33", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, + "flake-parts": { + "inputs": { + "nixpkgs-lib": "nixpkgs-lib" + }, + "locked": { + "lastModified": 1712014858, + "narHash": "sha256-sB4SWl2lX95bExY2gMFG5HIzvva5AVMJd4Igm+GpZNw=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "9126214d0a59633752a136528f5f3b9aa8565b7d", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, + "flake-parts_2": { + "inputs": { + "nixpkgs-lib": [ + "neovim-nightly-overlay", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1712014858, + "narHash": "sha256-sB4SWl2lX95bExY2gMFG5HIzvva5AVMJd4Igm+GpZNw=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "9126214d0a59633752a136528f5f3b9aa8565b7d", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, + "flake-parts_3": { + "inputs": { + "nixpkgs-lib": [ + "neovim-nightly-overlay", + "hercules-ci-effects", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1709336216, + "narHash": "sha256-Dt/wOWeW6Sqm11Yh+2+t0dfEWxoMxGBvv3JpIocFl9E=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "f7b3c975cf067e56e7cda6cb098ebe3fb4d74ca2", + "type": "github" + }, + "original": { + "id": "flake-parts", + "type": "indirect" + } + }, + "flake-parts_4": { + "inputs": { + "nixpkgs-lib": [ + "nixvim", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1709336216, + "narHash": "sha256-Dt/wOWeW6Sqm11Yh+2+t0dfEWxoMxGBvv3JpIocFl9E=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "f7b3c975cf067e56e7cda6cb098ebe3fb4d74ca2", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, + "flake-utils": { + "inputs": { + "systems": [ + "systems" + ] + }, + "locked": { + "lastModified": 1710146030, + "narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "flake-utils_2": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1701680307, + "narHash": "sha256-kAuep2h5ajznlPMD9rnQyffWG8EM/C73lejGofXvdM8=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "4022d587cbbfd70fe950c1e2083a02621806a725", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "flake-utils_3": { + "locked": { + "lastModified": 1659877975, + "narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "c0e246b9b83f637f4681389ecabcb2681b4f3af0", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "flake-utils_4": { + "inputs": { + "systems": "systems_2" + }, + "locked": { + "lastModified": 1701680307, + "narHash": "sha256-kAuep2h5ajznlPMD9rnQyffWG8EM/C73lejGofXvdM8=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "4022d587cbbfd70fe950c1e2083a02621806a725", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "flake-utils_5": { + "inputs": { + "systems": "systems_3" + }, + "locked": { + "lastModified": 1710146030, + "narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "gitignore": { + "inputs": { + "nixpkgs": [ + "nixvim", + "pre-commit-hooks", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1709087332, + "narHash": "sha256-HG2cCnktfHsKV0s4XW83gU3F57gaTljL9KNSuG6bnQs=", + "owner": "hercules-ci", + "repo": "gitignore.nix", + "rev": "637db329424fd7e46cf4185293b9cc8c88c95394", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "gitignore.nix", + "type": "github" + } + }, + "hercules-ci-effects": { + "inputs": { + "flake-parts": "flake-parts_3", + "nixpkgs": [ + "neovim-nightly-overlay", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1710478346, + "narHash": "sha256-Xjf8BdnQG0tLhPMlqQdwCIjOp7Teox0DP3N/jjyiGM4=", + "owner": "hercules-ci", + "repo": "hercules-ci-effects", + "rev": "64e7763d72c1e4c1e5e6472640615b6ae2d40fbf", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "hercules-ci-effects", + "type": "github" + } + }, + "home-manager": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1712462372, + "narHash": "sha256-WA3bbBWhd3o1wAgyHZNypjb/LG4oq+IWxFq8ey8yNPU=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "a561ad6ab38578c812cc9af3b04f2cc60ebf48c9", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "home-manager", + "type": "github" + } + }, + "home-manager_2": { + "inputs": { + "nixpkgs": [ + "nixvim", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1711625603, + "narHash": "sha256-W+9dfqA9bqUIBV5u7jaIARAzMe3kTq/Hp2SpSVXKRQw=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "c0ef0dab55611c676ad7539bf4e41b3ec6fa87d2", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "home-manager", + "type": "github" + } + }, + "neovim-flake": { + "inputs": { + "flake-utils": "flake-utils_2", + "nixpkgs": [ + "neovim-nightly-overlay", + "nixpkgs" + ] + }, + "locked": { + "dir": "contrib", + "lastModified": 1712529338, + "narHash": "sha256-5/E8yWlb6XiQcT8LIhf1IoMQvCsJ+YI3ydNdDteh+xU=", + "owner": "neovim", + "repo": "neovim", + "rev": "541c2d3816cdef9aba7f55f74908fa07d0cfa3ec", + "type": "github" + }, + "original": { + "dir": "contrib", + "owner": "neovim", + "repo": "neovim", + "type": "github" + } + }, + "neovim-nightly-overlay": { + "inputs": { + "flake-compat": "flake-compat", + "flake-parts": "flake-parts_2", + "hercules-ci-effects": "hercules-ci-effects", + "neovim-flake": "neovim-flake", + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1712534643, + "narHash": "sha256-nOR2DxznyiBQ1sDxjIk8D5nrJhD/z+PwlBfc8YonSr4=", + "owner": "nix-community", + "repo": "neovim-nightly-overlay", + "rev": "4cb2a8580de0498dd38eb90791728547b5826331", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "neovim-nightly-overlay", + "type": "github" + } + }, + "nix-colors": { + "inputs": { + "base16-schemes": "base16-schemes", + "nixpkgs-lib": "nixpkgs-lib_2" + }, + "locked": { + "lastModified": 1707825078, + "narHash": "sha256-hTfge2J2W+42SZ7VHXkf4kjU+qzFqPeC9k66jAUBMHk=", + "owner": "misterio77", + "repo": "nix-colors", + "rev": "b01f024090d2c4fc3152cd0cf12027a7b8453ba1", + "type": "github" + }, + "original": { + "owner": "misterio77", + "repo": "nix-colors", + "type": "github" + } + }, + "nix-darwin": { + "inputs": { + "nixpkgs": [ + "nixvim", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1711763326, + "narHash": "sha256-sXcesZWKXFlEQ8oyGHnfk4xc9f2Ip0X/+YZOq3sKviI=", + "owner": "lnl7", + "repo": "nix-darwin", + "rev": "36524adc31566655f2f4d55ad6b875fb5c1a4083", + "type": "github" + }, + "original": { + "owner": "lnl7", + "repo": "nix-darwin", + "type": "github" + } + }, + "nixgl": { + "inputs": { + "flake-utils": "flake-utils_3", + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1705794759, + "narHash": "sha256-jfyttJ23+WcGlW9zoBcQuUpXNCLEwZaygJClvtFTqWU=", + "owner": "nix-community", + "repo": "nixGL", + "rev": "9b4887dbf16933bdc124296434b3898d810b3608", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nixGL", + "rev": "9b4887dbf16933bdc124296434b3898d810b3608", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1712439257, + "narHash": "sha256-aSpiNepFOMk9932HOax0XwNxbA38GOUVOiXfUVPOrck=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "ff0dbd94265ac470dda06a657d5fe49de93b4599", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-lib": { + "locked": { + "dir": "lib", + "lastModified": 1711703276, + "narHash": "sha256-iMUFArF0WCatKK6RzfUJknjem0H9m4KgorO/p3Dopkk=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "d8fe5e6c92d0d190646fb9f1056741a229980089", + "type": "github" + }, + "original": { + "dir": "lib", + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-lib_2": { + "locked": { + "lastModified": 1697935651, + "narHash": "sha256-qOfWjQ2JQSQL15KLh6D7xQhx0qgZlYZTYlcEiRuAMMw=", + "owner": "nix-community", + "repo": "nixpkgs.lib", + "rev": "e1e11fdbb01113d85c7f41cada9d2847660e3902", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nixpkgs.lib", + "type": "github" + } + }, + "nixvim": { + "inputs": { + "devshell": "devshell", + "flake-compat": "flake-compat_2", + "flake-parts": "flake-parts_4", + "home-manager": "home-manager_2", + "nix-darwin": "nix-darwin", + "nixpkgs": [ + "nixpkgs" + ], + "pre-commit-hooks": "pre-commit-hooks" + }, + "locked": { + "lastModified": 1712517143, + "narHash": "sha256-fC+spgEJpRBvLzTLiqOVBhcIHVWZWqQfxAG1aM2calo=", + "owner": "nix-community", + "repo": "nixvim", + "rev": "0d85838d204d0f3d1cda22059d3fed0cd757d0ab", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nixvim", + "type": "github" + } + }, + "nur": { + "locked": { + "lastModified": 1712577859, + "narHash": "sha256-Dj/v0G964gStuJQ4AZlU/BXhfUbboCeegfPEGOM0x9c=", + "owner": "nix-community", + "repo": "NUR", + "rev": "47a8f374c33c567f9b0c63f6a953f38e3b6eb921", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "NUR", + "type": "github" + } + }, + "pre-commit-hooks": { + "inputs": { + "flake-compat": "flake-compat_3", + "flake-utils": "flake-utils_5", + "gitignore": "gitignore", + "nixpkgs": [ + "nixvim", + "nixpkgs" + ], + "nixpkgs-stable": [ + "nixvim", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1711760932, + "narHash": "sha256-DqUTQ2iAAqSDwMhKBqvi24v0Oc7pD3LCK/0FCG//TdA=", + "owner": "cachix", + "repo": "pre-commit-hooks.nix", + "rev": "c11e43aed6f17336c25cd120eac886b96c455731", + "type": "github" + }, + "original": { + "owner": "cachix", + "repo": "pre-commit-hooks.nix", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-parts": "flake-parts", + "flake-utils": "flake-utils", + "home-manager": "home-manager", + "neovim-nightly-overlay": "neovim-nightly-overlay", + "nix-colors": "nix-colors", + "nixgl": "nixgl", + "nixpkgs": "nixpkgs", + "nixvim": "nixvim", + "nur": "nur", + "systems": "systems_4" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "systems_2": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "systems_3": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "systems_4": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..9978b28 --- /dev/null +++ b/flake.nix @@ -0,0 +1,138 @@ +{ + description = "My Nix Configs"; + + outputs = { + self, + nixpkgs, + flake-utils, + ... + }: let + inherit (self) inputs outputs; + + flakeLib = import ./lib; + + vars = rec { + name = "Patrick Neff"; + username = "odie"; + homeDirectory = "/home/${username}"; + locale = "de_DE.UTF-8"; + email = "odie86@gmail.com"; + timeZone = "Europe/Berlin"; + sshKeys = [ + "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIByWNNmKhjVk5VEjk3aSKosOXzglCbiq7q8IQ8mA0qQe odie" + "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIA1QZO6fF2RLcmjMKdG1eZi0RLw3joa+VBXaKvfmA7Tg odie" + "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAINs89u4Kvwlmq67eV+H/n+x9M8gsKDxQU+dCPSEb2vJe odie" + ]; + domain = "odie.intranet"; + }; + in + { + nixosModules = { + base = import ./modules/nixos/base; + desktop = import ./modules/nixos/desktop; + wsl = import ./modules/nixos/wsl; + }; + nixosConfigurations = + flakeLib.mkSystem { + inherit inputs nixpkgs vars; + system = "x86_64-linux"; + hostName = "vm"; + } + // flakeLib.mkSystem { + inherit inputs nixpkgs vars; + system = "x86_64-linux"; + hostName = "wsl-dev"; + } + // flakeLib.mkSystem { + inherit inputs nixpkgs vars; + system = "aarch64-linux"; + hostName = "pi1"; + } + // {}; + homeManagerModules = { + base = import ./modules/home-manager/base.nix; + desktop = import ./modules/home-manager/desktop.nix; + shell = import ./modules/home-manager/shell.nix; + dev = import ./modules/home-manager/dev.nix; + }; + homeConfigurations = { + "odie@wanaheim" = flakeLib.mkHomeConfiguration { + inherit inputs outputs nixpkgs flakeLib vars; + profile = ./profiles/home-manager/desktop-dev.nix; + system = "x86_64-linux"; + modules = [ + { + desktop = { + enable = true; + awesome = { + enable = true; + wifi_device = "'wlp3s0'"; + battery_device = "'BAT0'"; + }; + }; + services.picom.enable = false; + programs.rofi.enable = true; + } + ]; + }; + "odie@asgard" = flakeLib.mkHomeConfiguration { + inherit inputs outputs nixpkgs flakeLib vars; + profile = ./profiles/home-manager/desktop-dev.nix; + system = "x86_64-linux"; + modules = [ + { + desktop = { + enable = true; + awesome = { + enable = false; + }; + }; + programs = { + firefox.enable = false; + keepassxc.enable = false; + }; + services.nixGL.enable = true; + services.borgmatic.enable = true; + theme.cursor.enable = false; + theme.gtk.enable = false; + } + ]; + }; + }; + } + // flake-utils.lib.eachDefaultSystem (system: { + packages = { + neovim-ide = import ./pkgs/nixvim {inherit inputs system flakeLib nixpkgs;}; + }; + }); + + inputs = { + #nixpkgs.url = "github:nixos/nixpkgs/nixos-23.11"; + #nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable"; + nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; + nur.url = "github:nix-community/NUR"; + nix-colors.url = "github:misterio77/nix-colors"; + systems.url = "github:nix-systems/default"; + flake-parts.url = "github:hercules-ci/flake-parts"; + home-manager = { + url = "github:nix-community/home-manager"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + nixgl = { + url = "github:nix-community/nixGL/9b4887dbf16933bdc124296434b3898d810b3608"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + nixvim = { + url = "github:nix-community/nixvim"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + neovim-nightly-overlay = { + url = "github:nix-community/neovim-nightly-overlay"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + flake-utils = { + url = "github:numtide/flake-utils"; + inputs.systems.follows = "systems"; + }; + }; +} diff --git a/hosts/pi0.odie.intranet/configuration.nix b/hosts/pi0.odie.intranet/configuration.nix new file mode 100644 index 0000000..3986cbb --- /dev/null +++ b/hosts/pi0.odie.intranet/configuration.nix @@ -0,0 +1,6 @@ +{outputs, ...}: { + imports = [ + ./hardware-configuration.nix + outputs.nixosModules.base + ]; +} diff --git a/hosts/pi0.odie.intranet/hardware-configuration.nix b/hosts/pi0.odie.intranet/hardware-configuration.nix new file mode 100644 index 0000000..30a0f17 --- /dev/null +++ b/hosts/pi0.odie.intranet/hardware-configuration.nix @@ -0,0 +1,45 @@ +{ lib, pkgs, ... }: { + boot = { + loader.grub.enable = false; + loader.generic-extlinux-compatible.enable = true; + kernelPackages = pkgs.linuxPackages_rpi4; + kernelParams = [ "snd_bcm2835.enable_headphones=1" "snd_bcm2835.enable_hdmi=1" ]; + initrd.availableKernelModules = lib.mkDefault [ + "vc4" + "bcm2835_dma" + "i2c_bcm2835" + + "xhci_pci" + "usbhid" + "usb_storage" + ]; + }; + + swapDevices = [{ + device = "/var/lib/swapfile"; + size = 4 * 1024; + }]; + + fileSystems = { + "/" = { + device = "/dev/disk/by-label/NIXOS_SD"; + fsType = "ext4"; + options = [ "noatime" ]; + }; + }; + + hardware = { + raspberry-pi = { + enable = true; + cec.enable = true; + "4" = { + apply-overlays-dtmerge.enable = true; + fkms-3d.enable = true; + }; + enableRedistributableFirmware = true; + }; + }; + system.stateVersion = "23.11"; + + nixpkgs.hostPlatform.system = "aarch64-linux"; +} diff --git a/hosts/pi0.odie.intranet/home.nix b/hosts/pi0.odie.intranet/home.nix new file mode 100644 index 0000000..f826fac --- /dev/null +++ b/hosts/pi0.odie.intranet/home.nix @@ -0,0 +1,6 @@ +{ inputs, ... }: { + imports = [ + inputs.home-manager-flake.homeModules.base + inputs.home-manager-flake.homeModules.shell + ]; +} diff --git a/hosts/vm/configuration.nix b/hosts/vm/configuration.nix new file mode 100644 index 0000000..55c6a33 --- /dev/null +++ b/hosts/vm/configuration.nix @@ -0,0 +1,45 @@ +{ + nixpkgs, + vars, + outputs, + inputs, + flakeLib, + system, + profile, + modules ? [], + ... +}: { + imports = [ + ./hardware-configuration.nix + inputs.home-manager.nixosModules.default + outputs.nixosModules.base + outputs.nixosModules.wsl + outputs.nixosModules.desktop + ]; + + networking = { + inherit (vars) hostName domain; + }; + + home-manager = { + useGlobalPkgs = true; + useUserPackages = true; + user.${vars.userName} = flakeLib.mkHomeConfiguration { + inherit nixpkgs vars outputs inputs flakeLib system profile modules; + }; + }; + + boot.loader.systemd-boot.enable = true; + + desktop.enable = true; + desktop.awesome.enable = true; + + services = { + openssh.enable = true; + qemuGuest.enable = true; + spice-vdagentd.enable = true; + spice-autorandr.enable = true; + }; + + system.stateVersion = "23.11"; +} diff --git a/hosts/vm/hardware-configuration.nix b/hosts/vm/hardware-configuration.nix new file mode 100644 index 0000000..d863052 --- /dev/null +++ b/hosts/vm/hardware-configuration.nix @@ -0,0 +1,52 @@ +# Do not modify this file! It was generated by ‘nixos-generate-config’ +# and may be overwritten by future invocations. Please make changes +# to /etc/nixos/configuration.nix instead. +{ config, lib, pkgs, modulesPath, ... }: + +{ + imports = + [ + (modulesPath + "/profiles/qemu-guest.nix") + ]; + + boot = { + initrd = { + availableKernelModules = [ "ahci" "xhci_pci" "virtio_pci" "sr_mod" "virtio_blk" ]; + kernelModules = [ ]; + }; + kernelModules = [ "kvm-intel" ]; + extraModulePackages = [ ]; + }; + + fileSystems."/" = + { + device = "/dev/disk/by-label/nixos"; + fsType = "ext4"; + }; + + fileSystems."/boot" = + { + device = "/dev/disk/by-label/boot"; + fsType = "vfat"; + options = [ + "uid=0" + "gid=0" + "fmask=0077" + "dmask=0077" + "defaults" + ]; + }; + + swapDevices = [ + { device = "/dev/disk/by-label/swap"; } + ]; + + # Enables DHCP on each ethernet and wireless interface. In case of scripted networking + # (the default) this is the recommended approach. When using systemd-networkd it's + # still possible to use this option, but it's recommended to use it in conjunction + # with explicit per-interface declarations with `networking.interfaces..useDHCP`. + networking.useDHCP = lib.mkDefault true; + # networking.interfaces.enp1s0.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; +} diff --git a/hosts/wsl-dev/configuration.nix b/hosts/wsl-dev/configuration.nix new file mode 100644 index 0000000..ea89072 --- /dev/null +++ b/hosts/wsl-dev/configuration.nix @@ -0,0 +1,14 @@ +{outputs, vars, ...}: { + imports = [ + outputs.nixosModules.base + outputs.nixosModules.wsl + ]; + + wsl.enable = true; + + networking = { + inherit (vars) hostName domain; + }; + + system.stateVersion = "23.11"; +} diff --git a/lib/default.nix b/lib/default.nix new file mode 100644 index 0000000..097f90b --- /dev/null +++ b/lib/default.nix @@ -0,0 +1,8 @@ +{ + mkPkgs = import ./mkPkgs.nix; + mkNixVim = import ./mkNixVim.nix; + mkNixVimLib = import ./mkNixVimLib.nix; + mkNixVimModule = import ./mkNixVimModule.nix; + mkSystem = import ./mkSystem.nix; + mkHomeConfiguration = import ./mkHomeConfiguration.nix; +} diff --git a/lib/mkHomeConfiguration.nix b/lib/mkHomeConfiguration.nix new file mode 100644 index 0000000..04692d8 --- /dev/null +++ b/lib/mkHomeConfiguration.nix @@ -0,0 +1,28 @@ +{ + nixpkgs, + inputs, + outputs, + flakeLib, + vars, + system, + profile, + modules ? [], + ... +}: let + overlays = [ + inputs.nixvim.overlays.default + inputs.neovim-nightly-overlay.overlays.default + inputs.nur.overlay + inputs.nixgl.overlay + ]; +in + import profile { + inherit inputs outputs modules; + extraSpecialArgs = { + inherit inputs outputs vars flakeLib; + inherit (inputs) nix-colors; + }; + pkgs = flakeLib.mkPkgs { + inherit nixpkgs system overlays; + }; + } diff --git a/lib/mkNixVim.nix b/lib/mkNixVim.nix new file mode 100644 index 0000000..a060359 --- /dev/null +++ b/lib/mkNixVim.nix @@ -0,0 +1,10 @@ +{ + system, + module, + inputs, + ... +}: let + nixvim' = inputs.nixvim.legacyPackages.${system}; + nvim = nixvim'.makeNixvimWithModule module; +in + nvim diff --git a/lib/mkNixVimLib.nix b/lib/mkNixVimLib.nix new file mode 100644 index 0000000..1c79704 --- /dev/null +++ b/lib/mkNixVimLib.nix @@ -0,0 +1,11 @@ +let + mkNixVimLib = { + inputs, + system, + ... + }: let + nixvimLib = inputs.nixvim.lib.${system}; + in + nixvimLib; +in + mkNixVimLib diff --git a/lib/mkNixVimModule.nix b/lib/mkNixVimModule.nix new file mode 100644 index 0000000..897e923 --- /dev/null +++ b/lib/mkNixVimModule.nix @@ -0,0 +1,8 @@ +{ + pkgs, + module, + extraSpecialArgs ? {}, + ... +}: { + inherit pkgs module extraSpecialArgs; +} diff --git a/lib/mkPkgs.nix b/lib/mkPkgs.nix new file mode 100644 index 0000000..2ec408a --- /dev/null +++ b/lib/mkPkgs.nix @@ -0,0 +1,10 @@ +{ + nixpkgs, + system, + overlays ? [], + ... +}: +import nixpkgs { + inherit system overlays; + config.allowUnfree = true; +} diff --git a/lib/mkSystem.nix b/lib/mkSystem.nix new file mode 100644 index 0000000..262abda --- /dev/null +++ b/lib/mkSystem.nix @@ -0,0 +1,23 @@ +{ + inputs, + system, + hostName, + nixpkgs, + vars, + ... +}: { + ${hostName} = nixpkgs.lib.nixosSystem { + inherit system; + specialArgs = { + inherit inputs; + vars = + vars + // { + inherit hostName; + }; + }; + modules = [ + ./hosts/${hostName}/configuration.nix + ]; + }; +} diff --git a/modules/home-manager/base.nix b/modules/home-manager/base.nix new file mode 100644 index 0000000..0e609ef --- /dev/null +++ b/modules/home-manager/base.nix @@ -0,0 +1,17 @@ +{ lib, vars, ... }: with lib; { + home = { + inherit (vars) username homeDirectory; + language.base = vars.locale; + stateVersion = "23.05"; + }; + + programs.home-manager.enable = true; + + news = { + display = "silent"; + json = mkForce { }; + entries = mkForce [ ]; + }; + + nixpkgs.config.allowUnfree = true; +} diff --git a/modules/home-manager/desktop.nix b/modules/home-manager/desktop.nix new file mode 100644 index 0000000..03e8512 --- /dev/null +++ b/modules/home-manager/desktop.nix @@ -0,0 +1,14 @@ +{ lib, ... }: with lib; { + imports = [ + ./desktop + ./mpd + ]; + + desktop.enable = mkDefault true; + + news = { + display = "silent"; + json = mkForce { }; + entries = mkForce [ ]; + }; +} diff --git a/modules/home-manager/desktop/awesome/awesomewm.nix b/modules/home-manager/desktop/awesome/awesomewm.nix new file mode 100644 index 0000000..cc5b57b --- /dev/null +++ b/modules/home-manager/desktop/awesome/awesomewm.nix @@ -0,0 +1,87 @@ +args @ { + pkgs, + lib, + config, + ... +}: +lib.mkIf config.desktop.awesome.enable { + home = { + packages = with pkgs; [ + mate.mate-polkit + ]; + sessionVariables = { + QT_QPA_PLATFORMTHEME = "qt5ct"; + }; + file = { + awesomewm-rc = { + target = ".config/awesome/rc.lua"; + text = import ./config/rc.nix args; + }; + awesomewm-theme = { + target = ".config/awesome/theme.lua"; + text = import ./config/theme.nix args; + }; + xinitrc = { + target = ".xinitrc"; + text = '' + #!/bin/sh + + userresources=$HOME/.Xresources + usermodmap=$HOME/.Xmodmap + sysresources=/etc/X11/xinit/.Xresources + sysmodmap=/etc/X11/xinit/.Xmodmap + + # merge in defaults and keymaps + + if [ -f $sysresources ]; then + xrdb -merge $sysresources + + fi + + if [ -f $sysmodmap ]; then + xmodmap $sysmodmap + fi + + if [ -f "$userresources" ]; then + xrdb -merge "$userresources" + + fi + + if [ -f "$usermodmap" ]; then + xmodmap "$usermodmap" + fi + + darkman dark + ${pkgs.mate.mate-polkit}/libexec/polkit-mate-authentication-agent-1 & + + if test -z "$DBUS_SESSION_BUS_ADDRESS"; then + eval $(dbus-launch --exit-with-session --sh-syntax) + fi + systemctl --user import-environment DISPLAY XAUTHORITY + + if command -v dbus-update-activation-environment >/dev/null 2>&1; then + dbus-update-activation-environment DISPLAY XAUTHORITY + fi + + exec awesome --search ${pkgs.luaPackages.vicious}/lib/lua/5.2 + ''; + executable = true; + }; + }; + }; + + xsession = { + enable = true; + command = "awesome"; + windowManager.awesome = { + package = pkgs.awesome.override { + lua = pkgs.luajit; + }; + enable = true; + luaModules = with pkgs.luaPackages; [ + luarocks + vicious + ]; + }; + }; +} diff --git a/modules/home-manager/desktop/awesome/config/rc.nix b/modules/home-manager/desktop/awesome/config/rc.nix new file mode 100644 index 0000000..91cb56e --- /dev/null +++ b/modules/home-manager/desktop/awesome/config/rc.nix @@ -0,0 +1,625 @@ +{ config, pkgs, ... }: +'' + os.setlocale(os.getenv("LANG")) + + pcall(require, "luarocks.loader") + + local gears = require("gears") + local awful = require("awful") + require("awful.autofocus") + local wibox = require("wibox") + local beautiful = require("beautiful") + local naughty = require("naughty") + local hotkeys_popup = require("awful.hotkeys_popup") + require("awful.hotkeys_popup.keys") + local vicious = require("vicious") + + -- {{{ Error handling + if awesome.startup_errors then + naughty.notify({ + preset = naughty.config.presets.critical, + title = "Oops, there were errors during startup!", + text = awesome.startup_errors, + }) + end + do + local in_error = false + awesome.connect_signal("debug::error", function(err) + if in_error then + return + end + in_error = true + + naughty.notify({ + preset = naughty.config.presets.critical, + title = "Oops, an error happened!", + text = tostring(err), + }) + in_error = false + end) + end + -- }}} + + -- {{{ Variable definitions + + local terminal = "${config.desktop.terminal}" + local file_manager = "${config.desktop.fileManager}" + local browser = "${config.desktop.browser}" + local launcher = "${pkgs.rofi}/bin/rofi -show drun" + + local modkey = "Mod4" + + local layouts = { + awful.layout.suit.spiral.dwindle, + awful.layout.suit.tile, + awful.layout.suit.floating, + } + local clock_format = "%A %d.%m.%Y %H:%M" + local wallpaper = os.getenv("HOME") .. "/.wallpaper.jpg" + local wifi_interface = ${config.desktop.awesome.wifi_device} + local bat_device = ${config.desktop.awesome.battery_device} + + beautiful.init(os.getenv("HOME") .. "/.config/awesome/theme.lua") + beautiful.wallpaper = wallpaper + + local tags = { "", "", "", "", "", "", "", "󰮂", "󰓓" } + + awful.layout.layouts = layouts + -- }}} + + -- {{{ Bar + -- Create a launcher widget and a main menu + local mytextclock = wibox.widget.textclock(" " .. clock_format) + + -- Create a wibox for each screen and add it + local taglist_buttons = gears.table.join( + awful.button({}, 1, function(t) + t:view_only() + end), + awful.button({ modkey }, 1, function(t) + if client.focus then + client.focus:move_to_tag(t) + end + end), + awful.button({}, 3, awful.tag.viewtoggle), + awful.button({ modkey }, 3, function(t) + if client.focus then + client.focus:toggle_tag(t) + end + end), + awful.button({}, 4, function(t) + awful.tag.viewnext(t.screen) + end), + awful.button({}, 5, function(t) + awful.tag.viewprev(t.screen) + end) + ) + + local tasklist_buttons = gears.table.join( + awful.button({}, 1, function(c) + if c == client.focus then + c.minimized = true + else + c:emit_signal("request::activate", "tasklist", { raise = true }) + end + end), + awful.button({}, 3, function() + awful.menu.client_list({ theme = { width = 250 } }) + end), + awful.button({}, 4, function() + awful.client.focus.byidx(1) + end), + awful.button({}, 5, function() + awful.client.focus.byidx(-1) + end) + ) + + local function set_wallpaper(s) + -- Wallpaper + if beautiful.wallpaper then + local _wallpaper = beautiful.wallpaper + -- If wallpaper is a function, call it with the screen + if type(_wallpaper) == "function" then + _wallpaper = wallpaper(s) + end + gears.wallpaper.maximized(_wallpaper, s, true) + end + end + + -- Re-set wallpaper when a screen's geometry changes (e.g. different resolution) + screen.connect_signal("property::geometry", set_wallpaper) + + awful.screen.connect_for_each_screen(function(s) + -- Wallpaper + set_wallpaper(s) + + -- Each screen has its own tag table. + --awful.tag({ " 1 ", " 2 ", " 3 ", " 4 ", " 5 ", " 6 ", " 7 ", " 8 ", " 9 " }, s, awful.layout.layouts[1]) + awful.tag(tags, s, awful.layout.layouts[1]) + + local cpuwidget = wibox.widget.textbox() + vicious.cache(vicious.widgets.cpu) + vicious.register(cpuwidget, vicious.widgets.cpu, " $1% ", 5) + + local memwidget = wibox.widget.textbox() + vicious.cache(vicious.widgets.mem) + vicious.register(memwidget, vicious.widgets.mem, " 󰍛 $1% ", 5) + + local volwidget = wibox.widget.textbox() + vicious.cache(vicious.widgets.volume) + vicious.register(volwidget, vicious.widgets.volume, "  $1% ", 1, { "Master", "-D", "pipewire" }) + + local wifiwidget = nil + if wifi_interface ~= nil then + wifiwidget = wibox.widget.textbox() + vicious.cache(vicious.widgets.wifiiw) + vicious.register(wifiwidget, vicious.widgets.wifiiw, " 󰖩 ''${linp}% ", 30, wifi_interface) + end + + local batwidget = nil + if bat_device ~= nil then + batwidget = wibox.widget.textbox() + vicious.cache(vicious.widgets.bat) + vicious.register(batwidget, vicious.widgets.bat, " 󰁹 $2% ", 60, bat_device) + end + + local mylayoutbox = awful.widget.layoutbox(s) + mylayoutbox:buttons(gears.table.join( + awful.button({}, 1, function() + awful.layout.inc(1) + end), + awful.button({}, 3, function() + awful.layout.inc(-1) + end), + awful.button({}, 4, function() + awful.layout.inc(1) + end), + awful.button({}, 5, function() + awful.layout.inc(-1) + end) + )) + -- Create a taglist widget + local mytaglist = awful.widget.taglist({ + screen = s, + filter = awful.widget.taglist.filter.noempty, + buttons = taglist_buttons, + }) + + -- Create a tasklist widget + local mytasklist = awful.widget.tasklist({ + screen = s, + filter = awful.widget.tasklist.filter.currenttags, + buttons = tasklist_buttons, + }) + + -- Create the wibox + local mywibox = awful.wibar({ position = "top", screen = s, height = 20 }) + + -- Add widgets to the wibox + mywibox:setup({ + layout = wibox.layout.align.horizontal, + { -- Left widgets + layout = wibox.layout.fixed.horizontal, + spacing = 6, + mytaglist, + }, + mytasklist, -- Middle widget + { -- Right widgets + layout = wibox.layout.fixed.horizontal, + spacing = 6, + batwidget, + wifiwidget, + volwidget, + cpuwidget, + memwidget, + mytextclock, + wibox.widget.systray(), + mylayoutbox, + }, + }) + end) + -- }}} + + -- {{{ Mouse bindings + root.buttons(gears.table.join(awful.button({}, 4, awful.tag.viewnext), awful.button({}, 5, awful.tag.viewprev))) + -- }}} + + -- {{{ Key bindings + local globalkeys = gears.table.join( + awful.key({ modkey }, "s", hotkeys_popup.show_help, { description = "show help", group = "awesome" }), + awful.key({ modkey }, "Left", awful.tag.viewprev, { description = "view previous", group = "tag" }), + awful.key({ modkey }, "Right", awful.tag.viewnext, { description = "view next", group = "tag" }), + awful.key({ modkey }, "Escape", awful.tag.history.restore, { description = "go back", group = "tag" }), + awful.key({ modkey }, "j", function() + awful.client.focus.byidx(1) + end, { description = "focus next by index", group = "client" }), + awful.key({ modkey }, "k", function() + awful.client.focus.byidx(-1) + end, { description = "focus previous by index", group = "client" }), + + -- Layout manipulation + awful.key({ modkey, "Shift" }, "j", function() + awful.client.swap.byidx(1) + end, { description = "swap with next client by index", group = "client" }), + awful.key({ modkey, "Shift" }, "k", function() + awful.client.swap.byidx(-1) + end, { description = "swap with previous client by index", group = "client" }), + awful.key({ modkey, "Control" }, "j", function() + awful.screen.focus_relative(1) + end, { description = "focus the next screen", group = "screen" }), + awful.key({ modkey, "Control" }, "k", function() + awful.screen.focus_relative(-1) + end, { description = "focus the previous screen", group = "screen" }), + awful.key({ modkey }, "u", awful.client.urgent.jumpto, { description = "jump to urgent client", group = "client" }), + awful.key({ modkey }, "Tab", function() + awful.client.focus.history.previous() + if client.focus then + client.focus:raise() + end + end, { description = "go back", group = "client" }), + + -- Standard program + awful.key({ modkey }, "Return", function() + awful.spawn(terminal) + end, { description = "open a terminal", group = "launcher" }), + awful.key({ modkey, "Shift" }, "x", function() awful.spawn("rofi -show p -modi p:rofi-power-menu") end, { description = "power menu", group = "launcher" }), + awful.key({ modkey, "Control" }, "r", awesome.restart, { description = "reload awesome", group = "awesome" }), + awful.key({ modkey, "Control" }, "x", awesome.quit, { description = "quit awesome", group = "awesome" }), + awful.key({ modkey }, "l", function() + awful.tag.incmwfact(0.05) + end, { description = "increase master width factor", group = "layout" }), + awful.key({ modkey }, "h", function() + awful.tag.incmwfact(-0.05) + end, { description = "decrease master width factor", group = "layout" }), + awful.key({ modkey, "Shift" }, "h", function() + awful.tag.incnmaster(1, nil, true) + end, { description = "increase the number of master clients", group = "layout" }), + awful.key({ modkey, "Shift" }, "l", function() + awful.tag.incnmaster(-1, nil, true) + end, { description = "decrease the number of master clients", group = "layout" }), + awful.key({ modkey, "Control" }, "h", function() + awful.tag.incncol(1, nil, true) + end, { description = "increase the number of columns", group = "layout" }), + awful.key({ modkey, "Control" }, "l", function() + awful.tag.incncol(-1, nil, true) + end, { description = "decrease the number of columns", group = "layout" }), + awful.key({ modkey }, "space", function() + awful.layout.inc(1) + end, { description = "select next", group = "layout" }), + awful.key({ modkey, "Shift" }, "space", function() + awful.layout.inc(-1) + end, { description = "select previous", group = "layout" }), + + awful.key({ modkey, "Control" }, "n", function() + local c = awful.client.restore() + -- Focus restored client + if c then + c:emit_signal("request::activate", "key.unminimize", { raise = true }) + end + end, { description = "restore minimized", group = "client" }), + + -- Prompt + awful.key({ modkey }, "r", function() + awful.spawn(launcher) + end, { description = "run launcher", group = "launcher" }), + awful.key({ modkey }, "w", function() + awful.spawn(browser) + end, { description = "run firefox", group = "launcher" }), + awful.key({ modkey }, "e", function() + awful.spawn(file_manager) + end, { description = "run file manager", group = "launcher" }), + + -- Volume Keys + awful.key({}, "XF86AudioLowerVolume", function() + awful.util.spawn("amixer -q -D pipewire sset Master 5%-", false) + end), + awful.key({}, "XF86AudioRaiseVolume", function() + awful.util.spawn("amixer -q -D pipewire sset Master 5%+", false) + end), + awful.key({}, "XF86AudioMute", function() + awful.util.spawn("amixer -D pipewire set Master 1+ toggle", false) + end), + -- Media Keys + awful.key({}, "XF86AudioPlay", function() + awful.util.spawn("playerctl play-pause", false) + end), + awful.key({}, "XF86AudioNext", function() + awful.util.spawn("playerctl next", false) + end), + awful.key({}, "XF86AudioPrev", function() + awful.util.spawn("playerctl previous", false) + end) + ) + + local clientkeys = gears.table.join( + awful.key({ modkey }, "f", function(c) + c.fullscreen = not c.fullscreen + c:raise() + end, { description = "toggle fullscreen", group = "client" }), + awful.key({ modkey, "Shift" }, "q", function(c) + c:kill() + end, { description = "close", group = "client" }), + awful.key({ modkey }, "q", function(c) + c:kill() + end, { description = "close", group = "client" }), + awful.key( + { modkey, "Control" }, + "space", + awful.client.floating.toggle, + { description = "toggle floating", group = "client" } + ), + awful.key({ modkey, "Control" }, "Return", function(c) + c:swap(awful.client.getmaster()) + end, { description = "move to master", group = "client" }), + awful.key({ modkey }, "o", function(c) + c:move_to_screen() + end, { description = "move to screen", group = "client" }), + awful.key({ modkey }, "t", function(c) + c.ontop = not c.ontop + end, { description = "toggle keep on top", group = "client" }), + awful.key({ modkey }, "n", function(c) + -- The client currently has the input focus, so it cannot be + -- minimized, since minimized clients can't have the focus. + c.minimized = true + end, { description = "minimize", group = "client" }), + awful.key({ modkey }, "m", function(c) + c.maximized = not c.maximized + c:raise() + end, { description = "(un)maximize", group = "client" }), + awful.key({ modkey, "Control" }, "m", function(c) + c.maximized_vertical = not c.maximized_vertical + c:raise() + end, { description = "(un)maximize vertically", group = "client" }), + awful.key({ modkey, "Shift" }, "m", function(c) + c.maximized_horizontal = not c.maximized_horizontal + c:raise() + end, { description = "(un)maximize horizontally", group = "client" }) + ) + + -- Bind all key numbers to tags. + -- Be careful: we use keycodes to make it work on any keyboard layout. + -- This should map on the top row of your keyboard, usually 1 to 9. + for i = 1, 9 do + globalkeys = gears.table.join( + globalkeys, + -- View tag only. + awful.key({ modkey }, "#" .. i + 9, function() + local screen = awful.screen.focused() + local tag = screen.tags[i] + if tag then + tag:view_only() + end + end, { description = "view tag #" .. i, group = "tag" }), + -- Toggle tag display. + awful.key({ modkey, "Control" }, "#" .. i + 9, function() + local screen = awful.screen.focused() + local tag = screen.tags[i] + if tag then + awful.tag.viewtoggle(tag) + end + end, { description = "toggle tag #" .. i, group = "tag" }), + -- Move client to tag. + awful.key({ modkey, "Shift" }, "#" .. i + 9, function() + if client.focus then + local tag = client.focus.screen.tags[i] + if tag then + client.focus:move_to_tag(tag) + end + end + end, { description = "move focused client to tag #" .. i, group = "tag" }), + -- Toggle tag on focused client. + awful.key({ modkey, "Control", "Shift" }, "#" .. i + 9, function() + if client.focus then + local tag = client.focus.screen.tags[i] + if tag then + client.focus:toggle_tag(tag) + end + end + end, { description = "toggle focused client on tag #" .. i, group = "tag" }) + ) + end + + local clientbuttons = gears.table.join( + awful.button({}, 1, function(c) + c:emit_signal("request::activate", "mouse_click", { raise = true }) + end), + awful.button({ modkey }, 1, function(c) + c:emit_signal("request::activate", "mouse_click", { raise = true }) + awful.mouse.client.move(c) + end), + awful.button({ modkey }, 3, function(c) + c:emit_signal("request::activate", "mouse_click", { raise = true }) + awful.mouse.client.resize(c) + end) + ) + + -- Set keys + root.keys(globalkeys) + -- }}} + + -- {{{ Rules + -- Rules to apply to new clients (through the "manage" signal). + -- + local function is_terminal(c) + return (c.class and c.class:match("itty")) and true or false + end + + local function copy_size(c, parent_client) + if not c or not parent_client then + return + end + if not c.valid or not parent_client.valid then + return + end + c.x = parent_client.x + c.y = parent_client.y + c.width = parent_client.width + c.height = parent_client.height + end + + local function check_resize_client(c) + if c.child_resize then + copy_size(c.child_resize, c) + end + end + + client.connect_signal("property::size", check_resize_client) + client.connect_signal("property::position", check_resize_client) + client.connect_signal("manage", function(c) + if is_terminal(c) then + return + end + local parent_client = awful.client.focus.history.get(c.screen, 1) + if parent_client and is_terminal(parent_client) then + parent_client.child_resize = c + c.floating = true + copy_size(c, parent_client) + end + end) + -- + awful.rules.rules = { + -- All clients will match this rule. + { + rule = {}, + properties = { + border_width = beautiful.border_width, + border_color = beautiful.border_normal, + focus = awful.client.focus.filter, + raise = true, + keys = clientkeys, + buttons = clientbuttons, + screen = awful.screen.preferred, + placement = awful.placement.no_overlap + awful.placement.no_offscreen, + }, + }, + + -- Floating clients. + { + rule_any = { + instance = { + "DTA", -- Firefox addon DownThemAll. + "copyq", -- Includes session name in class. + "pinentry", + }, + class = { + "Arandr", + "Blueman-manager", + "Gpick", + "Kruler", + "MessageWin", -- kalarm. + "Sxiv", + "Tor Browser", -- Needs a fixed window size to avoid fingerprinting by screen size. + "Wpa_gui", + "veromix", + "xtightvncviewer", + }, + + -- Note that the name property shown in xprop might be set slightly after creation of the client + -- and the name shown there might not match defined rules here. + name = { + "Event Tester", -- xev. + }, + role = { + "AlarmWindow", -- Thunderbird's calendar. + "ConfigManager", -- Thunderbird's about:config. + "pop-up", -- e.g. Google Chrome's (detached) Developer Tools. + }, + }, + properties = { floating = true }, + }, + + -- Add titlebars to normal clients and dialogs + { rule_any = { type = { "normal", "dialog" } }, properties = { titlebars_enabled = false } }, + + -- Set Firefox to always map on the tag named "2" on screen 1. + -- { rule = { class = "Firefox" }, + -- properties = { screen = 1, tag = "2" } }, + { + rule_any = { class = { "steamwebhelper", "steam" } }, + properties = { screen = 1, tag = tags[9] }, + }, + -- Media + { + rule = { + class = "mpv", + }, + properties = { tag = tags[7], fullscreen = true, floating = false, maximized = false }, + }, + -- Games + { + rule_any = { + class = { "steam_app_251730" }, + }, + properties = { screen = 1, tag = tags[8], fullscreen = true, floating = false, maximized = false }, + }, + } + -- }}} + + -- {{{ Signals + -- Signal function to execute when a new client appears. + client.connect_signal("manage", function(c) + -- Set the windows at the slave, + -- i.e. put it at the end of others instead of setting it master. + if not awesome.startup then + awful.client.setslave(c) + end + + if awesome.startup and not c.size_hints.user_position and not c.size_hints.program_position then + -- Prevent clients from being unreachable after screen count changes. + awful.placement.no_offscreen(c) + end + end) + + -- Add a titlebar if titlebars_enabled is set to true in the rules. + client.connect_signal("request::titlebars", function(c) + -- buttons for the titlebar + local buttons = gears.table.join( + awful.button({}, 1, function() + c:emit_signal("request::activate", "titlebar", { raise = true }) + awful.mouse.client.move(c) + end), + awful.button({}, 3, function() + c:emit_signal("request::activate", "titlebar", { raise = true }) + awful.mouse.client.resize(c) + end) + ) + + awful.titlebar(c):setup({ + { -- Left + awful.titlebar.widget.iconwidget(c), + buttons = buttons, + layout = wibox.layout.fixed.horizontal, + }, + { -- Middle + { -- Title + align = "center", + widget = awful.titlebar.widget.titlewidget(c), + }, + buttons = buttons, + layout = wibox.layout.flex.horizontal, + }, + { -- Right + awful.titlebar.widget.floatingbutton(c), + awful.titlebar.widget.maximizedbutton(c), + awful.titlebar.widget.stickybutton(c), + awful.titlebar.widget.ontopbutton(c), + awful.titlebar.widget.closebutton(c), + layout = wibox.layout.fixed.horizontal(), + }, + layout = wibox.layout.align.horizontal, + }) + end) + + -- Enable sloppy focus, so that focus follows mouse. + client.connect_signal("mouse::enter", function(c) + c:emit_signal("request::activate", "mouse_enter", { raise = false }) + end) + + client.connect_signal("focus", function(c) + c.border_color = beautiful.border_focus + end) + client.connect_signal("unfocus", function(c) + c.border_color = beautiful.border_normal + end) + -- }}} +'' diff --git a/modules/home-manager/desktop/awesome/config/theme.nix b/modules/home-manager/desktop/awesome/config/theme.nix new file mode 100644 index 0000000..399b4c4 --- /dev/null +++ b/modules/home-manager/desktop/awesome/config/theme.nix @@ -0,0 +1,134 @@ +{ config, ... }: +'' +--------------------------- +-- Default awesome theme -- +--------------------------- + +local theme_assets = require("beautiful.theme_assets") +local xresources = require("beautiful.xresources") +local dpi = xresources.apply_dpi + +local gfs = require("gears.filesystem") +local themes_path = gfs.get_themes_dir() + +local theme = {} + +theme.font = "monospace 11" +theme.useless_gap = dpi(4) + +theme.border_width = dpi(2) + +theme.fg_normal = "#${config.colorScheme.palette.base05}" +theme.fg_focus = "#${config.colorScheme.palette.base0D}" +theme.fg_urgent = "#${config.colorScheme.palette.base05}" +theme.fg_minimize = "#${config.colorScheme.palette.base05}" +theme.bg_normal = "#${config.colorScheme.palette.base00}" +theme.bg_focus = "#${config.colorScheme.palette.base01}" +theme.bg_urgent = "#${config.colorScheme.palette.base08}" +theme.bg_minimize = "#${config.colorScheme.palette.base00}" +theme.bg_systray = theme.bg_normal + +theme.border_normal = "#${config.colorScheme.palette.base00}" +theme.border_focus = "#${config.colorScheme.palette.base0D}" +theme.border_marked = "#${config.colorScheme.palette.base0B}" + +theme.tasklist_bg_focus = theme.bg_focus +theme.titlebar_bg_focus = theme.bg_focus +theme.titlebar_bg_normal = theme.bg_normal +theme.titlebar_fg_focus = theme.fg_focus + +-- There are other variable sets +-- overriding the default one when +-- defined, the sets are: +-- taglist_[bg|fg]_[focus|urgent|occupied|empty|volatile] +-- tasklist_[bg|fg]_[focus|urgent] +-- titlebar_[bg|fg]_[normal|focus] +-- tooltip_[font|opacity|fg_color|bg_color|border_width|border_color] +-- mouse_finder_[color|timeout|animate_timeout|radius|factor] +-- prompt_[fg|bg|fg_cursor|bg_cursor|font] +-- hotkeys_[bg|fg|border_width|border_color|shape|opacity|modifiers_fg|label_bg|label_fg|group_margin|font| +-- description_font] +-- Example: +--theme.taglist_bg_focus = "#ff0000" + +-- Generate taglist squares: +theme.taglist_spacing = dpi(2) +--local taglist_square_size = dpi(4) +--theme.taglist_squares_sel = theme_assets.taglist_squares_sel(taglist_square_size, theme.fg_normal) +--theme.taglist_squares_unsel = theme_assets.taglist_squares_unsel(taglist_square_size, theme.fg_normal) + +-- Variables set for theming notifications: +-- notification_font +-- notification_[bg|fg] +-- notification_[width|height|margin] +-- notification_[border_color|border_width|shape|opacity] + +-- Variables set for theming the menu: +-- menu_[bg|fg]_[normal|focus] +-- menu_[border_color|border_width] +theme.menu_submenu_icon = themes_path .. "default/submenu.png" +theme.menu_height = dpi(20) +theme.menu_width = dpi(150) + +-- You can add as many variables as +-- you wish and access them by using +-- beautiful.variable in your rc.lua +--theme.bg_widget = "#cc0000" + +-- Define the image to load +theme.titlebar_close_button_normal = themes_path .. "default/titlebar/close_normal.png" +theme.titlebar_close_button_focus = themes_path .. "default/titlebar/close_focus.png" + +theme.titlebar_minimize_button_normal = themes_path .. "default/titlebar/minimize_normal.png" +theme.titlebar_minimize_button_focus = themes_path .. "default/titlebar/minimize_focus.png" + +theme.titlebar_ontop_button_normal_inactive = themes_path .. "default/titlebar/ontop_normal_inactive.png" +theme.titlebar_ontop_button_focus_inactive = themes_path .. "default/titlebar/ontop_focus_inactive.png" +theme.titlebar_ontop_button_normal_active = themes_path .. "default/titlebar/ontop_normal_active.png" +theme.titlebar_ontop_button_focus_active = themes_path .. "default/titlebar/ontop_focus_active.png" + +theme.titlebar_sticky_button_normal_inactive = themes_path .. "default/titlebar/sticky_normal_inactive.png" +theme.titlebar_sticky_button_focus_inactive = themes_path .. "default/titlebar/sticky_focus_inactive.png" +theme.titlebar_sticky_button_normal_active = themes_path .. "default/titlebar/sticky_normal_active.png" +theme.titlebar_sticky_button_focus_active = themes_path .. "default/titlebar/sticky_focus_active.png" + +theme.titlebar_floating_button_normal_inactive = themes_path .. "default/titlebar/floating_normal_inactive.png" +theme.titlebar_floating_button_focus_inactive = themes_path .. "default/titlebar/floating_focus_inactive.png" +theme.titlebar_floating_button_normal_active = themes_path .. "default/titlebar/floating_normal_active.png" +theme.titlebar_floating_button_focus_active = themes_path .. "default/titlebar/floating_focus_active.png" + +theme.titlebar_maximized_button_normal_inactive = themes_path .. "default/titlebar/maximized_normal_inactive.png" +theme.titlebar_maximized_button_focus_inactive = themes_path .. "default/titlebar/maximized_focus_inactive.png" +theme.titlebar_maximized_button_normal_active = themes_path .. "default/titlebar/maximized_normal_active.png" +theme.titlebar_maximized_button_focus_active = themes_path .. "default/titlebar/maximized_focus_active.png" + +theme.wallpaper = themes_path .. "default/background.png" + +-- You can use your own layout icons like this: +theme.layout_fairh = themes_path .. "default/layouts/fairhw.png" +theme.layout_fairv = themes_path .. "default/layouts/fairvw.png" +theme.layout_floating = themes_path .. "default/layouts/floatingw.png" +theme.layout_magnifier = themes_path .. "default/layouts/magnifierw.png" +theme.layout_max = themes_path .. "default/layouts/maxw.png" +theme.layout_fullscreen = themes_path .. "default/layouts/fullscreenw.png" +theme.layout_tilebottom = themes_path .. "default/layouts/tilebottomw.png" +theme.layout_tileleft = themes_path .. "default/layouts/tileleftw.png" +theme.layout_tile = themes_path .. "default/layouts/tilew.png" +theme.layout_tiletop = themes_path .. "default/layouts/tiletopw.png" +theme.layout_spiral = themes_path .. "default/layouts/spiralw.png" +theme.layout_dwindle = themes_path .. "default/layouts/dwindlew.png" +theme.layout_cornernw = themes_path .. "default/layouts/cornernww.png" +theme.layout_cornerne = themes_path .. "default/layouts/cornernew.png" +theme.layout_cornersw = themes_path .. "default/layouts/cornersww.png" +theme.layout_cornerse = themes_path .. "default/layouts/cornersew.png" + +-- Generate Awesome icon: +theme.awesome_icon = theme_assets.awesome_icon(theme.menu_height, theme.bg_focus, theme.fg_focus) + +-- Define the icon theme for application icons. If not set then the icons +-- from /usr/share/icons and /usr/share/icons/hicolor will be used. +theme.icon_theme = "Papirus-Dark" + +return theme +'' + diff --git a/modules/home-manager/desktop/awesome/default.nix b/modules/home-manager/desktop/awesome/default.nix new file mode 100644 index 0000000..a534625 --- /dev/null +++ b/modules/home-manager/desktop/awesome/default.nix @@ -0,0 +1,22 @@ +{ lib, ... }: { + options = { + desktop = { + awesome = { + enable = lib.mkEnableOption "AwesomeWM"; + wifi_device = lib.mkOption { + type = lib.types.str; + description = "the default launcher to use"; + default = "nil"; + example = "'wlp3s0'"; + }; + battery_device = lib.mkOption { + type = lib.types.str; + description = "the default launcher to use"; + default = "nil"; + example = "'BAT0'"; + }; + }; + }; + }; + imports = [ ./awesomewm.nix ]; +} diff --git a/modules/home-manager/desktop/default.nix b/modules/home-manager/desktop/default.nix new file mode 100644 index 0000000..5c82eba --- /dev/null +++ b/modules/home-manager/desktop/default.nix @@ -0,0 +1,59 @@ +{ + lib, + config, + nix-colors, + ... +}: { + options = { + desktop = { + enable = lib.mkEnableOption "gui"; + terminal = lib.mkOption { + type = lib.types.str; + description = "the default terminal to use"; + default = "kitty"; + }; + fileManager = lib.mkOption { + type = lib.types.str; + description = "the default file_manager to use"; + default = "thunar"; + }; + browser = lib.mkOption { + type = lib.types.str; + description = "the default browser to use"; + default = "firefox"; + }; + launcher = lib.mkOption { + type = lib.types.str; + description = "the default launcher to use"; + default = "rofi -show drun"; + }; + }; + }; + imports = [ + nix-colors.homeManagerModules.default + ./firefox + ./keepassxc + ./kitty + ./nextcloud-client + ./picom + ./nixGL + ./theme + ./awesome + ./rofi + ]; + config = lib.mkIf config.desktop.enable { + desktop.awesome.enable = lib.mkDefault true; + programs = { + keepassxc.enable = lib.mkDefault true; + firefox.enable = lib.mkDefault true; + kitty.enable = lib.mkDefault true; + }; + services = { + nextcloud-client.enable = lib.mkDefault true; + udiskie.enable = lib.mkDefault true; + picom.enable = lib.mkDefault true; + }; + fonts.fontconfig.enable = true; + colorScheme = nix-colors.colorSchemes.catppuccin-mocha; + }; +} diff --git a/modules/home-manager/desktop/firefox/default.nix b/modules/home-manager/desktop/firefox/default.nix new file mode 100644 index 0000000..7e78a02 --- /dev/null +++ b/modules/home-manager/desktop/firefox/default.nix @@ -0,0 +1,40 @@ +{pkgs, config, lib, ...}: lib.mkIf config.programs.firefox.enable { + programs.firefox = { + package = pkgs.firefox.override { + nativeMessagingHosts = with pkgs; [ + tridactyl-native + keepassxc + ]; + }; + profiles.odie = { + isDefault = true; + id = 0; + name = "odie"; + search = { + default = "DuckDuckGo"; + force = true; + }; + extensions = with pkgs.nur.repos.rycee.firefox-addons; [ + adnauseam + istilldontcareaboutcookies + sponsorblock + stylus + keepassxc-browser + tridactyl + canvasblocker + deutsch-de-language-pack + greasemonkey + youtube-recommended-videos # unhook + return-youtube-dislikes + user-agent-string-switcher + ]; + settings = { + "browser.startup.homepage" = "https://duckduckgo.com"; + "browser.search.region" = "DE"; + "browser.search.isUS" = false; + "distribution.searchplugins.defaultLocale" = "de-DE"; + "general.useragent.locale" = "de-DE"; + }; + }; + }; +} diff --git a/modules/home-manager/desktop/keepassxc/default.nix b/modules/home-manager/desktop/keepassxc/default.nix new file mode 100644 index 0000000..83b81c8 --- /dev/null +++ b/modules/home-manager/desktop/keepassxc/default.nix @@ -0,0 +1,10 @@ +{ pkgs, lib, config, ... }: { + options = { + programs.keepassxc.enable = lib.mkEnableOption "keepassxc"; + }; + config = lib.mkIf config.programs.keepassxc.enable { + home.packages = [ + pkgs.keepassxc + ]; + }; +} diff --git a/modules/home-manager/desktop/kitty/default.nix b/modules/home-manager/desktop/kitty/default.nix new file mode 100644 index 0000000..5454fbd --- /dev/null +++ b/modules/home-manager/desktop/kitty/default.nix @@ -0,0 +1,24 @@ +{ + pkgs, + config, + lib, + ... +}: { + config = lib.mkIf config.programs.kitty.enable { + programs.kitty = { + font = { + name = "JetBrains Mono"; + size = 10; + }; + shellIntegration.enableZshIntegration = true; + settings = { + background_opacity = 1; + enable_audio_bell = "no"; + visual_bell_duration = "0.025"; + window_padding_width = 0; + symbol_map = "U+E5FA-U+E62B,U+E700-U+E7C5,U+F000-U+F2E0,U+E200-U+E2A9,U+F500-U+FD46,U+E300-U+E3EB,U+F400-U+F4A8,U+2665,U+26A1,U+F27C,U+E0A3,U+E0B4-U+E0C8,U+E0CA,U+E0CC-U+E0D2,U+E0D4,U+23FB-U+23FE,U+2B58,U+F300-U+F313,U+E000-U+E00D Symbols Nerd Font Mono"; + }; + theme = "Catppuccin-Mocha"; + }; + }; +} diff --git a/modules/home-manager/desktop/nextcloud-client/default.nix b/modules/home-manager/desktop/nextcloud-client/default.nix new file mode 100644 index 0000000..4d9fc19 --- /dev/null +++ b/modules/home-manager/desktop/nextcloud-client/default.nix @@ -0,0 +1,5 @@ +{lib,config,...}: lib.mkIf config.services.nextcloud-client.enable { + services.nextcloud-client = { + startInBackground = true; + }; +} diff --git a/modules/home-manager/desktop/nixGL/default.nix b/modules/home-manager/desktop/nixGL/default.nix new file mode 100644 index 0000000..f2a7726 --- /dev/null +++ b/modules/home-manager/desktop/nixGL/default.nix @@ -0,0 +1,12 @@ +{ pkgs, lib, config, ... }: { + options = { + services.nixGL.enable = lib.mkEnableOption "nixGL"; + }; + config = lib.mkIf config.services.nixGL.enable { + home.packages = with pkgs; [ + nixgl.auto.nixGLDefault + nixgl.auto.nixGLNvidia + nixgl.auto.nixVulkanNvidia + ]; + }; +} diff --git a/modules/home-manager/desktop/picom/default.nix b/modules/home-manager/desktop/picom/default.nix new file mode 100644 index 0000000..850282c --- /dev/null +++ b/modules/home-manager/desktop/picom/default.nix @@ -0,0 +1,38 @@ +{ config, lib, ... }: { + options = { + services = { + picom = { + glxBackend = lib.mkOption { + type = lib.types.str; + description = "the default terminal to use"; + default = "glx"; + }; + }; + }; + }; + config = { + services.picom = lib.mkIf config.services.picom.enable { + backend = config.services.picom.glxBackend; + fade = true; + opacityRules = [ + "95:class_g = 'kitty' && focused" + "85:class_g = 'kitty' && !focused" + "95:class_g = 'Alacritty' && focused" + "85:class_g = 'Alacritty' && !focused" + "85:window_type = 'dock'" + ]; + settings = { + blur = { + method = "gaussian"; + size = 10; + deviation = 5.0; + }; + corner-radius = 6; + rounded-corners-exclude = [ + "window_type = 'dock'" + "window_type = 'desktop'" + ]; + }; + }; + }; +} diff --git a/modules/home-manager/desktop/rofi/default.nix b/modules/home-manager/desktop/rofi/default.nix new file mode 100644 index 0000000..b4b013f --- /dev/null +++ b/modules/home-manager/desktop/rofi/default.nix @@ -0,0 +1,140 @@ +{ + pkgs, + config, + lib, + ... +}: lib.mkIf config.programs.rofi.enable { + home.packages = with pkgs; [ + rofi-power-menu + rofimoji + ]; + + programs.rofi = { + extraConfig = { + modi = "run,drun,window"; + icon-theme = "Papirus-Dark"; + show-icons = true; + drun-display-format = "{icon} {name}"; + hide-scrollbar = true; + display-drun = "  Apps "; + display-run = "  Run "; + display-window = " 﩯 Window"; + display-Network = " 󰤨 Network"; + }; + theme = let + inherit (config.lib.formats.rasi) mkLiteral; + in { + "*" = { + bg-col = mkLiteral "#1e1e2e"; + bg-col-light = mkLiteral "#1e1e2e"; + border-col = mkLiteral "#1e1e2e"; + selected-col = mkLiteral "#1e1e2e"; + blue = mkLiteral "#89b4fa"; + fg-col = mkLiteral "#cdd6f4"; + fg-col2 = mkLiteral "#f38ba8"; + grey = mkLiteral "#6c7086"; + + width = 600; + font = "JetBrainsMono 11"; + }; + + "element-text, element-icon, mode-switcher" = { + background-color = mkLiteral "inherit"; + text-color = mkLiteral "inherit"; + }; + + window = { + height = mkLiteral "360px"; + border = mkLiteral "3px"; + border-color = mkLiteral "@border-col"; + background-color = mkLiteral "@bg-col"; + }; + + mainbox = { + background-color = mkLiteral "@bg-col"; + }; + + inputbar = { + children = mkLiteral "[prompt,entry]"; + background-color = mkLiteral "@bg-col"; + border-radius = mkLiteral "5px"; + padding = mkLiteral "2px"; + }; + + prompt = { + background-color = mkLiteral "@blue"; + padding = mkLiteral "6px"; + text-color = mkLiteral "@bg-col"; + border-radius = mkLiteral "3px"; + margin = mkLiteral "20px 0px 0px 20px"; + }; + + textbox-prompt-colon = { + expand = false; + str = ":"; + }; + + entry = { + padding = mkLiteral "6px"; + margin = mkLiteral "20px 0px 0px 10px"; + text-color = mkLiteral "@fg-col"; + background-color = mkLiteral "@bg-col"; + }; + + listview = { + border = mkLiteral "0px 0px 0px"; + padding = mkLiteral "6px 0px 0px"; + margin = mkLiteral "10px 0px 0px 20px"; + columns = 2; + lines = 5; + background-color = mkLiteral "@bg-col"; + }; + + element = { + padding = mkLiteral "5px"; + background-color = mkLiteral "@bg-col"; + text-color = mkLiteral "@fg-col"; + }; + + element-icon = { + size = mkLiteral "25px"; + }; + + "element selected" = { + background-color = mkLiteral "@selected-col "; + text-color = mkLiteral "@fg-col2"; + }; + + mode-switcher = { + spacing = 0; + }; + + button = { + padding = mkLiteral "10px"; + background-color = mkLiteral "@bg-col-light"; + text-color = mkLiteral "@grey"; + vertical-align = mkLiteral "0.5"; + horizontal-align = mkLiteral "0.5"; + }; + + "button selected" = { + background-color = mkLiteral "@bg-col"; + text-color = mkLiteral "@blue"; + }; + + message = { + background-color = mkLiteral "@bg-col-light"; + margin = mkLiteral "2px"; + padding = mkLiteral "2px"; + border-radius = mkLiteral "5px"; + }; + + textbox = { + padding = mkLiteral "6px"; + margin = mkLiteral "20px 0px 0px 20px"; + text-color = mkLiteral "@blue"; + background-color = mkLiteral "@bg-col-light"; + }; + }; + }; +} diff --git a/modules/home-manager/desktop/theme/cursor.nix b/modules/home-manager/desktop/theme/cursor.nix new file mode 100644 index 0000000..58e5807 --- /dev/null +++ b/modules/home-manager/desktop/theme/cursor.nix @@ -0,0 +1,31 @@ +{ + pkgs, + config, + lib, + ... +}: { + options = { + theme.cursor.enable = lib.mkEnableOption "Xorg cursor"; + }; + config = lib.mkIf config.theme.cursor.enable { + home = { + pointerCursor = { + name = "Colloid-teal-dark"; + package = pkgs.colloid-icon-theme; + size = 24; + gtk.enable = true; + x11.enable = true; + }; + }; + nixpkgs.config.packageOverrides = pkgs: { + colloid-icon-theme = pkgs.colloid-icon-theme.override { + colorVariants = ["teal"]; + }; + catppuccin-gtk = pkgs.catppuccin-gtk.override { + accents = ["blue"]; # You can specify multiple accents here to output multiple themes + size = "standard"; + variant = "mocha"; + }; + }; + }; +} diff --git a/modules/home-manager/desktop/theme/default.nix b/modules/home-manager/desktop/theme/default.nix new file mode 100644 index 0000000..5554a7d --- /dev/null +++ b/modules/home-manager/desktop/theme/default.nix @@ -0,0 +1,9 @@ +{lib, ...}: { + imports = [ + ./cursor.nix + ./gtk.nix + ]; + + theme.cursor.enable = lib.mkDefault true; + theme.gtk.enable = lib.mkDefault true; +} diff --git a/modules/home-manager/desktop/theme/gtk.nix b/modules/home-manager/desktop/theme/gtk.nix new file mode 100644 index 0000000..23d1def --- /dev/null +++ b/modules/home-manager/desktop/theme/gtk.nix @@ -0,0 +1,27 @@ +{ + pkgs, + config, + lib, + ... +}: { + options = { + theme.gtk.enable = lib.mkEnableOption "Xorg cursor"; + }; + config = lib.mkIf config.theme.gtk.enable { + gtk = { + enable = true; + cursorTheme = { + name = "Colloid-teal-dark"; + package = pkgs.colloid-icon-theme; + }; + iconTheme = { + name = "Papirus-Dark"; + package = pkgs.papirus-icon-theme; + }; + theme = { + name = "Catppuccin-Mocha-Standard-Blue-Dark"; + package = pkgs.catppuccin-gtk; + }; + }; + }; +} diff --git a/modules/home-manager/dev.nix b/modules/home-manager/dev.nix new file mode 100644 index 0000000..4db6d77 --- /dev/null +++ b/modules/home-manager/dev.nix @@ -0,0 +1,5 @@ +_: { + imports = [ + ./development + ]; +} diff --git a/modules/home-manager/development/default.nix b/modules/home-manager/development/default.nix new file mode 100644 index 0000000..8f03e24 --- /dev/null +++ b/modules/home-manager/development/default.nix @@ -0,0 +1,12 @@ +_: { + imports = [ + ./gitea + ./neovim-ide + ]; + + programs = { + lazygit.enable = true; + gitea-cli.enable = true; + neovim-ide.enable = true; + }; +} diff --git a/modules/home-manager/development/gitea/default.nix b/modules/home-manager/development/gitea/default.nix new file mode 100644 index 0000000..3475c07 --- /dev/null +++ b/modules/home-manager/development/gitea/default.nix @@ -0,0 +1,10 @@ +{ lib, pkgs, config, ... }: { + options = { + programs.gitea-cli.enable = lib.mkEnableOption "gitea-cli"; + }; + config = lib.mkIf config.programs.gitea-cli.enable { + home.packages = with pkgs; [ + tea + ]; + }; +} diff --git a/modules/home-manager/development/neovim-ide/default.nix b/modules/home-manager/development/neovim-ide/default.nix new file mode 100644 index 0000000..5311cc2 --- /dev/null +++ b/modules/home-manager/development/neovim-ide/default.nix @@ -0,0 +1,16 @@ +{ + outputs, + pkgs, + config, + lib, + ... +}: { + options = { + programs.neovim-ide.enable = lib.mkEnableOption "neovim-ide"; + }; + config = lib.mkIf config.programs.neovim-ide.enable { + home = { + packages = [outputs.packages.${pkgs.system}.neovim-ide]; + }; + }; +} diff --git a/modules/home-manager/mpd/default.nix b/modules/home-manager/mpd/default.nix new file mode 100644 index 0000000..69c958e --- /dev/null +++ b/modules/home-manager/mpd/default.nix @@ -0,0 +1,13 @@ +{ lib, ... }: { + imports = [ + ./mpd.nix + ./ncmpcpp.nix + ]; + + programs = { + ncmpcpp.enable = lib.mkDefault true; + }; + services = { + mpd.enable = lib.mkDefault true; + }; +} diff --git a/modules/home-manager/mpd/mpd.nix b/modules/home-manager/mpd/mpd.nix new file mode 100644 index 0000000..4a0af6a --- /dev/null +++ b/modules/home-manager/mpd/mpd.nix @@ -0,0 +1,5 @@ +{lib,config,...}: lib.mkIf config.services.mpd.enable { + services.mpd = { + musicDirectory = "/mnt/media/Audio/Musik"; + }; +} diff --git a/modules/home-manager/mpd/ncmpcpp.nix b/modules/home-manager/mpd/ncmpcpp.nix new file mode 100644 index 0000000..b6ca4c5 --- /dev/null +++ b/modules/home-manager/mpd/ncmpcpp.nix @@ -0,0 +1,22 @@ +{lib,config,...}: lib.mkIf config.programs.ncmpcpp.enable { + programs.ncmpcpp = { + bindings = [ + { + key = "j"; + command = "scroll_down"; + } + { + key = "k"; + command = "scroll_up"; + } + { + key = "J"; + command = ["select_item" "scroll_down"]; + } + { + key = "K"; + command = ["select_item" "scroll_up"]; + } + ]; + }; +} diff --git a/modules/home-manager/shell.nix b/modules/home-manager/shell.nix new file mode 100644 index 0000000..5159b60 --- /dev/null +++ b/modules/home-manager/shell.nix @@ -0,0 +1,5 @@ +_: { + imports = [ + ./shell + ]; +} diff --git a/modules/home-manager/shell/bat/default.nix b/modules/home-manager/shell/bat/default.nix new file mode 100644 index 0000000..72c529b --- /dev/null +++ b/modules/home-manager/shell/bat/default.nix @@ -0,0 +1,14 @@ +{ config, lib, pkgs, ... }: lib.mkIf config.programs.bat.enable { + home = { + packages = with pkgs; [ + bat + ]; + sessionVariables = { + MANPAGER = "sh -c 'col -bx | bat -l man -p'"; + MANROFFOPT = "-c"; + }; + shellAliases = { + cat = "bat"; + }; + }; +} diff --git a/modules/home-manager/shell/borgmatic/default.nix b/modules/home-manager/shell/borgmatic/default.nix new file mode 100644 index 0000000..095d1c0 --- /dev/null +++ b/modules/home-manager/shell/borgmatic/default.nix @@ -0,0 +1,60 @@ +{ + lib, + config, + ... +}: +let + commonExcludes = import ./excludes.nix; +in +lib.mkIf config.services.borgmatic.enable { + programs.borgmatic = { + enable = true; + backups = { + home = { + location = { + patterns = [ + "R /home/odie" + ] ++ commonExcludes; + repositories = [ + { + "path" = "ssh://odie@svartalbenheim.odie.intranet/./borg-backup"; + "label" = "svartalbenheim"; + } + ]; + extraConfig = { + remote_path = "/usr/local/bin/borg"; + }; + excludeHomeManagerSymlinks = true; + }; + retention = { + keepHourly = 24; + keepDaily = 60; + keepWeekly = 52; + keepMonthly = 24; + keepYearly = 10; + }; + consistency.checks = [ + { + name = "repository"; + frequency = "2 weeks"; + } + { + name = "archives"; + frequency = "4 weeks"; + } + { + name = "data"; + frequency = "8 weeks"; + } + { + name = "extract"; + frequency = "8 weeks"; + } + ]; + }; + }; + }; + services.borgmatic = { + frequency = "Mon..Sun *:00:30"; + }; +} diff --git a/modules/home-manager/shell/borgmatic/excludes.nix b/modules/home-manager/shell/borgmatic/excludes.nix new file mode 100644 index 0000000..12e7ca6 --- /dev/null +++ b/modules/home-manager/shell/borgmatic/excludes.nix @@ -0,0 +1,258 @@ +[ + "- /home/*/.android" + "- /home/*/.AndroidStudio*/" + "- /home/*/Android/Sdk" + "- /home/*/.gradle" + "- /home/*/.gvm" + "- /home/*/.grails/" + "- /home/*/.grails_history" + "- /home/*/.kde/share/apps/nepomuk" + "- /home/*/.local/share/notbit" + "- /home/*/.local/libvirt" + "- /home/*/.local/share/libvirt" + "- /home/*/.vagrant" + "- /home/*/.vagrant.d" + "- /home/*/.wine" + "- /home/*/.wine*" + "- /home/*/.twister" + "- /home/*/twister" + "- /home/*/Applications/eclipse*" + "- /home/*/Downloads" + "- /home/*/*Popcorntime*" + "- /home/*/.aMule" + "- /home/*/Scribus" + "- /home/*/VirtualBox*" + "- /home/*/.local/share/gnome-boxes/images" + "- /home/*/Nextcloud" + "- /home/*/_build" + "- /home/*/.rvm" + "- /home/*/.local/share/Steam" + "- /home/*/.var/app/com.valvesoftware.Steam/.local/share/Steam" + "- /home/*/.steam" + "- /home/*/Steam" + "- /home/*/.minecraft" + "- /home/*/.technic" + "- /home/*/.PlayOnLinux" + "- /home/*/.local/share/lutris/runners/wine/" + "- /home/*/.config/spotify/Users" + "- /home/*/.var/app/com.spotify.Client/config/spotify/Users" + "- /home/*/.local/lib/python*" + "- /home/*/PycharmProjects/**/venv" + "- /home/*/.m2" + "- /home/*/Vaults" + "- /home/*/.docker/machine" + "- /home/*/.local/share/containers" + "- /home/*/.gvfs" + "- /home/*/.local/share/gvfs-metadata" + "- /home/*/.Private" + "- /home/*/.dbus" + "- /home/*/.cache" + "- /home/*/.var/app/*/cache" + "- /home/*/.var/app/*/.cache" + "- /home/*/.Trash" + "- /home/*/.Trash-1*" + "- /home/*/.local/share/Trash" + "- /home/*/Trash" + "- /home/*/.cddb" + "- /home/*/.aptitude" + "- /home/*/.npm" + "- /home/*/.nvm" + "- /home/*/.lldb" + "- /home/*/.biome" + "- /home/*/.adobe" + "- /home/*/.macromedia" + "- /home/*/.xsession-errors" + "- /home/*/.xsession-errors.old" + "- /home/*/.wayland-errors" + "- /home/*/.local/share/RecentDocuments" + "- /home/*/.recently-used" + "- /home/*/.recently-used.xbel" + "- /home/*/recently-used.xbel" + "- /home/*/.thumbnails" + "- /home/*/.thumb" + "- /home/*/Thumbs.db" + "- /home/*/.DS_Store" + "- /home/*/.localised" + "- /home/*/.CFUserTextEncoding" + "- /home/*/.zcompdump*" + "- /home/*/.wget-hsts" + "- /home/*/.cups" + "- /home/*/.subversion" + "- /home/*/.virtualenvs" + "- /home/*/.Xauthority" + "- /home/*/.ICEauthority" + "- /home/*/.gksu.lock" + "- /home/*/.pulse" + "- /home/*/.pulse-cookie" + "- /home/*/.esd_auth" + "- /home/*/.VeraCrypt-lock-*" + "- /home/*/.kde/share/apps/RecentDocuments" + "- /home/*/.kde4/share/apps/RecentDocuments" + "- /home/*/.kde/share/apps/klipper" + "- /home/*/.kde4/share/apps/klipper" + "- /home/*/.local/share/klipper" + "- /home/*/.kde/share/apps/okular/docdata" + "- /home/*/.kde/share/apps/gwenview/recentfolders" + "- /home/*/.kde4/share/apps/okular/docdata" + "- /home/*/.kde4/share/apps/gwenview/recentfolders" + "- /home/*/.local/share/okular/docdata" + "- /home/*/.local/share/org.kde.gwenview/recentfolders" + "- /home/*/.kde/share/apps/kmess/displaypics" + "- /home/*/.kde4/share/apps/kmess/displaypics" + "- /home/*/.kde/share/apps/kmess/customemoticons" + "- /home/*/.kde4/share/apps/kmess/customemoticons" + "- /home/*/.local/share/tracker" + "- /home/*/.local/share/torbrowser" + "- /home/*/.mozilla/firefox/*/Cache" + "- /home/*/.mozilla/firefox/*/minidumps" + "- /home/*/.mozilla/firefox/*/.parentlock" + "- /home/*/.mozilla/firefox/*/urlclassifier3.sqlite" + "- /home/*/.mozilla/firefox/*/blocklist.xml" + "- /home/*/.mozilla/firefox/*/extensions.sqlite" + "- /home/*/.mozilla/firefox/*/extensions.sqlite-journal" + "- /home/*/.mozilla/firefox/*/extensions.rdf" + "- /home/*/.mozilla/firefox/*/extensions.ini" + "- /home/*/.mozilla/firefox/*/extensions.cache" + "- /home/*/.mozilla/firefox/*/XUL.mfasl" + "- /home/*/.mozilla/firefox/*/XPC.mfasl" + "- /home/*/.mozilla/firefox/*/xpti.dat" + "- /home/*/.mozilla/firefox/*/compreg.dat" + "- /home/*/.mozilla/firefox/*/pluginreg.dat" + "- /home/*/.mozilla/seamonkey/*/Cache" + "- /home/*/.mozilla/seamonkey/*/minidumps" + "- /home/*/.mozilla/seamonkey/*/.parentlock" + "- /home/*/.mozilla/seamonkey/*/blocklist.xml" + "- /home/*/.mozilla/seamonkey/*/extensions.sqlite" + "- /home/*/.mozilla/seamonkey/*/extensions.rdf" + "- /home/*/.mozilla/seamonkey/*/extensions.ini" + "- /home/*/.mozilla/seamonkey/*/xpti.dat" + "- /home/*/.mozilla/seamonkey/*/compreg.dat" + "- /home/*/.mozilla/seamonkey/*/pluginreg.dat" + "- /home/*/.thunderbird/*/Cache" + "- /home/*/.opera/temporary_downloads" + "- /home/*/.opera/cache" + "- /home/*/.opera/thumbnails" + "- /home/*/.opera/opcache" + "- /home/*/.opera/icons" + "- /home/*/.opera/application_cache" + "- /home/*/.opera/widgets/*/cache" + "- /home/*/.opera/lock" + "- /home/*/.keychain" + "- /home/*/.komodoedit/*/codeintel/db" + "- /home/*/.komodoedit/*/host-*/*/codeintel" + "- /home/*/.komodoedit/*/XRE/Cache" + "- /home/*/.komodoedit/*/XRE/.activatestate/komodo edit/Crash Reports" + "- /home/*/.komodoedit/*/XRE/.activatestate/komodo edit/*/Cache" + "- /home/*/.komodoedit/*/XRE/.activatestate/komodo edit/*/minidump" + "- /home/*/.komodoedit/*/XRE/.parentlock" + "- /home/*/.komodoedit/*/XRE/extensions.rdf" + "- /home/*/.komodoedit/*/XRE/extensions.ini" + "- /home/*/.komodoedit/*/XRE/extensions.cache" + "- /home/*/.komodoedit/*/XRE/XPC.mfasl" + "- /home/*/.komodoedit/*/XRE/XUL.mfasl" + "- /home/*/.komodoedit/*/XRE/xpti.dat" + "- /home/*/.komodoedit/*/XRE/pluginreg.dat" + "- /home/*/.komodoedit/*/XRE/compreg.dat" + "- /home/*/.komodoedit/*/XRE/*.sqlite-journal" + "- /home/*/.komodoedit/*/pystdout.log" + "- /home/*/.komodoedit/*/pystderr.log" + "- /home/*/.komodoedit/*/history.sqlite.bak" + "- /home/*/.komodoedit/*/running.lock" + "- /home/*/.komodoedit/*/mutex.lock" + "- /home/*/.komodoedit/*/*.xmlc" + "- /home/*/.komodoedit/*/startup-env.tmp" + "- /home/*/.komodoedit/*/commandments.fifo" + "- /home/*/.komodoedit/*/history.sqlite" + "- /home/*/.gnupg/rnd" + "- /home/*/.gnupg/random_seed" + "- /home/*/.gnupg/.#*" + "- /home/*/.gnupg/*.lock" + "- /home/*/.gnupg/gpg-agent-info-*" + "- /home/*/.googleearth/Temp" + "- /home/*/.googleearth/Cache" + "- /home/*/.config/google-chrome/ShaderCache" + "- /home/*/.config/google-chrome/*/Local Storage" + "- /home/*/.config/google-chrome/*/Session Storage" + "- /home/*/.config/google-chrome/*/Application Cache" + "- /home/*/.config/google-chrome/*/History Index *" + "- /home/*/.config/google-chrome/*/Service Worker/CacheStorage" + "- /home/*/.config/chromium/*/Local Storage" + "- /home/*/.config/chromium/*/Session Storage" + "- /home/*/.config/chromium/*/Service Worker/CacheStorage" + "- /home/*/.config/chromium/*/Application Cache" + "- /home/*/.config/chromium/*/History Index *" + "- /home/*/snap/chromium/common/.cache" + "- /home/*/snap/chromium/*/.config/chromium/*/Service Worker/CacheStorage" + "- /home/*/snap/chromium/*/.local/share/" + "- /home/*/snap/riot-web/" + "- /home/*/.config/BraveSoftware/Brave-Browser/*/Feature Engagement Tracker/" + "- /home/*/.config/BraveSoftware/Brave-Browser/*/Local Storage/" + "- /home/*/.config/BraveSoftware/Brave-Browser/*/Service Worker/CacheStorage/" + "- /home/*/.config/BraveSoftware/Brave-Browser/*/Session Storage/" + "- /home/*/.config/BraveSoftware/Brave-Browser/Safe Browsing/" + "- /home/*/.config/BraveSoftware/Brave-Browser/ShaderCache/" + "- /home/*/.gradle/caches" + "- /home/*/.m2/repository" + "- /home/*/.local/share/baloo" + "- /home/*/.local/share/zeitgeist" + "- /home/*/.local/share/akonadi" + "- /home/*/.purple/icons" + "- /home/*/.guayadeque/cache.db" + "- /home/*/.java/deployment/cache" + "- /home/*/.icedteaplugin" + "- /home/*/.icedtea" + "- /home/*/.gnome2/epiphany/favicon_cache" + "- /home/*/nohup.out" + "- /home/*/.config/libreoffice/4/cache" + "- /home/*/.config/freshwrapper-data/Shockwave Flash/WritableRoot/#SharedObjects" + "- /home/*/.config/*/Cache" + "- /home/*/.config/Atom/*Cache" + "- /home/*/.config/Atom/IndexedDB" + "- /home/*/.atom/compile-cache/" + "- /home/*/.vim/bundle/*" + "- /home/*/.viminfo" + "- /home/*/.vscode-oss/extensions/*" + "- /home/*/.vscode/extensions/*" + "- /home/*/.config/Code - OSS/logs/" + "- /home/*/.config/Code/logs/" + "- /home/*/.config/Code/CachedData/*" + "- /home/*/.config/VSCodium/CachedExtensionVSIXs" + "- /home/*/.config/VirtualBox/VBoxSVC.log*" + "- /home/*/.config/VirtualBox/VBoxGuestAdditions_*" + "- /home/*/.cargo" + "- /home/*/.rustup" + "- /home/*/.kerl" + "- /home/*/go/pkg/mod/cache" + "- /home/*/.ccache/?" + "- /home/*/.ccache/tmp" + "- /home/*/.nv/GLCache" + "- /home/*/.ICAClient/logs" + "- /home/*/.ICAClient/.tmp" + "- /home/*/.ICAClient/cache/zlcache" + "- /home/*/.config/geany/geany_socket_*" + "- /home/*/.config/lbry" + "- /home/*/.local/share/lbry/lbrynet" + "- /home/*/.config/**/blob_storage" + "- /home/*/.config/**/Application Cache" + "- /home/*/.config/**/Cache" + "- /home/*/.config/**/CachedData" + "- /home/*/.config/**/Code Cache" + "- /home/*/.config/**/GPUCache" + "- /home/*/.config/**/Service Worker/CacheStorage" + "- /home/*/.var/app/**/blob_storage" + "- /home/*/.var/app/**/Application Cache" + "- /home/*/.var/app/**/Cache" + "- /home/*/.var/app/**/CachedData" + "- /home/*/.var/app/**/Code Cache" + "- /home/*/.var/app/**/GPUCache" + "- /home/*/.var/app/**/Service Worker/CacheStorage" + "- /home/*/.config/scc/daemon.socket" + "- */node_modules" + "- */bower_components" + "- */target/debug" + "- */target/release" + "- */_build" + "- */.tox" + "- */venv" + "- */.venv" +] diff --git a/modules/home-manager/shell/btop/default.nix b/modules/home-manager/shell/btop/default.nix new file mode 100644 index 0000000..d3e5918 --- /dev/null +++ b/modules/home-manager/shell/btop/default.nix @@ -0,0 +1,8 @@ +{ config, lib, ... }: lib.mkIf config.programs.btop.enable { + programs.btop = { + settings = { + color_theme = "Default"; + theme_background = false; + }; + }; +} diff --git a/modules/home-manager/shell/default.nix b/modules/home-manager/shell/default.nix new file mode 100644 index 0000000..f92a128 --- /dev/null +++ b/modules/home-manager/shell/default.nix @@ -0,0 +1,40 @@ +{ lib, pkgs, ... }: with lib; { + imports = [ + ./direnv + ./fzf + ./git + ./lf + ./lsd + ./starship + ./tmux + ./zsh + ./btop + ./zoxide + ./ssh + ./bat + ./tldr + ./borgmatic + ]; + + home.packages = with pkgs; [ + ripgrep + fd + gdu + ]; + + programs = { + bat.enable = mkDefault true; + btop.enable = mkDefault true; + direnv.enable = mkDefault true; + fzf.enable = mkDefault true; + git.enable = mkDefault true; + lf.enable = mkDefault true; + lsd.enable = mkDefault true; + ssh.enable = mkDefault true; + starship.enable = mkDefault true; + tmux.enable = mkDefault true; + zoxide.enable = mkDefault true; + zsh.enable = mkDefault true; + tldr.enable = mkDefault true; + }; +} diff --git a/modules/home-manager/shell/direnv/default.nix b/modules/home-manager/shell/direnv/default.nix new file mode 100644 index 0000000..2c6c20d --- /dev/null +++ b/modules/home-manager/shell/direnv/default.nix @@ -0,0 +1,14 @@ +{ pkgs, lib, config, ... }: lib.mkIf config.programs.direnv.enable { + programs.direnv = { + enableZshIntegration = true; + config = { + global = { + disable_stdin = true; + strict_env = true; + }; + }; + nix-direnv.enable = true; + stdlib = builtins.readFile ../../../../configs/home-manager/direnv/stdlib.sh; + }; +} + diff --git a/modules/home-manager/shell/fzf/default.nix b/modules/home-manager/shell/fzf/default.nix new file mode 100644 index 0000000..d65aef0 --- /dev/null +++ b/modules/home-manager/shell/fzf/default.nix @@ -0,0 +1,15 @@ +{ config, lib, ... }: lib.mkIf config.programs.fzf.enable { + programs = { + fzf = { + enableZshIntegration = true; + defaultCommand = "fd --type f"; + defaultOptions = [ + "--height 40%" + "--border" + ]; + tmux = { + enableShellIntegration = true; + }; + }; + }; +} diff --git a/modules/home-manager/shell/git/default.nix b/modules/home-manager/shell/git/default.nix new file mode 100644 index 0000000..ec14bbd --- /dev/null +++ b/modules/home-manager/shell/git/default.nix @@ -0,0 +1,100 @@ +{ config +, pkgs +, lib +, vars +, ... +}: lib.mkIf config.programs.git.enable { + home = { + packages = with pkgs; [ pre-commit ]; + }; + programs = { + git = { + userName = vars.name; + userEmail = vars.email; + extraConfig = { + push = { + default = "matching"; + }; + core = { + autocrlf = "input"; + #excludesFile = "${config.xdg.configHome}/git/ignore"; + }; + pull = { + rebase = false; + }; + init = { + defaultBranch = "master"; + }; + }; + attributes = [ ]; + ignores = [ + "# Created by https://www.toptal.com/developers/gitignore/api/vim,linux" + "# Edit at https://www.toptal.com/developers/gitignore?templates=vim,linux" + "" + "### Linux ###" + "*~" + "" + "# temporary files which can be created if a process still has a handle open of a deleted file" + ".fuse_hidden*" + "" + "# KDE directory preferences" + ".directory" + "" + "# Linux trash folder which might appear on any partition or disk" + ".Trash-*" + "" + "# .nfs files are created when an open file is removed but is still being accessed" + ".nfs*" + "" + "### Vim ###" + "# Swap" + "[._]*.s[a-v][a-z]" + "!*.svg # comment out if you don't need vector files" + "[._]*.sw[a-p]" + "[._]s[a-rt-v][a-z]" + "[._]ss[a-gi-z]" + "[._]sw[a-p]" + "" + "# Session" + "Session.vim" + "Sessionx.vim" + "" + "# Temporary" + ".netrwhist" + "# Auto-generated tag files" + "tags" + "# Persistent undo" + "[._]*.un~" + "" + "# End of https://www.toptal.com/developers/gitignore/api/vim,linux" + "" + "# Created by https://www.toptal.com/developers/gitignore/api/nix" + "# Edit at https://www.toptal.com/developers/gitignore?templates=nix" + "" + "/result" + "" + "# End of https://www.toptal.com/developers/gitignore/api/nix" + "" + "# Created by https://www.toptal.com/developers/gitignore/api/rust" + "# Edit at https://www.toptal.com/developers/gitignore?templates=rust" + # Created by https://www.toptal.com/developers/gitignore/api/direnv + "# Edit at https://www.toptal.com/developers/gitignore?templates=direnv" + "" + "### direnv ###" + ".direnv" + ".envrc" + "" + "# End of https://www.toptal.com/developers/gitignore/api/direnv" + "# Created by https://www.toptal.com/developers/gitignore/api/dotenv" + " # Edit at https://www.toptal.com/developers/gitignore?templates=dotenv" + "" + "### dotenv ###" + "!.env.example" + ".env" + ".env.*" + "" + "# End of https://www.toptal.com/developers/gitignore/api/dotenv" + ]; + }; + }; +} diff --git a/modules/home-manager/shell/lf/default.nix b/modules/home-manager/shell/lf/default.nix new file mode 100644 index 0000000..f35e982 --- /dev/null +++ b/modules/home-manager/shell/lf/default.nix @@ -0,0 +1,56 @@ +{ pkgs, config, lib, ... }: lib.mkIf config.programs.lf.enable { + home = { + packages = with pkgs; [ + chafa + ctpv + ]; + file = { + ".config/lf/icons" = { + source = ../../../../configs/home-manager/lf/icons; + }; + ".config/lf/colors" = { + source = ../../../../configs/home-manager/lf/colors; + }; + }; + }; + programs.lf = { + commands = { + get-mime-type = "%xdg-mime query filetype \"$f\""; + open = '' + ''${{ + case $(file --mime-type $f -b) in + text/*|application/json|inode/x-empty|application/octet-stream) $EDITOR "$f" ;; + image/svg+xml) display -- "$f" ;; + audio/*) mpv --audio-display=no "$f" ;; + video/*) setsid -f mpv "$f" -quiet >/dev/null 2>&1 ;; + image/vnd.djvu|application/pdf|application/pdf|application/epub*) setsid -f $BROWSER "$f" >/dev/null 2>&1 ;; + application/pgp-encrypted) $EDITOR "$f" ;; + *) for f in $fx; do setsid -f $OPENER "$f" >/dev/null 2>&1; done ;; + esac + }}''; + on-select = '' + &{{ + lf -remote "send $id set statfmt \"$(lsd -ld --color=always "$f")\"" + }} + ''; + }; + settings = { + icons = true; + period = 1; + info = "size"; + dircounts = true; + sixel = true; + scrolloff = 5; + hidden = true; + previewer = "ctpv"; + cleaner = "ctpvclear"; + }; + keybindings = { + "" = "open"; + }; + extraConfig = '' + &ctpv -s $id + &ctpvquit $id + ''; + }; +} diff --git a/modules/home-manager/shell/lsd/default.nix b/modules/home-manager/shell/lsd/default.nix new file mode 100644 index 0000000..6e802be --- /dev/null +++ b/modules/home-manager/shell/lsd/default.nix @@ -0,0 +1,7 @@ +{lib, config, ...}: lib.mkIf config.programs.lsd.enable { + programs = { + lsd = { + enableAliases = true; + }; + }; +} diff --git a/modules/home-manager/shell/ssh/default.nix b/modules/home-manager/shell/ssh/default.nix new file mode 100644 index 0000000..beff370 --- /dev/null +++ b/modules/home-manager/shell/ssh/default.nix @@ -0,0 +1,26 @@ +{ + pkgs, + config, + lib, + ... +}: +lib.mkIf config.programs.ssh.enable { + home.packages = with pkgs; [tea]; + programs = { + ssh = { + addKeysToAgent = "yes"; + forwardAgent = true; + matchBlocks = { + "svartalbenheim.odie.intranet" = { + hostname = "svartalbenheim.odie.intranet"; + identityFile = "~/.ssh/id_ed25519_local"; + compression =false; + }; + }; + }; + }; + + services = { + ssh-agent.enable = true; + }; +} diff --git a/modules/home-manager/shell/starship/default.nix b/modules/home-manager/shell/starship/default.nix new file mode 100644 index 0000000..3e91d9f --- /dev/null +++ b/modules/home-manager/shell/starship/default.nix @@ -0,0 +1,336 @@ +{ lib, config, ... }: +lib.mkIf config.programs.starship.enable { + programs = { + starship = { + enableZshIntegration = true; + settings = { + add_newline = false; + format = lib.concatStrings [ + "$os" + "$username" + "$hostname" + "$directory" + "$jobs" + "$character" + ]; + right_format = lib.concatStrings [ + "$aws" + "$gcloud" + "$openstack" + "$azure" + "$fossil_branch" + "$git_branch" + "$git_commit" + "$git_state" + "$git_metrics" + "$git_statu" + "$hg_branch" + "$package" + "$c" + "$cmake" + "$cobol" + "$daml" + "$dart" + "$deno" + "$dotnet" + "$elixir" + "$elm" + "$erlang" + "$fennel" + "$golang" + "$guix_shell" + "$haskell" + "$haxe" + "$helm" + "$java" + "$julia" + "$kotlin" + "$gradle" + "$lua" + "$nim" + "$nodejs" + "$ocaml" + "$opa" + "$perl" + "$php" + "$pulumi" + "$purescript" + "$python" + "$raku" + "$rlang" + "$red" + "$ruby" + "$rust" + "$scala" + "$solidity" + "$swift" + "$terraform" + "$vlang" + "$vagrant" + "$zig" + "$buf" + "$nix_shell" + "$conda" + "$meson" + "$spack" + "$crystal" + ]; + scan_timeout = 10; + character = { + success_symbol = "[](green)"; + error_symbol = "[](red)"; + format = " $symbol "; + }; + + username = { + style_user = "green"; + style_root = "red"; + format = "[$user]($style)"; + disabled = false; + show_always = true; + }; + + + hostname = { + ssh_only = false; + format = "@[$hostname](cyan)"; + disabled = false; + ssh_symbol = " "; + }; + + directory = { + format = " [$path]($style)[$read_only]($read_only_style)"; + style = "yellow"; + truncation_length = 2; + truncation_symbol = "…/"; + read_only = " 󰌾"; + }; + + jobs = { + format = " [$symbol$number]($style) "; + symbol = ""; + }; + + aws = { + symbol = " "; + }; + + buf = { + symbol = " "; + format = "[$symbol($version )]($style)"; + }; + + c = { + symbol = " "; + format = "[$symbol($version )]($style)"; + }; + + conda = { + symbol = " "; + format = "[$symbol($version )]($style)"; + }; + + crystal = { + symbol = " "; + }; + + dart = { + symbol = " "; + format = "[$symbol($version )]($style)"; + }; + + docker_context = { + symbol = " "; + }; + + elixir = { + symbol = " "; + format = "[$symbol($version )]($style)"; + }; + + elm = { + symbol = " "; + format = "[$symbol($version )]($style)"; + }; + + fossil_branch = { + symbol = " "; + }; + + golang = { + symbol = " "; + format = "[$symbol($version )]($style)"; + }; + + guix_shell = { + symbol = " "; + }; + + haskell = { + symbol = " "; + format = "[$symbol($version )]($style)"; + }; + + haxe = { + symbol = " "; + format = "[$symbol($version )]($style)"; + }; + + hg_branch = { + symbol = " "; + format = "[$symbol($version )]($style)"; + }; + + git_branch = { + symbol = " "; + format = "[$symbol$branch(:$remote_branch)]($style) "; + }; + + java = { + symbol = " "; + format = "[$symbol($version )]($style)"; + }; + + julia = { + symbol = " "; + format = "[$symbol($version )]($style)"; + }; + + kotlin = { + symbol = " "; + }; + + lua = { + symbol = " "; + format = "[$symbol($version )]($style)"; + }; + + memory_usage = { + symbol = "󰍛 "; + format = "[$symbol($version )]($style)"; + }; + + meson = { + symbol = "󰔷 "; + format = "[$symbol($version )]($style)"; + }; + + nim = { + symbol = "󰆥 "; + format = "[$symbol($version )]($style)"; + }; + + nix_shell = { + symbol = " "; + format = "[$symbol$state( \\($name\\))]($style)"; + }; + + nodejs = { + symbol = " "; + format = "[$symbol($version )]($style)"; + }; + + ocaml = { + symbol = " "; + }; + + os = { + disabled = false; + style = "blue"; + }; + + os.symbols = { + Alpaquita = " "; + Alpine = " "; + Amazon = " "; + Android = " "; + Arch = " "; + Artix = " "; + CentOS = " "; + Debian = " "; + DragonFly = " "; + Emscripten = " "; + EndeavourOS = " "; + Fedora = " "; + FreeBSD = " "; + Garuda = "󰛓 "; + Gentoo = " "; + HardenedBSD = "󰞌 "; + Illumos = "󰈸 "; + Linux = " "; + Mabox = " "; + Macos = " "; + Manjaro = " "; + Mariner = " "; + MidnightBSD = " "; + Mint = " "; + NetBSD = " "; + NixOS = " "; + OpenBSD = "󰈺 "; + openSUSE = " "; + OracleLinux = "󰌷 "; + Pop = " "; + Raspbian = " "; + Redhat = " "; + RedHatEnterprise = " "; + Redox = "󰀘 "; + Solus = "󰠳 "; + SUSE = " "; + Ubuntu = " "; + Unknown = " "; + Windows = "󰍲 "; + }; + + package = { + symbol = "󰏗 "; + format = "[$symbol($version )]($style)"; + }; + + perl = { + symbol = " "; + }; + + php = { + symbol = " "; + }; + + pijul_channel = { + symbol = " "; + }; + + python = { + symbol = " "; + format = "[$symbol($version )]($style)"; + }; + + rlang = { + symbol = "󰟔 "; + format = "[$symbol($version )]($style)"; + }; + + ruby = { + symbol = " "; + format = "[$symbol($version )]($style)"; + }; + + rust = { + symbol = " "; + format = "[$symbol($version )]($style)"; + }; + + scala = { + symbol = " "; + format = "[$symbol($version )]($style)"; + }; + + swift = { + symbol = " "; + }; + + zig = { + symbol = " "; + }; + }; + }; + }; +} diff --git a/modules/home-manager/shell/tldr/default.nix b/modules/home-manager/shell/tldr/default.nix new file mode 100644 index 0000000..01b765c --- /dev/null +++ b/modules/home-manager/shell/tldr/default.nix @@ -0,0 +1,8 @@ +{ pkgs, config, lib, ... }: { + options = { + programs.tldr.enable = lib.mkEnableOption "tldr"; + }; + config = lib.mkIf config.programs.tldr.enable { + home.packages = with pkgs; [ tldr ]; + }; +} diff --git a/modules/home-manager/shell/tmux/default.nix b/modules/home-manager/shell/tmux/default.nix new file mode 100644 index 0000000..f5dff17 --- /dev/null +++ b/modules/home-manager/shell/tmux/default.nix @@ -0,0 +1,90 @@ +{ pkgs, lib, config, ... }: +let + catppuccin = pkgs.callPackage ../../../../pkgs/tmuxPlugins/catppuccin.nix {}; +in +{ + options = { + + }; + config = { + programs.tmux = lib.mkIf config.programs.tmux.enable { + newSession = false; + mouse = true; + keyMode = "vi"; + historyLimit = 10240; + clock24 = true; + baseIndex = 1; + aggressiveResize = true; + shortcut = "a"; + sensibleOnTop = true; + escapeTime = 0; + tmuxp.enable = true; + plugins = with pkgs.tmuxPlugins; [ + sensible + yank + { + plugin = catppuccin; + extraConfig = '' + set -g @catppuccin_window_default_text "#W" # use "#W" for application instead of directory + set -g @catppuccin_window_current_text "#W" # use "#W" for application instead of directory + set -g @catppuccin_window_status_enable "yes" + set -g @catppuccin_status_modules_right "directory user host date_time session" + ''; + } + better-mouse-mode + { + plugin = tmux-fzf; + extraConfig = '' + unbind A + TMUX_FZF_LAUNCH_KEY="f" + TMUX_FZF_PANE_FORMAT="[#{window_name}] #{pane_current_command} [#{pane_width}x#{pane_height}] [history #{history_size}/#{history_limit}, #{history_bytes} bytes] #{?pane_active,[active],[inactive]}" + ''; + } + ]; + extraConfig = '' + # Quick pane cycling + unbind ^A + bind ^A last-window + + #unbind 'Space' + #bind 'Space' next-window + + bind-key C-s split-window -v + bind-key C-v split-window -h + + set -g renumber-windows on + + # Open new panes and windows with the current panes path + bind c new-window -c "#{pane_current_path}" + bind '"' split-window -c "#{pane_current_path}" + bind % split-window -h -c "#{pane_current_path}" + + set-option -sa terminal-features ',xterm-256color:RGB' + set-option -sa terminal-features ',st-256color:RGB' + set-option -sa terminal-features ',xterm-kitty:RGB' + + is_vim="ps -o state= -o comm= -t '#{pane_tty}' | grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?\.?(view|n?vim?x?)(-wrapped)?(diff)?$'" + + bind-key -n 'C-h' if-shell "$is_vim" 'send-keys C-h' 'select-pane -L' + bind-key -n 'C-j' if-shell "$is_vim" 'send-keys C-j' 'select-pane -D' + bind-key -n 'C-k' if-shell "$is_vim" 'send-keys C-k' 'select-pane -U' + bind-key -n 'C-l' if-shell "$is_vim" 'send-keys C-l' 'select-pane -R' + + bind-key -T copy-mode-vi 'C-h' 'select-pane -L' + bind-key -T copy-mode-vi 'C-j' 'select-pane -D' + bind-key -T copy-mode-vi 'C-k' 'select-pane -U' + bind-key -T copy-mode-vi 'C-l' 'select-pane -R' + + bind -n 'M-h' if-shell "$is_vim" 'send-keys M-h' 'resize-pane -L 1' + bind -n 'M-j' if-shell "$is_vim" 'send-keys M-j' 'resize-pane -D 1' + bind -n 'M-k' if-shell "$is_vim" 'send-keys M-k' 'resize-pane -U 1' + bind -n 'M-l' if-shell "$is_vim" 'send-keys M-l' 'resize-pane -R 1' + + bind-key -T copy-mode-vi M-h resize-pane -L 1 + bind-key -T copy-mode-vi M-j resize-pane -D 1 + bind-key -T copy-mode-vi M-k resize-pane -U 1 + bind-key -T copy-mode-vi M-l resize-pane -R 1 + ''; + }; + }; +} diff --git a/modules/home-manager/shell/zoxide/default.nix b/modules/home-manager/shell/zoxide/default.nix new file mode 100644 index 0000000..34827d1 --- /dev/null +++ b/modules/home-manager/shell/zoxide/default.nix @@ -0,0 +1,10 @@ +{ config, lib, ... }: lib.mkIf config.programs.zoxide.enable { + programs = { + zoxide = { + enableZshIntegration = true; + options = [ + "--cmd cd" + ]; + }; + }; +} diff --git a/modules/home-manager/shell/zsh/default.nix b/modules/home-manager/shell/zsh/default.nix new file mode 100644 index 0000000..ecc80d3 --- /dev/null +++ b/modules/home-manager/shell/zsh/default.nix @@ -0,0 +1,45 @@ +{ config, lib, ... }: lib.mkIf config.programs.zsh.enable { + programs = { + zsh = { + defaultKeymap = "emacs"; + dotDir = ".config/zsh"; + shellAliases = { + j = "z"; + ji = "zi"; + }; + initExtra = builtins.readFile ../../../../configs/home-manager/zsh/zshrc.zsh; + completionInit = '' + autoload -U compinit bashcompinit + compinit + bashcompinit''; + history = { + path = "${config.xdg.cacheHome}/zsh_history"; + save = 100000; + size = 100000; + share = true; + extended = true; + }; + historySubstringSearch = { + enable = true; + searchDownKey = [ + "^[[B" + ]; + searchUpKey = [ + "^[[A" + ]; + }; + zplug = { + enable = true; + plugins = [ + { name = "zsh-users/zsh-completions"; } + { name = "zdharma-continuum/fast-syntax-highlighting"; } + { name = "zsh-users/zsh-autosuggestions"; } + { name = "nix-community/nix-zsh-completions"; } + ]; + }; + envExtra = '' + export DIRENV_LOG_FORMAT=$'\033[2mdirenv: %s\033[0m' + ''; + }; + }; +} diff --git a/modules/nixos/base/bootloader/default.nix b/modules/nixos/base/bootloader/default.nix new file mode 100644 index 0000000..1262985 --- /dev/null +++ b/modules/nixos/base/bootloader/default.nix @@ -0,0 +1,5 @@ +_: { + imports = [ + ./systemdboot.nix + ]; +} diff --git a/modules/nixos/base/bootloader/systemdboot.nix b/modules/nixos/base/bootloader/systemdboot.nix new file mode 100644 index 0000000..9249ebe --- /dev/null +++ b/modules/nixos/base/bootloader/systemdboot.nix @@ -0,0 +1,5 @@ +{config, lib, ...}: lib.mkIf config.boot.loader.systemd-boot.enable { + boot.loader = { + efi.canTouchEfiVariables = true; + }; +} diff --git a/modules/nixos/base/default.nix b/modules/nixos/base/default.nix new file mode 100644 index 0000000..e42066f --- /dev/null +++ b/modules/nixos/base/default.nix @@ -0,0 +1,16 @@ +_: { + imports = [ + ./bootloader + ./user + ./network + ./i18n + ./nixos + ./programs + ./ssh + ./power-management + ]; + + config = { + hardware.enableRedistributableFirmware = true; + }; +} diff --git a/modules/nixos/base/home-manager/default.nix b/modules/nixos/base/home-manager/default.nix new file mode 100644 index 0000000..43b32cc --- /dev/null +++ b/modules/nixos/base/home-manager/default.nix @@ -0,0 +1,11 @@ +{ inputs, vars, ... }: { + imports = [ + inputs.home-manager.nixosModules.home-manager + ]; + + home-manager = { + useGlobalPkgs = true; + useUserPackages = true; + extraSpecialArgs = { inherit inputs vars; }; + }; +} diff --git a/modules/nixos/base/i18n/default.nix b/modules/nixos/base/i18n/default.nix new file mode 100644 index 0000000..91a2cd4 --- /dev/null +++ b/modules/nixos/base/i18n/default.nix @@ -0,0 +1,11 @@ +{ config, lib, pkgs, vars, ... }: +let + inherit (vars) locale timeZone; +in +{ + i18n.defaultLocale = locale; + time.timeZone = timeZone; + + console.keyMap = "de-latin1-nodeadkeys"; + +} diff --git a/modules/nixos/base/network/default.nix b/modules/nixos/base/network/default.nix new file mode 100644 index 0000000..0158e4b --- /dev/null +++ b/modules/nixos/base/network/default.nix @@ -0,0 +1,10 @@ +{ config, lib, pkgs, vars, ... }: +let + inherit (vars) hostName; +in +{ + networking = { + inherit hostName; + firewall.enable = true; + }; +} diff --git a/modules/nixos/base/nixos/default.nix b/modules/nixos/base/nixos/default.nix new file mode 100644 index 0000000..275db8f --- /dev/null +++ b/modules/nixos/base/nixos/default.nix @@ -0,0 +1,16 @@ +_: { + nix = { + optimise = { + automatic = true; + }; + settings = { + experimental-features = [ "nix-command" "flakes" ]; + auto-optimise-store = true; + }; + gc = { + automatic = true; + dates = "weekly"; + options = "--delete-older-than 30d"; + }; + }; +} diff --git a/modules/nixos/base/power-management/default.nix b/modules/nixos/base/power-management/default.nix new file mode 100644 index 0000000..77b9c07 --- /dev/null +++ b/modules/nixos/base/power-management/default.nix @@ -0,0 +1,30 @@ +{ lib, config, ... }: { + options = { + services.power-management.enable = lib.mkEnableOption "power-management"; + }; + config = lib.mkIf config.services.power-management.enable { + services = { + power-profiles-daemon.enable = true; + upower.enable = true; + }; + + users.groups.power = { }; + + security.polkit = { + extraConfig = '' + polkit.addRule(function(action, subject) { + if (action.id == "org.freedesktop.systemd1.manage-units" || + action.id == "org.freedesktop.systemd1.manage-unit-files") { + if (action.lookup("unit") == "poweroff.target") { + if (subject.isInGroup("power")) { + return polkit.Result.YES; + } else { + return polkit.Result.AUTH_ADMIN; + } + } + } + }); + ''; + }; + }; +} diff --git a/modules/nixos/base/programs/default.nix b/modules/nixos/base/programs/default.nix new file mode 100644 index 0000000..a838aa8 --- /dev/null +++ b/modules/nixos/base/programs/default.nix @@ -0,0 +1,26 @@ +{ config, lib, pkgs, vars, ... }: +{ + environment = { + systemPackages = with pkgs; [ + vim + git + openssh + file + w3m + btop + iftop + iotop + ncdu + ]; + etc = { + "ncdu.conf".text = '' + --color dark + ''; + }; + }; + + programs = { + zsh.enable = true; + command-not-found.enable = false; + }; +} diff --git a/modules/nixos/base/raspberry-pi/cec/default.nix b/modules/nixos/base/raspberry-pi/cec/default.nix new file mode 100644 index 0000000..7685a8c --- /dev/null +++ b/modules/nixos/base/raspberry-pi/cec/default.nix @@ -0,0 +1,15 @@ +{ pkgs, lib, config, ... }: { + options = { + hardware.raspberry-pi.cec.enable = lib.mkEnableOption "raspberry pi cec software"; + }; + config = { + services.udev.extraRules = '' + # allow access to raspi cec device for video group (and optionally register it as a systemd device, used below) + KERNEL=="vchiq", GROUP="video", MODE="0660", TAG+="systemd", ENV{SYSTEMD_ALIAS}="/dev/vchiq" + ''; + + environment.systemPackages = with pkgs; [ + libcec + ]; + }; +} diff --git a/modules/nixos/base/raspberry-pi/default.nix b/modules/nixos/base/raspberry-pi/default.nix new file mode 100644 index 0000000..2575c2a --- /dev/null +++ b/modules/nixos/base/raspberry-pi/default.nix @@ -0,0 +1,11 @@ +{ pkgs, lib, config, ... }: { + options = { + hardware.raspberry-pi.enable = lib.mkEnableOption "raspberry pi software"; + }; + config = lib.mkIf config.hardware.raspberry-pi.enable { + environment.systemPackages = with pkgs; [ + libraspberrypi + raspberrypi-eeprom + ]; + }; +} diff --git a/modules/nixos/base/ssh/default.nix b/modules/nixos/base/ssh/default.nix new file mode 100644 index 0000000..893ecf1 --- /dev/null +++ b/modules/nixos/base/ssh/default.nix @@ -0,0 +1,9 @@ +{ lib, config, ... }: lib.mkIf config.services.openssh.enable { + services.openssh = { + settings = { + PermitRootLogin = "prohibit-password"; + PasswordAuthentication = false; + }; + openFirewall = true; + }; +} diff --git a/modules/nixos/base/user/default.nix b/modules/nixos/base/user/default.nix new file mode 100644 index 0000000..75a8ad7 --- /dev/null +++ b/modules/nixos/base/user/default.nix @@ -0,0 +1,53 @@ +{ config, lib, pkgs, vars, ... }: +let + inherit (vars) username name locale hostname sshKeys; + + baseGroups = [ + "users" + "wheel" + ]; + rpiGroups = + if config.hardware.raspberry-pi.enable then [ + "audio" + "video" + "plugdev" + "adm" + "disk" + "i2c" + "spi" + "power" + ] else [ ]; + extraGroups = baseGroups ++ rpiGroups; + + basePackages = with pkgs; [ home-manager ]; + wslPackages = + if config.wsl.enable then with pkgs; [ + wslu + wsl-open + ] else [ ]; + packages = basePackages ++ wslPackages; +in +{ + options = { + hardware.raspberry-pi.enable = lib.mkEnableOption "raspberry pi features"; + }; + config = { + users = { + groups.${username} = { }; + users = { + ${username} = { + inherit packages extraGroups; + name = username; + uid = 1000; + isNormalUser = true; + home = "/home/${username}"; + description = name; + group = config.users.groups.${username}.name; + openssh.authorizedKeys.keys = sshKeys; + shell = pkgs.zsh; + }; + }; + }; + }; +} + diff --git a/modules/nixos/default.nix b/modules/nixos/default.nix new file mode 100644 index 0000000..bded33f --- /dev/null +++ b/modules/nixos/default.nix @@ -0,0 +1,6 @@ +_: { + imports = [ + ./base + ./wsl + ]; +} diff --git a/modules/nixos/desktop/default.nix b/modules/nixos/desktop/default.nix new file mode 100644 index 0000000..0419457 --- /dev/null +++ b/modules/nixos/desktop/default.nix @@ -0,0 +1,16 @@ +{ lib, ... }: { + imports = [ + ./fonts + ./sound + ./xorg + ]; + + options = { + desktop.enable = lib.mkEnableOption "desktop features"; + }; + + config = { + programs.dconf.enable = true; + hardware.opengl.enable = true; + }; +} diff --git a/modules/nixos/desktop/fonts/default.nix b/modules/nixos/desktop/fonts/default.nix new file mode 100644 index 0000000..8629198 --- /dev/null +++ b/modules/nixos/desktop/fonts/default.nix @@ -0,0 +1,33 @@ +{ pkgs, lib, config, ... }: lib.mkIf config.desktop.enable { + fonts = { + enableDefaultPackages = true; + packages = with pkgs; [ + roboto + roboto-slab + noto-fonts + noto-fonts-emoji + sarasa-gothic + (nerdfonts.override { fonts = [ "NerdFontsSymbolsOnly" ]; }) + ]; + fontconfig = { + antialias = true; + allowType1 = false; + allowBitmaps = false; + hinting = { + enable = true; + style = "slight"; + autohint = false; + }; + subpixel = { + rgba = "rgb"; + lcdfilter = "default"; + }; + defaultFonts = { + emoji = [ "Noto Color Emoji" ]; + serif = [ "Roboto Slab" "Noto Serif" "Sarasa Gothic CL" "Symbols Nerd Font" ]; + sansSerif = [ "Roboto" "Noto Sans" "Sarasa Gothic CL" "Symbols Nerd Font" ]; + monospace = [ "JetBrains Mono" "Sarasa Mono CL" "Symbols Nerd Font Mono" ]; + }; + }; + }; +} diff --git a/modules/nixos/desktop/networkmanager/default.nix b/modules/nixos/desktop/networkmanager/default.nix new file mode 100644 index 0000000..052ee9d --- /dev/null +++ b/modules/nixos/desktop/networkmanager/default.nix @@ -0,0 +1,5 @@ +{ + networking.networkmanager = { + enable = true; + }; +} diff --git a/modules/nixos/desktop/sound/default.nix b/modules/nixos/desktop/sound/default.nix new file mode 100644 index 0000000..1b84309 --- /dev/null +++ b/modules/nixos/desktop/sound/default.nix @@ -0,0 +1,18 @@ +{ pkgs, lib, config, ... }: +lib.mkIf config.desktop.enable { + environment.systemPackages = with pkgs; [ + alsa-utils + ]; + + security.rtkit.enable = true; + + services.pipewire = { + enable = true; + alsa.enable = true; + alsa.support32Bit = true; + pulse.enable = true; + wireplumber.enable = true; + }; + + sound.enable = true; +} diff --git a/modules/nixos/desktop/xorg/default.nix b/modules/nixos/desktop/xorg/default.nix new file mode 100644 index 0000000..4c7d767 --- /dev/null +++ b/modules/nixos/desktop/xorg/default.nix @@ -0,0 +1,35 @@ +{ lib, config, vars, ... }: { + imports = [ + ./i18n.nix + ]; + + config = { + services.xserver = lib.mkIf config.desktop.enable { + enable = true; + displayManager = { + autoLogin = { + user = vars.username; + enable = true; + }; + lightdm = { + enable = true; + greeters.gtk.enable = true; + }; + defaultSession = "none+awesome"; + }; + libinput = { + enable = true; + + # disabling mouse acceleration + mouse = { + accelProfile = "flat"; + }; + + # disabling touchpad acceleration + touchpad = { + accelProfile = "flat"; + }; + }; + }; + }; +} diff --git a/modules/nixos/desktop/xorg/i18n.nix b/modules/nixos/desktop/xorg/i18n.nix new file mode 100644 index 0000000..9f3a126 --- /dev/null +++ b/modules/nixos/desktop/xorg/i18n.nix @@ -0,0 +1,8 @@ +_: { + services.xserver = { + xkb = { + layout = "de"; + variant = "nodeadkeys,"; + }; + }; +} diff --git a/modules/nixos/wsl/default.nix b/modules/nixos/wsl/default.nix new file mode 100644 index 0000000..bc431af --- /dev/null +++ b/modules/nixos/wsl/default.nix @@ -0,0 +1,18 @@ +{ config, lib, pkgs, vars, inputs, ... }: +let + inherit (vars) username hostName; +in +{ + imports = [ + inputs.nixos-wsl.nixosModules.wsl + ]; + + config = lib.mkIf config.wsl.enable { + wsl = { + defaultUser = username; + nativeSystemd = true; + useWindowsDriver = true; + wslConf = { network.hostname = hostName; }; + }; + }; +} diff --git a/modules/nixvim/autocommands/default.nix b/modules/nixvim/autocommands/default.nix new file mode 100644 index 0000000..0ee13c7 --- /dev/null +++ b/modules/nixvim/autocommands/default.nix @@ -0,0 +1,8 @@ +{ + imports = [ + ./yank_highlight.nix + #./remember_cursor_position.nix + ./set_conceal_level.nix + ./filetype_options.nix + ]; +} diff --git a/modules/nixvim/autocommands/filetype_options.nix b/modules/nixvim/autocommands/filetype_options.nix new file mode 100644 index 0000000..5b7f7c8 --- /dev/null +++ b/modules/nixvim/autocommands/filetype_options.nix @@ -0,0 +1,43 @@ +let + group = "FiletypeOptions"; + mkFileTypeOptions = { + pattern, + indentSize ? 4, + expandTab ? true, + }: let + expandtab = + if expandTab + then "true" + else "false"; + in { + inherit group pattern; + event = ["BufRead" "BufNewFile"]; + callback = { + __raw = '' + function() + local setlocal = vim.opt_local + setlocal.expandtab = ${expandtab} + setlocal.shiftwidth = ${builtins.toString indentSize} + setlocal.tabstop = ${builtins.toString indentSize} + end + ''; + }; + }; +in { + autoGroups = { + ${group} = { + clear = true; + }; + }; + autoCmd = [ + (mkFileTypeOptions { + pattern = ["*.nix"]; + indentSize = 2; + }) + (mkFileTypeOptions { + pattern = ["*.go"]; + expandTab = false; + indentSize = 4; + }) + ]; +} diff --git a/modules/nixvim/autocommands/remember_cursor_position.nix b/modules/nixvim/autocommands/remember_cursor_position.nix new file mode 100644 index 0000000..2ed48ae --- /dev/null +++ b/modules/nixvim/autocommands/remember_cursor_position.nix @@ -0,0 +1,35 @@ +let + group = "RememberCursorPosition"; +in { + autoGroups = { + ${group} = { + clear = true; + }; + }; + autoCmd = [ + { + inherit group; + event = "BufRead"; + callback = { + __raw = '' + function(opts) + buffer = opts.buf, + vim.api.nvim_create_autocmd("BufWinEnter", { + callback = function() + local ft = vim.bo[opts.buf].filetype + local last_known_line = vim.api.nvim_buf_get_mark(opts.buf, '"')[1] + if + not (ft:match("commit") and ft:match("rebase")) + and last_known_line > 1 + and last_known_line <= vim.api.nvim_buf_line_count(opts.buf) + then + vim.api.nvim_feedkeys([[g`"]], "nx", false) + end + end, + }) + end + ''; + }; + } + ]; +} diff --git a/modules/nixvim/autocommands/set_conceal_level.nix b/modules/nixvim/autocommands/set_conceal_level.nix new file mode 100644 index 0000000..4009a8c --- /dev/null +++ b/modules/nixvim/autocommands/set_conceal_level.nix @@ -0,0 +1,34 @@ +let + group = "SetConcealLevel"; + pattern = [ + "*.md" + "*.json" + "*.norg" + ]; + + mkConcealFunction = level: { + __raw = '' + function() + vim.opt.conceallevel = ${level} + end + ''; + }; +in { + autoGroups = { + ${group} = { + clear = true; + }; + }; + autoCmd = [ + { + inherit pattern group; + event = ["BufEnter" "BufWinEnter"]; + callback = mkConcealFunction "3"; + } + { + inherit pattern group; + event = ["BufLeave" "BufWinLeave"]; + callback = mkConcealFunction "0"; + } + ]; +} diff --git a/modules/nixvim/autocommands/yank_highlight.nix b/modules/nixvim/autocommands/yank_highlight.nix new file mode 100644 index 0000000..619edd9 --- /dev/null +++ b/modules/nixvim/autocommands/yank_highlight.nix @@ -0,0 +1,23 @@ +let + group = "YankHightlight"; +in { + autoGroups = { + ${group} = { + clear = true; + }; + }; + autoCmd = [ + { + inherit group; + event = "TextYankPost"; + pattern = "*"; + callback = { + __raw = '' + function() + vim.highlight.on_yank() + end + ''; + }; + } + ]; +} diff --git a/modules/nixvim/colorscheme.nix b/modules/nixvim/colorscheme.nix new file mode 100644 index 0000000..ce9bcfb --- /dev/null +++ b/modules/nixvim/colorscheme.nix @@ -0,0 +1,44 @@ +{ + colorschemes.catppuccin = { + enable = true; + integrations = { + cmp = true; + gitsigns = true; + harpoon = true; + neotree = true; + noice = true; + treesitter = true; + rainbow_delimiters = true; + indent_blankline = { + enabled = true; + colored_indent_levels = true; + }; + }; + customHighlights = '' + function(colors) + local bg1 = colors.mantle + local bg2 = colors.crust + local fg0 = colors.text + local green = colors.green + local red = colors.red + return { + TelescopePreviewBorder = { fg = bg1, bg = bg1 }, + TelescopePreviewNormal = { bg = bg1 }, + TelescopePreviewTitle = { fg = fg0, bg = green }, + TelescopePromptBorder = { fg = bg2, bg = bg2 }, + TelescopePromptNormal = { fg = fg0, bg = bg2 }, + TelescopePromptPrefix = { fg = red, bg = bg2 }, + TelescopePromptTitle = { fg = fg0, bg = red }, + TelescopeResultsBorder = { fg = bg1, bg = bg1 }, + TelescopeResultsNormal = { bg = bg1 }, + TelescopeResultsTitle = { fg = bg1, bg = bg1 }, + TelescopeSelection = { bg = bg2, fg = colors.text }, + TelescopeResultsDiffAdd = { fg = fg0 }, + TelescopeResultsDiffChange = { fg = fg0 }, + TelescopeResultsDiffDelete = { fg = fg0 }, + NotifyBackground = { bg = bg2 }, + } + end + ''; + }; +} diff --git a/modules/nixvim/default.nix b/modules/nixvim/default.nix new file mode 100644 index 0000000..d75a701 --- /dev/null +++ b/modules/nixvim/default.nix @@ -0,0 +1,15 @@ +{pkgs, ...}: { + imports = [ + ./colorscheme.nix + ./options.nix + ./keymaps.nix + ./autocommands + ./plugins + ]; + + config = { + package = pkgs.neovim-nightly; + viAlias = true; + vimAlias = true; + }; +} diff --git a/modules/nixvim/keymaps.nix b/modules/nixvim/keymaps.nix new file mode 100644 index 0000000..a83f448 --- /dev/null +++ b/modules/nixvim/keymaps.nix @@ -0,0 +1,75 @@ +_: { + keymaps = [ + { + key = "e"; + action = "Neotree toggle"; + options = { + silent = true; + }; + } + { + key = "ff"; + action = "Telescope find_files"; + options = { + silent = true; + }; + } + { + key = ""; + action = ""; + options = { + silent = true; + }; + mode = ["n" "v"]; + } + { + key = ""; + action = ""; + options = { + silent = true; + }; + mode = ["t"]; + } + { + key = "q:"; + action = ""; + options = { + noremap = true; + }; + } + { + key = "k"; + action = "v:count == 0 ? 'gk' : 'k'"; + options = { + silent = true; + expr = true; + }; + } + { + key = "j"; + action = "v:count == 0 ? 'gj' : 'j'"; + options = { + silent = true; + expr = true; + }; + } + { + key = ""; + action = ":m -2"; + } + { + key = ""; + action = ":m +1"; + } + { + key = ""; + action = ":m '<-2gv=gv"; + mode = ["v"]; + } + { + key = ""; + action = ":m '>+1gv=gv"; + mode = ["v"]; + } + ]; +} diff --git a/modules/nixvim/options.nix b/modules/nixvim/options.nix new file mode 100644 index 0000000..c006f6d --- /dev/null +++ b/modules/nixvim/options.nix @@ -0,0 +1,198 @@ +{ + pkgs, + lib, + ... +}: let + indentSize = 4; +in { + options = { + programs.nixvim.ai = { + enable = lib.mkEnableOption "AI functions"; + }; + }; + config = { + clipboard.register = "unnamedplus"; + globals = { + mapleader = " "; + maplocalleader = ","; + inlay_hints_visible = true; + }; + opts = { + termguicolors = true; + whichwrap = "b,s,<,>,[,],h,l"; + backspace = "indent,eol,start"; + autoindent = true; + expandtab = true; + smarttab = true; + smartindent = true; + shiftwidth = indentSize; + tabstop = indentSize; + softtabstop = indentSize; + hlsearch = true; + incsearch = true; + ignorecase = true; + smartcase = true; + scrolloff = 8; + splitbelow = true; + splitright = true; + startofline = false; + number = true; + relativenumber = true; + visualbell = true; + errorbells = false; + #textwidth = 80; + colorcolumn = [80]; + cursorline = true; + undofile = true; + backup = true; + mouse = "a"; + selectmode = "mouse"; + mousemoveevent = true; + timeoutlen = 300; + list = true; + spell = true; + spelllang = ["de" "en_us"]; + helplang = "de"; + laststatus = 3; + conceallevel = 0; + concealcursor = "nc"; + signcolumn = "yes"; + foldlevel = 999; + }; + extraPackages = with pkgs; [ + fd + ripgrep + iferr + fswatch + reftools + golines + richgo + gofumpt + govulncheck + mockgen + ginkgo + gotestsum + libxcrypt + xz + icu74 + alejandra + vscode-extensions.ms-vscode.cpptools + ]; + extraPlugins = with pkgs.vimPlugins; [ + { + plugin = go-nvim; + config = ''lua require("go").setup()''; + } + { + plugin = nvim-dap-go; + config = ''lua require("dap-go").setup()''; + } + { + plugin = telescope-dap-nvim; + config = ''lua require("telescope").load_extension("dap")''; + } + ]; + extraConfigLua = '' + vim.opt.undodir = vim.fn.stdpath("state") .. "/undo" + vim.opt.backupdir = vim.fn.stdpath("state") .. "/backup" + vim.opt.listchars:append("eol:↴") + vim.opt.listchars:append("space:.") + vim.opt.listchars:append("tab:🡢 ") + + vim.filetype.add({extension = { templ = "templ" }}) + + vim.diagnostic.config({ + virtual_text = true, + severity_sort = true, + }) + + vim.fn.sign_define("DiagnosticSignError", { text = " ", texthl = "DiagnosticSignError" }) + vim.fn.sign_define("DiagnosticSignWarn", { text = "", texthl = "DiagnosticSignWarn" }) + vim.fn.sign_define("DiagnosticSignInfo", { text = "", texthl = "DiagnosticSignInfo" }) + vim.fn.sign_define("DiagnosticSignHint", { text = "󰌵", texthl = "DiagnosticSignHint" }) + + vim.fn.sign_define("DapBreakpoint", { text = "", texthl = "DapBreakpoint", linehl = "", numhl = "DapBreakpoint" }) + vim.fn.sign_define( + "DapBreakpointCondition", + { text = "ﳁ", texthl = "DapBreakpoint", linehl = "", numhl = "DapBreakpoint" } + ) + vim.fn.sign_define( + "DapBreakpointRejected", + { text = "", texthl = "DapBreakpoint", linehl = "", numhl = "DapBreakpoint" } + ) + vim.fn.sign_define("DapLogPoint", { text = "", texthl = "DapLogPoint", linehl = "", numhl = "DapLogPoint" }) + vim.fn.sign_define("DapStopped", { text = "", texthl = "DapStopped", linehl = "", numhl = "DapStopped" }) + ''; + + extraConfigLuaPre = '' + local colors = require("catppuccin.palettes").get_palette("mocha") + local pickers = require("telescope.pickers") + local finders = require("telescope.finders") + local conf = require("telescope.config").values + local actions = require("telescope.actions") + local action_state = require("telescope.actions.state") + + local pickers = require("telescope.pickers") + local finders = require("telescope.finders") + local conf = require("telescope.config").values + local actions = require("telescope.actions") + local action_state = require("telescope.actions.state") + + function get_program() + return coroutine.create(function(coro) + local opts = {} + pickers + .new(opts, { + prompt_title = "Path to executable", + finder = finders.new_oneshot_job({ "fd", "--exclude", ".git", "--no-ignore", "--type", "x"}, {}), + sorter = conf.generic_sorter(opts), + attach_mappings = function(buffer_number) + actions.select_default:replace(function() + actions.close(buffer_number) + coroutine.resume(coro, action_state.get_selected_entry()[1]) + end) + return true + end, + }) + :find() + end) + end + ''; + + extraConfigLuaPost = '' + local hooks = require("ibl.hooks") + -- create the highlight groups in the highlight setup hook, so they are reset + -- every time the colorscheme changes + hooks.register(hooks.type.HIGHLIGHT_SETUP, function() + vim.api.nvim_set_hl(0, "RainbowRed", { fg = colors.red }) + vim.api.nvim_set_hl(0, "RainbowYellow", { fg = colors.yellow }) + vim.api.nvim_set_hl(0, "RainbowBlue", { fg = colors.blue }) + vim.api.nvim_set_hl(0, "RainbowOrange", { fg = colors.peach }) + vim.api.nvim_set_hl(0, "RainbowGreen", { fg = colors.green }) + vim.api.nvim_set_hl(0, "RainbowViolet", { fg = colors.mauve }) + vim.api.nvim_set_hl(0, "RainbowCyan", { fg = colors.teal }) + end) + + hooks.register(hooks.type.SCOPE_HIGHLIGHT, hooks.builtin.scope_highlight_from_extmark) + + + local dap = require("dap") + local dapui = require("dapui") + dap.listeners.before.attach.dapui_config = function() + dapui.open() + end + dap.listeners.before.launch.dapui_config = function() + dapui.open() + end + dap.listeners.after.event_initialized.dapui_config = function() + dapui.open() + end + dap.listeners.before.event_terminated.dapui_config = function() + dapui.close() + end + dap.listeners.before.event_exited.dapui_config = function() + dapui.close() + end + ''; + }; +} diff --git a/modules/nixvim/plugins/codeium.nix b/modules/nixvim/plugins/codeium.nix new file mode 100644 index 0000000..2e5c508 --- /dev/null +++ b/modules/nixvim/plugins/codeium.nix @@ -0,0 +1,12 @@ +{ + lib, + config, + ... +}: let + cfg = config.programs.nixvim.ai; +in + lib.mkIf cfg.enable { + plugins.codeium-nvim = { + enable = true; + }; + } diff --git a/modules/nixvim/plugins/dap.nix b/modules/nixvim/plugins/dap.nix new file mode 100644 index 0000000..ae57c8d --- /dev/null +++ b/modules/nixvim/plugins/dap.nix @@ -0,0 +1,130 @@ +{pkgs, ...}: { + plugins.dap = { + enable = true; + extensions = { + dap-ui.enable = true; + dap-go.enable = true; + dap-python.enable = true; + dap-virtual-text.enable = true; + }; + adapters = { + executables = { + lldb = { + command = "${pkgs.llvmPackages.lldb}/bin/lldb-vscode"; + }; + }; + servers.codelldb = rec { + port = 13000; + executable = { + command = "${pkgs.vscode-extensions.vadimcn.vscode-lldb}/share/vscode/extensions/vadimcn.vscode-lldb/adapter/codelldb"; + args = ["--port" (builtins.toString port)]; + }; + }; + }; + configurations = rec { + c = cpp; + rust = cpp; + cpp = [ + { + name = "Launch"; + request = "launch"; + type = "codelldb"; + cwd = "\${workspaceFolder}"; + stopOnEntry = false; + runInTerminal = false; + program = { + __raw = '' + get_program + ''; + }; + } + { + name = "Launch with Arguments"; + request = "launch"; + type = "codelldb"; + cwd = "\${workspaceFolder}"; + stopOnEntry = false; + runInTerminal = false; + program = { + __raw = '' + get_program + ''; + }; + args = { + __raw = '' + function() + local arguments_string = vim.fn.input('Executable arguments: ') + return vim.split(arguments_string, " +") + end + ''; + }; + } + ]; + }; + }; + keymaps = [ + { + action = ":DapToggleBreakpoint"; + key = "db"; + options = { + silent = true; + }; + } + { + action = ":DapUiToggle"; + key = "du"; + options = { + silent = true; + }; + } + { + action = ":DapContinue"; + key = "dc"; + options = { + silent = true; + }; + } + { + action = ":DapRerun"; + key = "dC"; + options = { + silent = true; + }; + } + { + action = ":DapStepOver"; + key = "do"; + options = { + silent = true; + }; + } + { + action = ":DapStepIn"; + key = "di"; + options = { + silent = true; + }; + } + { + action = ":DapStepOut"; + key = "dO"; + options = { + silent = true; + }; + } + { + action = ":DapTerminate"; + key = "dT"; + options = { + silent = true; + }; + } + { + action = ":DapToggleRepl"; + key = "dr"; + options = { + silent = true; + }; + } + ]; +} diff --git a/modules/nixvim/plugins/default.nix b/modules/nixvim/plugins/default.nix new file mode 100644 index 0000000..8af0f65 --- /dev/null +++ b/modules/nixvim/plugins/default.nix @@ -0,0 +1,26 @@ +{ + imports = [ + ./gitsigns.nix + ./harpoon.nix + ./indent-blankline.nix + ./lualine.nix + ./neo-tree.nix + ./noice.nix + ./none-ls.nix + ./rainbow-delimiters.nix + ./telescope.nix + ./treesitter.nix + ./trouble.nix + ./vim-tmux-navigator.nix + ./which-key.nix + ./mini.nix + ./todo-comments.nix + ./neorg.nix + ./fugitive.nix + ./dap.nix + ./lastplace.nix + ./codeium.nix + ./undotree.nix + ./lsp + ]; +} diff --git a/modules/nixvim/plugins/fugitive.nix b/modules/nixvim/plugins/fugitive.nix new file mode 100644 index 0000000..8fc29d2 --- /dev/null +++ b/modules/nixvim/plugins/fugitive.nix @@ -0,0 +1,3 @@ +{ + plugins.fugitive.enable = true; +} diff --git a/modules/nixvim/plugins/gitsigns.nix b/modules/nixvim/plugins/gitsigns.nix new file mode 100644 index 0000000..af0b517 --- /dev/null +++ b/modules/nixvim/plugins/gitsigns.nix @@ -0,0 +1,3 @@ +{ + plugins.gitsigns.enable = true; +} diff --git a/modules/nixvim/plugins/harpoon.nix b/modules/nixvim/plugins/harpoon.nix new file mode 100644 index 0000000..54abd20 --- /dev/null +++ b/modules/nixvim/plugins/harpoon.nix @@ -0,0 +1,15 @@ +{ + plugins.harpoon = { + enable = true; + keymaps = { + addFile = "m"; + navFile = { + "1" = "1"; + "2" = "2"; + "3" = "3"; + "4" = "4"; + }; + toggleQuickMenu = "M"; + }; + }; +} diff --git a/modules/nixvim/plugins/indent-blankline.nix b/modules/nixvim/plugins/indent-blankline.nix new file mode 100644 index 0000000..d32849e --- /dev/null +++ b/modules/nixvim/plugins/indent-blankline.nix @@ -0,0 +1,25 @@ +_: let + highlight = [ + "RainbowRed" + "RainbowYellow" + "RainbowBlue" + "RainbowOrange" + "RainbowGreen" + "RainbowViolet" + "RainbowCyan" + ]; +in { + plugins.indent-blankline = { + enable = true; + settings = { + scope = { + inherit highlight; + }; + indent = { + inherit highlight; + char = "▎"; + tab_char = "▍"; + }; + }; + }; +} diff --git a/modules/nixvim/plugins/lastplace.nix b/modules/nixvim/plugins/lastplace.nix new file mode 100644 index 0000000..81cf582 --- /dev/null +++ b/modules/nixvim/plugins/lastplace.nix @@ -0,0 +1,3 @@ +{ + plugins.lastplace.enable = true; +} diff --git a/modules/nixvim/plugins/lsp/cmp.nix b/modules/nixvim/plugins/lsp/cmp.nix new file mode 100644 index 0000000..96e1d5e --- /dev/null +++ b/modules/nixvim/plugins/lsp/cmp.nix @@ -0,0 +1,236 @@ +{ + plugins = { + friendly-snippets = { + enable = true; + }; + luasnip = { + enable = true; + extraConfig = { + enable_autosnippets = true; + store_selection_keys = ""; + }; + fromLua = [ + {paths = ../../snippets;} + ]; + }; + lspkind = { + enable = true; + symbolMap = { + Namespace = "󰌗"; + Text = "󰉿"; + Method = "󰆧"; + Function = "󰆧"; + Constructor = ""; + Field = "󰜢"; + Variable = "󰀫"; + Class = "󰠱"; + Interface = ""; + Module = ""; + Property = "󰜢"; + Unit = "󰑭"; + Value = "󰎠"; + Enum = ""; + Keyword = "󰌋"; + Snippet = ""; + Color = "󰏘"; + File = "󰈚"; + Reference = "󰈇"; + Folder = "󰉋"; + EnumMember = ""; + Constant = "󰏿"; + Struct = "󰙅"; + Event = ""; + Operator = "󰆕"; + TypeParameter = "󰊄"; + Table = ""; + Object = "󰅩"; + Tag = ""; + Array = "[]"; + Boolean = ""; + Number = ""; + Null = "󰟢"; + String = "󰉿"; + Calendar = ""; + Watch = "󰥔"; + Package = ""; + Codeium = ""; + Copilot = ""; + TabNine = ""; + }; + }; + cmp = { + enable = true; + autoEnableSources = true; + settings = { + snippet.expand = '' + function(args) + require('luasnip').lsp_expand(args.body) + end + ''; + completion.completeopt = "menu,preview"; + sources = [ + {name = "nvim_lsp";} + {name = "nvim_lsp_signature_help";} + {name = "nvim_lsp_document_symbol";} + {name = "codeium";} + {name = "luasnip";} + {name = "path";} + {name = "buffer";} + {name = "treesitter";} + ]; + mapping = { + __raw = '' + cmp.mapping.preset.insert({ + [''] = cmp.mapping({ + c = function() + if cmp.visible() then + cmp.select_next_item({ behavior = cmp.SelectBehavior.Select }) + else + vim.api.nvim_feedkeys(t(''), 'n', true) + end + end, + i = function(fallback) + if cmp.visible() then + cmp.select_next_item({ behavior = cmp.SelectBehavior.Select }) + else + fallback() + end + end + }), + [''] = cmp.mapping({ + c = function() + if cmp.visible() then + cmp.select_prev_item({ behavior = cmp.SelectBehavior.Select }) + else + vim.api.nvim_feedkeys(t(''), 'n', true) + end + end, + i = function(fallback) + if cmp.visible() then + cmp.select_prev_item({ behavior = cmp.SelectBehavior.Select }) + else + fallback() + end + end + }), + [''] = cmp.mapping(cmp.mapping.scroll_docs(-4), {'i', 'c'}), + [''] = cmp.mapping(cmp.mapping.scroll_docs(4), {'i', 'c'}), + [''] = cmp.mapping(cmp.mapping.complete(), {'i', 'c'}), + [''] = cmp.mapping({ i = cmp.mapping.close(), c = cmp.mapping.close() }), + [''] = cmp.mapping.confirm({ select = true }), + [''] = cmp.mapping(cmp.mapping.select_next_item({ behavior = cmp.SelectBehavior.Select }), {'i'}), + [''] = cmp.mapping(cmp.mapping.select_prev_item({ behavior = cmp.SelectBehavior.Select }), {'i'}), + [""] = cmp.mapping({ + c = function() + if cmp.visible() then + cmp.select_next_item({ behavior = cmp.SelectBehavior.Insert }) + else + cmp.complete() + end + end, + i = function(fallback) + local has_words_before = function() + local unpack = unpack or table.unpack + local line, col = unpack(vim.api.nvim_win_get_cursor(0)) + return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil + end + if cmp.visible() then + cmp.select_next_item() + elseif require('luasnip').expand_or_jumpable() then + require('luasnip').expand_or_jump() + elseif has_words_before() then + cmp.complete() + else + fallback() + end + end, + s = function(fallback) + local has_words_before = function() + local unpack = unpack or table.unpack + local line, col = unpack(vim.api.nvim_win_get_cursor(0)) + return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil + end + if cmp.visible() then + cmp.select_next_item() + elseif require('luasnip').expand_or_jumpable() then + require('luasnip').expand_or_jump() + elseif has_words_before() then + cmp.complete() + else + fallback() + end + end + }), + [""] = cmp.mapping({ + c = function() + if cmp.visible() then + cmp.select_prev_item({ behavior = cmp.SelectBehavior.Insert }) + else + cmp.complete() + end + end, + i = function(fallback) + if cmp.visible() then + cmp.select_prev_item() + elseif require('luasnip').jumpable(-1) then + require('luasnip').jump(-1) + else + fallback() + end + end, + s = function(fallback) + if cmp.visible() then + cmp.select_prev_item() + elseif require('luasnip').jumpable(-1) then + require('luasnip').jump(-1) + else + fallback() + end + end + }), + }) + ''; + }; + }; + cmdline = { + "/" = { + sources = [ + { + name = "buffer"; + } + ]; + }; + ":" = { + sources = [ + { + name = "path"; + } + { + name = "cmdline"; + } + ]; + }; + "?" = { + mapping = { + completion.completeopt = "menuone,noselect"; + __raw = "cmp.mapping.preset.cmdline({ + [''] = cmp.mapping.scroll_docs(-4), + [''] = cmp.mapping.scroll_docs(4), + [''] = cmp.mapping.complete(), + [''] = cmp.mapping.abort(), + })"; + }; + sources = [ + { + name = "cmdline"; + ignoreCmds = [ + "Man" + "!" + ]; + } + ]; + }; + }; + }; + }; +} diff --git a/modules/nixvim/plugins/lsp/default.nix b/modules/nixvim/plugins/lsp/default.nix new file mode 100644 index 0000000..1079197 --- /dev/null +++ b/modules/nixvim/plugins/lsp/default.nix @@ -0,0 +1,7 @@ +{ + imports = [ + ./languages + ./cmp.nix + ./lsp.nix + ]; +} diff --git a/modules/nixvim/plugins/lsp/languages/c.nix b/modules/nixvim/plugins/lsp/languages/c.nix new file mode 100644 index 0000000..d6cbec0 --- /dev/null +++ b/modules/nixvim/plugins/lsp/languages/c.nix @@ -0,0 +1,5 @@ +{ + plugins.lsp.servers.clangd = { + enable = true; + }; +} diff --git a/modules/nixvim/plugins/lsp/languages/default.nix b/modules/nixvim/plugins/lsp/languages/default.nix new file mode 100644 index 0000000..3d846fc --- /dev/null +++ b/modules/nixvim/plugins/lsp/languages/default.nix @@ -0,0 +1,20 @@ +{ + imports = [ + ./rust.nix + ./lua.nix + ./nix.nix + ./go.nix + ./htmx.nix + ./typescript.nix + ./emmet.nix + ./eslint.nix + ./html.nix + ./json.nix + ./python.nix + ./tailwindcss.nix + ./yaml.nix + ./c.nix + ./templ.nix + ./sql.nix + ]; +} diff --git a/modules/nixvim/plugins/lsp/languages/emmet.nix b/modules/nixvim/plugins/lsp/languages/emmet.nix new file mode 100644 index 0000000..9d21817 --- /dev/null +++ b/modules/nixvim/plugins/lsp/languages/emmet.nix @@ -0,0 +1,25 @@ +{ + plugins.lsp = { + servers = { + emmet_ls = { + enable = true; + filetypes = [ + "astro" + "css" + "eruby" + "html" + "htmldjango" + "javascriptreact" + "less" + "pug" + "sass" + "scss" + "svelte" + "typescriptreact" + "vue" + "templ" + ]; + }; + }; + }; +} diff --git a/modules/nixvim/plugins/lsp/languages/eslint.nix b/modules/nixvim/plugins/lsp/languages/eslint.nix new file mode 100644 index 0000000..101b366 --- /dev/null +++ b/modules/nixvim/plugins/lsp/languages/eslint.nix @@ -0,0 +1,9 @@ +{ + plugins.lsp = { + servers = { + eslint = { + enable = true; + }; + }; + }; +} diff --git a/modules/nixvim/plugins/lsp/languages/go.nix b/modules/nixvim/plugins/lsp/languages/go.nix new file mode 100644 index 0000000..211f346 --- /dev/null +++ b/modules/nixvim/plugins/lsp/languages/go.nix @@ -0,0 +1,58 @@ +{pkgs, ...}: { + plugins = { + lsp = { + servers = { + golangci-lint-ls = { + enable = true; + cmd = ["${pkgs.golangci-lint-langserver}/bin/golangci-lint-langserver" "run" "--out-format" "json"]; + }; + gopls = { + enable = true; + extraOptions.settings = { + gopls = { + gofumpt = true; + staticcheck = true; + directoryFilters = ["-.git" "-.vscode" "-.idea" "-.vscode-test" "-node_modules"]; + semanticTokens = true; + completeUnimported = true; + usePlaceholders = true; + codelenses = { + gc_details = false; + generate = true; + regenerate_cgo = true; + run_govulncheck = true; + test = true; + tidy = true; + upgrade_dependency = true; + vendor = true; + }; + hints = { + assignVariableTypes = true; + compositeLiteralFields = true; + compositeLiteralTypes = true; + constantValues = true; + functionTypeParameters = true; + parameterNames = true; + rangeVariableTypes = true; + }; + analyses = { + assign = true; + bools = true; + defers = true; + deprecated = true; + fieldalignment = true; + tests = true; + nilness = true; + httpresponse = true; + unmarshal = true; + unusedparams = true; + unusedwrite = true; + useany = true; + }; + }; + }; + }; + }; + }; + }; +} diff --git a/modules/nixvim/plugins/lsp/languages/html.nix b/modules/nixvim/plugins/lsp/languages/html.nix new file mode 100644 index 0000000..e7df7d8 --- /dev/null +++ b/modules/nixvim/plugins/lsp/languages/html.nix @@ -0,0 +1,15 @@ +{ + plugins.lsp = { + servers = { + html = { + enable = true; + extraOptions.settings.html = { + format = { + wrapLineLength = 79; + wrapAttributes = "force-aligned"; + }; + }; + }; + }; + }; +} diff --git a/modules/nixvim/plugins/lsp/languages/htmx.nix b/modules/nixvim/plugins/lsp/languages/htmx.nix new file mode 100644 index 0000000..721ddf5 --- /dev/null +++ b/modules/nixvim/plugins/lsp/languages/htmx.nix @@ -0,0 +1,7 @@ +{ + plugins.lsp = { + servers = { + htmx.enable = true; + }; + }; +} diff --git a/modules/nixvim/plugins/lsp/languages/json.nix b/modules/nixvim/plugins/lsp/languages/json.nix new file mode 100644 index 0000000..4ad7539 --- /dev/null +++ b/modules/nixvim/plugins/lsp/languages/json.nix @@ -0,0 +1,7 @@ +{ + plugins.lsp = { + servers = { + jsonls.enable = true; + }; + }; +} diff --git a/modules/nixvim/plugins/lsp/languages/lua.nix b/modules/nixvim/plugins/lsp/languages/lua.nix new file mode 100644 index 0000000..2fe6b90 --- /dev/null +++ b/modules/nixvim/plugins/lsp/languages/lua.nix @@ -0,0 +1,7 @@ +{ + plugins.lsp = { + servers = { + lua-ls.enable = true; + }; + }; +} diff --git a/modules/nixvim/plugins/lsp/languages/nix.nix b/modules/nixvim/plugins/lsp/languages/nix.nix new file mode 100644 index 0000000..00b5972 --- /dev/null +++ b/modules/nixvim/plugins/lsp/languages/nix.nix @@ -0,0 +1,10 @@ +{ + plugins.lsp = { + servers = { + nil_ls = { + enable = true; + settings.formatting.command = ["alejandra"]; + }; + }; + }; +} diff --git a/modules/nixvim/plugins/lsp/languages/python.nix b/modules/nixvim/plugins/lsp/languages/python.nix new file mode 100644 index 0000000..dfca5ca --- /dev/null +++ b/modules/nixvim/plugins/lsp/languages/python.nix @@ -0,0 +1,8 @@ +{ + plugins.lsp = { + servers = { + ruff-lsp.enable = true; + pyright.enable = true; + }; + }; +} diff --git a/modules/nixvim/plugins/lsp/languages/rust.nix b/modules/nixvim/plugins/lsp/languages/rust.nix new file mode 100644 index 0000000..fa81f7f --- /dev/null +++ b/modules/nixvim/plugins/lsp/languages/rust.nix @@ -0,0 +1,19 @@ +{ + plugins = { + rustaceanvim = { + enable = true; + extraOptions = { + server = { + default_settings = { + rust-analyzer = { + check = { + command = "clippy"; + }; + }; + }; + }; + }; + }; + crates-nvim.enable = true; + }; +} diff --git a/modules/nixvim/plugins/lsp/languages/sql.nix b/modules/nixvim/plugins/lsp/languages/sql.nix new file mode 100644 index 0000000..19b387c --- /dev/null +++ b/modules/nixvim/plugins/lsp/languages/sql.nix @@ -0,0 +1,5 @@ +{ + plugins.lsp.servers.sqls = { + enable = true; + }; +} diff --git a/modules/nixvim/plugins/lsp/languages/tailwindcss.nix b/modules/nixvim/plugins/lsp/languages/tailwindcss.nix new file mode 100644 index 0000000..68ff329 --- /dev/null +++ b/modules/nixvim/plugins/lsp/languages/tailwindcss.nix @@ -0,0 +1,7 @@ +{ + plugins.lsp = { + servers = { + tailwindcss.enable = true; + }; + }; +} diff --git a/modules/nixvim/plugins/lsp/languages/templ.nix b/modules/nixvim/plugins/lsp/languages/templ.nix new file mode 100644 index 0000000..ba5db88 --- /dev/null +++ b/modules/nixvim/plugins/lsp/languages/templ.nix @@ -0,0 +1,7 @@ +{ + plugins.lsp = { + servers = { + templ.enable = true; + }; + }; +} diff --git a/modules/nixvim/plugins/lsp/languages/typescript.nix b/modules/nixvim/plugins/lsp/languages/typescript.nix new file mode 100644 index 0000000..db04c50 --- /dev/null +++ b/modules/nixvim/plugins/lsp/languages/typescript.nix @@ -0,0 +1,7 @@ +{ + plugins.lsp = { + servers = { + tsserver.enable = true; + }; + }; +} diff --git a/modules/nixvim/plugins/lsp/languages/yaml.nix b/modules/nixvim/plugins/lsp/languages/yaml.nix new file mode 100644 index 0000000..b5c1cf2 --- /dev/null +++ b/modules/nixvim/plugins/lsp/languages/yaml.nix @@ -0,0 +1,5 @@ +{ + plugins.lsp.servers = { + yamlls.enable = true; + }; +} diff --git a/modules/nixvim/plugins/lsp/lsp.nix b/modules/nixvim/plugins/lsp/lsp.nix new file mode 100644 index 0000000..10b89ca --- /dev/null +++ b/modules/nixvim/plugins/lsp/lsp.nix @@ -0,0 +1,22 @@ +{ + plugins.lsp = { + enable = true; + keymaps = { + lspBuf = { + "gd" = "definition"; + "gD" = "references"; + "gt" = "type_definition"; + "gi" = "implementation"; + "K" = "hover"; + "fm" = "format"; + "rn" = "rename"; + "ca" = "code_action"; + }; + }; + onAttach = '' + if client.server_capabilities.inlayHintProvider then + vim.lsp.inlay_hint.enable(bufnr, true) + end + ''; + }; +} diff --git a/modules/nixvim/plugins/lualine.nix b/modules/nixvim/plugins/lualine.nix new file mode 100644 index 0000000..f1f3660 --- /dev/null +++ b/modules/nixvim/plugins/lualine.nix @@ -0,0 +1,102 @@ +{pkgs, ...}: { + plugins.lualine = { + enable = true; + sections = { + lualine_a = ["" "mode"]; + lualine_b = [ + "branch" + "diff" + ]; + lualine_c = [ + { + name = "filetype"; + extraConfig = {icon_only = true;}; + } + "filename" + "diagnostics" + { + name = "lsp_progress"; + extraConfig = { + display_components = [ + "lsp_client_name" + [ + "title" + "percentage" + "message" + ] + ]; + colors = { + use = true; + lsp_client_name = { __raw = "colors.sapphire"; }; + percentage = { __raw = "colors.blue"; }; + spinner = { __raw = "colors.blue"; }; + title = { __raw = "colors.subtext1"; }; + message = { __raw = "colors.subtext0"; }; + }; + }; + } + ]; + lualine_x = [""]; + lualine_y = [ + "encoding" + "fileformat" + ]; + lualine_z = [ + "progress" + ]; + }; + winbar = { + lualine_x = [ + { + name = "filename"; + extraConfig = {path = 1;}; + } + { + name = "filetype"; + extraConfig = {icon_only = true;}; + } + ]; + }; + inactiveWinbar = { + lualine_x = [ + "diagnostics" + { + name = "filename"; + extraConfig = {path = 1;}; + } + { + name = "filetype"; + extraConfig = {icon_only = true;}; + } + ]; + }; + extensions = ["fugitive" "lazy" "man" "neo-tree" "nvim-dap-ui" "quickfix"]; + componentSeparators = { + left = ""; + right = ""; + }; + sectionSeparators = { + left = ""; + right = ""; + }; + theme = "catppuccin"; + disabledFiletypes = { + statusline = []; + winbar = [ + "help" + "lazy" + "neo-tree" + "dapui_stacks" + "dapui_watches" + "dapui_breakpoints" + "dapui_scopes" + "dapui_console" + "dap-repl" + "fugitive" + ]; + }; + }; + extraPlugins = with pkgs.vimPlugins; [ + lualine-lsp-progress + ]; +} diff --git a/modules/nixvim/plugins/mini.nix b/modules/nixvim/plugins/mini.nix new file mode 100644 index 0000000..a3e8d2a --- /dev/null +++ b/modules/nixvim/plugins/mini.nix @@ -0,0 +1,47 @@ +{ + plugins.mini = { + enable = true; + modules = { + comment = {}; + cursorword = {}; + surround = { + custom_surroundings = { + "(" = { + output = { + left = "( "; + right = " )"; + }; + }; + "[" = { + output = { + left = "[ "; + right = " ]"; + }; + }; + "{" = { + output = { + left = "{ "; + right = " }"; + }; + }; + "<" = { + output = { + left = "< "; + right = " >"; + }; + }; + }; + mappings = { + add = "ys"; + delete = "ds"; + find = "fs"; + find_left = "Fs"; + highlight = ""; + replace = "cs"; + update_n_lines = ""; + }; + search_method = "cover_or_next"; + }; + }; + }; +} diff --git a/modules/nixvim/plugins/neo-tree.nix b/modules/nixvim/plugins/neo-tree.nix new file mode 100644 index 0000000..1187ff6 --- /dev/null +++ b/modules/nixvim/plugins/neo-tree.nix @@ -0,0 +1,47 @@ +{ + plugins.neo-tree = { + enable = true; + extraOptions = { + default_component_configs = { + icon = { + folder_closed = ""; + folder_open = ""; + folder_empty = ""; + folder_empty_open = ""; + }; + git_status = { + symbols = { + added = "✚"; + modified = ""; + deleted = "✖"; + untracked = ""; + ignored = ""; + staged = ""; + conflict = ""; + renamed = "󰁕"; + unstaged = "󰄱"; + }; + }; + diagnostics = { + symbols = { + hint = "󰌵"; + info = ""; + warn = ""; + error = ""; + }; + highlights = { + hint = "DiagnosticSignHint"; + info = "DiagnosticSignInfo"; + warn = "DiagnosticSignWarn"; + error = "DiagnosticSignError"; + }; + }; + }; + filesystem = { + filtered_items = { + hide_by_pattern = ["*_templ.go"]; + }; + }; + }; + }; +} diff --git a/modules/nixvim/plugins/neorg.nix b/modules/nixvim/plugins/neorg.nix new file mode 100644 index 0000000..731d1c8 --- /dev/null +++ b/modules/nixvim/plugins/neorg.nix @@ -0,0 +1,59 @@ +{ + plugins.neorg = { + enable = true; + modules = { + "core.defaults" = { + __empty = null; + }; + "core.concealer" = { + config = { + init_open_folds = "auto"; + }; + }; + "core.dirman" = { + config = { + workspaces = { + notes = "~/Sync/norg/notes"; + }; + default_workspace = "notes"; + }; + }; + "core.completion" = { + config = { + engine = "nvim-cmp"; + }; + }; + "core.summary" = { + __empty = null; + }; + "core.manoeuvre" = { + __empty = null; + }; + "core.tangle" = { + __empty = null; + }; + "core.export" = { + config = { + export_dir = "~/Sync/notes-export"; + }; + }; + "core.export.markdown" = { + __empty = null; + }; + "core.esupports.metagen" = { + config = { + type = "auto"; + }; + }; + "core.integrations.telescope" = { + __empty = null; + }; + }; + }; + keymaps = [ + { + key = "ni"; + action = ":Neorg index"; + } + ]; +} diff --git a/modules/nixvim/plugins/noice.nix b/modules/nixvim/plugins/noice.nix new file mode 100644 index 0000000..bfe69bf --- /dev/null +++ b/modules/nixvim/plugins/noice.nix @@ -0,0 +1,77 @@ +{ + plugins.noice = { + enable = true; + cmdline = { + view = "cmdline"; + format = { + cmdline = { + pattern = "^:"; + icon = ""; + lang = "vim"; + }; + search_down = { + kind = "search"; + pattern = "^/"; + icon = "󰍉 "; + lang = "regex"; + }; + search_up = { + kind = "search"; + pattern = "^%?"; + icon = "󰍉 "; + lang = "regex"; + }; + filter = { + pattern = "^:%s*!"; + icon = "$"; + lang = "bash"; + }; + lua = { + pattern = ["^:%s*lua%s+" "^:%s*lua%s*=%s*" "^:%s*=%s*"]; + icon = ""; + lang = "lua"; + }; + help = { + pattern = "^:%s*he?l?p?%s+"; + icon = ""; + }; + input = {}; + }; + }; + lsp = { + override = { + "vim.lsp.util.convert_input_to_markdown_lines" = true; + "vim.lsp.util.stylize_markdown" = true; + "cmp.entry.get_documentation" = true; + }; + hover = { + enabled = true; + view = "hover"; + + }; + }; + presets = { + bottom_search = true; + command_palette = true; + long_message_to_split = false; + inc_rename = false; + lsp_doc_border = true; + }; + popupmenu = { + enabled = true; + backend = "cmp"; + }; + views = { + hover = { + border = { + style = "none"; + padding = [ 0 0 ]; + }; + filter_options = {}; + win_options = { + winhighlight = "NormalFloat:NormalFloat,FloatBorder:FloatBorder"; + }; + }; + }; + }; +} diff --git a/modules/nixvim/plugins/none-ls.nix b/modules/nixvim/plugins/none-ls.nix new file mode 100644 index 0000000..4807b75 --- /dev/null +++ b/modules/nixvim/plugins/none-ls.nix @@ -0,0 +1,15 @@ +{ + plugins.none-ls = { + enable = true; + sources = { + code_actions = { + statix.enable = true; + }; + diagnostics = { + statix.enable = true; + commitlint.enable = true; + cppcheck.enable = true; + }; + }; + }; +} diff --git a/modules/nixvim/plugins/rainbow-delimiters.nix b/modules/nixvim/plugins/rainbow-delimiters.nix new file mode 100644 index 0000000..e6dd9ed --- /dev/null +++ b/modules/nixvim/plugins/rainbow-delimiters.nix @@ -0,0 +1,16 @@ +_: let + highlight = [ + "RainbowRed" + "RainbowYellow" + "RainbowBlue" + "RainbowOrange" + "RainbowGreen" + "RainbowViolet" + "RainbowCyan" + ]; +in { + plugins.rainbow-delimiters = { + inherit highlight; + enable = true; + }; +} diff --git a/modules/nixvim/plugins/telescope.nix b/modules/nixvim/plugins/telescope.nix new file mode 100644 index 0000000..7447ed9 --- /dev/null +++ b/modules/nixvim/plugins/telescope.nix @@ -0,0 +1,66 @@ +{ + plugins.telescope = { + enable = true; + keymaps = { + "fg" = "live_grep"; + "fb" = "buffers"; + "fo" = "oldfiles"; + "ff" = { + action = "git_files"; + options = { + desc = "Telescope Git Files"; + }; + }; + }; + extensions = { + fzf-native.enable = true; + ui-select.enable = true; + }; + settings = { + defaults = { + prompt_prefix = " 󰍉 "; + selection_caret = " "; + entry_prefix = " "; + initial_mode = "insert"; + selection_strategy = "reset"; + sorting_strategy = "ascending"; + layout_strategy = "horizontal"; + layout_config = { + horizontal = { + prompt_position = "top"; + preview_width = 0.55; + results_width = 0.8; + }; + vertical = { + mirror = true; + }; + width = 0.87; + height = 0.80; + preview_cutoff = 120; + }; + file_ignore_patterns = ["node_modules" "vendor"]; + path_display = ["truncate"]; + winblend = 3; + border = {}; + borderchars = [" " " " " " " " " " " " " " " "]; + color_devicons = true; + pickers = { + find_files = { + find_command = ["rg" "--files" "--hidden" "--glob" "!**/.git/*"]; + }; + }; + mappings = { + i = { + "" = { + __raw = '' + function(...) + return require("telescope.actions").close(...) + end + ''; + }; + }; + }; + }; + }; + }; +} diff --git a/modules/nixvim/plugins/todo-comments.nix b/modules/nixvim/plugins/todo-comments.nix new file mode 100644 index 0000000..9e2893e --- /dev/null +++ b/modules/nixvim/plugins/todo-comments.nix @@ -0,0 +1,3 @@ +{ + plugins.todo-comments.enable = true; + } diff --git a/modules/nixvim/plugins/treesitter.nix b/modules/nixvim/plugins/treesitter.nix new file mode 100644 index 0000000..e408c4e --- /dev/null +++ b/modules/nixvim/plugins/treesitter.nix @@ -0,0 +1,7 @@ +{ + plugins.treesitter = { + enable = true; + indent = true; + folding = true; + }; +} diff --git a/modules/nixvim/plugins/trouble.nix b/modules/nixvim/plugins/trouble.nix new file mode 100644 index 0000000..b92e519 --- /dev/null +++ b/modules/nixvim/plugins/trouble.nix @@ -0,0 +1,33 @@ +{ + plugins.trouble.enable = true; + keymaps = [ + { + key = "xx"; + action = "TroubleToggle"; + options = { + silent = true; + }; + } + { + key = "xd"; + action = "TroubleToggle document_diagnostics"; + options = { + silent = true; + }; + } + { + key = "xw"; + action = "TroubleToggle workspace_diagnostics"; + options = { + silent = true; + }; + } + { + key = "xq"; + action = "TroubleToggle quickfix"; + options = { + silent = true; + }; + } + ]; +} diff --git a/modules/nixvim/plugins/undotree.nix b/modules/nixvim/plugins/undotree.nix new file mode 100644 index 0000000..a361441 --- /dev/null +++ b/modules/nixvim/plugins/undotree.nix @@ -0,0 +1,3 @@ +{ + plugins.undotree.enable = true; +} diff --git a/modules/nixvim/plugins/vim-tmux-navigator.nix b/modules/nixvim/plugins/vim-tmux-navigator.nix new file mode 100644 index 0000000..6ad953c --- /dev/null +++ b/modules/nixvim/plugins/vim-tmux-navigator.nix @@ -0,0 +1,3 @@ +{ + plugins.tmux-navigator.enable = true; + } diff --git a/modules/nixvim/plugins/which-key.nix b/modules/nixvim/plugins/which-key.nix new file mode 100644 index 0000000..f34240b --- /dev/null +++ b/modules/nixvim/plugins/which-key.nix @@ -0,0 +1,3 @@ +{ + plugins.which-key.enable = true; + } diff --git a/modules/nixvim/snippets/go.lua b/modules/nixvim/snippets/go.lua new file mode 100644 index 0000000..001bc64 --- /dev/null +++ b/modules/nixvim/snippets/go.lua @@ -0,0 +1,8 @@ +local ls = require("luasnip") + + -- for "all" filetypes create snippet for "func" + ls.add_snippets( "all", { + ls.parser.parse_snippet( + 'iferr', + 'if err != nil {\n\t${1}\n}'), + }) diff --git a/pkgs/nixvim/default.nix b/pkgs/nixvim/default.nix new file mode 100644 index 0000000..bd4e964 --- /dev/null +++ b/pkgs/nixvim/default.nix @@ -0,0 +1,21 @@ +{ + nixpkgs, + system, + inputs, + flakeLib, + ... +}: let + module = flakeLib.mkNixVimModule { + pkgs = flakeLib.mkPkgs { + inherit system nixpkgs; + overlays = [ + inputs.neovim-nightly-overlay.overlays.default + ]; + }; + module = import ../../modules/nixvim; + }; + nvim = flakeLib.mkNixVim { + inherit system inputs module; + }; +in + nvim diff --git a/pkgs/tmuxPlugins/catppuccin.nix b/pkgs/tmuxPlugins/catppuccin.nix new file mode 100644 index 0000000..c78eff9 --- /dev/null +++ b/pkgs/tmuxPlugins/catppuccin.nix @@ -0,0 +1,11 @@ +{ pkgs, ... }: +pkgs.tmuxPlugins.mkTmuxPlugin { + pluginName = "catppuccin"; + version = "unstable-2024-03-26"; + src = pkgs.fetchFromGitHub { + owner = "catppuccin"; + repo = "tmux"; + rev = "e2d345648cb7e56302ee82fec6cafbbd8db23129"; + hash = "sha256-78TRFzWUKLR4QuZeiXTa4SzWHxprWav93G21uUKzBfA="; + }; +} diff --git a/profiles/home-manager/desktop-dev.nix b/profiles/home-manager/desktop-dev.nix new file mode 100644 index 0000000..68f49f5 --- /dev/null +++ b/profiles/home-manager/desktop-dev.nix @@ -0,0 +1,19 @@ +{ + inputs, + outputs, + pkgs, + extraSpecialArgs, + modules ? [], + ... +}: +inputs.home-manager.lib.homeManagerConfiguration { + inherit pkgs extraSpecialArgs; + modules = + [ + outputs.homeManagerModules.base + outputs.homeManagerModules.shell + outputs.homeManagerModules.desktop + outputs.homeManagerModules.dev + ] + ++ modules; +} diff --git a/profiles/home-manager/desktop.nix b/profiles/home-manager/desktop.nix new file mode 100644 index 0000000..d53d019 --- /dev/null +++ b/profiles/home-manager/desktop.nix @@ -0,0 +1,18 @@ +{ + inputs, + outputs, + pkgs, + extraSpecialArgs, + modules ? [], + ... +}: +inputs.home-manager.lib.homeManagerConfiguration { + inherit pkgs extraSpecialArgs; + modules = + [ + outputs.homeManagerModules.base + outputs.homeManagerModules.shell + outputs.homeManagerModules.desktop + ] + ++ modules; +} diff --git a/profiles/home-manager/shell-dev.nix b/profiles/home-manager/shell-dev.nix new file mode 100644 index 0000000..f50364d --- /dev/null +++ b/profiles/home-manager/shell-dev.nix @@ -0,0 +1,18 @@ +{ + inputs, + outputs, + pkgs, + extraSpecialArgs, + modules ? [], + ... +}: +inputs.home-manager.lib.homeManagerConfiguration { + inherit pkgs extraSpecialArgs; + modules = + [ + outputs.homeManagerModules.base + outputs.homeManagerModules.shell + outputs.homeManagerModules.dev + ] + ++ modules; +} diff --git a/profiles/home-manager/shell.nix b/profiles/home-manager/shell.nix new file mode 100644 index 0000000..f405995 --- /dev/null +++ b/profiles/home-manager/shell.nix @@ -0,0 +1,17 @@ +{ + inputs, + outputs, + pkgs, + extraSpecialArgs, + modules ? [], + ... +}: +inputs.home-manager.lib.homeManagerConfiguration { + inherit pkgs extraSpecialArgs; + modules = + [ + outputs.homeManagerModules.base + outputs.homeManagerModules.shell + ] + ++ modules; +}