From 912eedb3d4b9727fe3fbfc02150b54ef1dfc4a8c Mon Sep 17 00:00:00 2001 From: Patrick Neff Date: Sun, 28 Jan 2024 15:19:10 +0100 Subject: [PATCH] Initial Commit --- configs/direnv/stdlib.sh | 25 ++ configs/lf/colors | 174 ++++++++++ configs/lf/icons | 357 +++++++++++++++++++ configs/zsh/zshrc.zsh | 102 ++++++ flake.lock | 589 ++++++++++++++++++++++++++++++++ flake.nix | 81 +++++ lib/default.nix | 3 + lib/tmux.nix | 48 +++ modules/default.nix | 37 ++ modules/neovim.nix | 5 + modules/shell/btop.nix | 9 + modules/shell/default.nix | 14 + modules/shell/direnv.nix | 15 + modules/shell/fzf.nix | 16 + modules/shell/git.nix | 100 ++++++ modules/shell/lf.nix | 57 ++++ modules/shell/lsd.nix | 8 + modules/shell/starship.nix | 337 ++++++++++++++++++ modules/shell/tmux.nix | 87 +++++ modules/shell/zoxide.nix | 8 + modules/shell/zsh.nix | 46 +++ pkgs/tmuxPlugins/catppuccin.nix | 11 + 22 files changed, 2129 insertions(+) create mode 100644 configs/direnv/stdlib.sh create mode 100644 configs/lf/colors create mode 100644 configs/lf/icons create mode 100644 configs/zsh/zshrc.zsh create mode 100644 flake.lock create mode 100644 flake.nix create mode 100644 lib/default.nix create mode 100644 lib/tmux.nix create mode 100644 modules/default.nix create mode 100644 modules/neovim.nix create mode 100644 modules/shell/btop.nix create mode 100644 modules/shell/default.nix create mode 100644 modules/shell/direnv.nix create mode 100644 modules/shell/fzf.nix create mode 100644 modules/shell/git.nix create mode 100644 modules/shell/lf.nix create mode 100644 modules/shell/lsd.nix create mode 100644 modules/shell/starship.nix create mode 100644 modules/shell/tmux.nix create mode 100644 modules/shell/zoxide.nix create mode 100644 modules/shell/zsh.nix create mode 100644 pkgs/tmuxPlugins/catppuccin.nix diff --git a/configs/direnv/stdlib.sh b/configs/direnv/stdlib.sh new file mode 100644 index 0000000..5718d00 --- /dev/null +++ b/configs/direnv/stdlib.sh @@ -0,0 +1,25 @@ +layout_postgres() { +PGDATA="$(direnv_layout_dir)/postgres" +PGHOST="$PGDATA" +export PGDATA +export PGHOST + +if [[ ! -d "$PGDATA" ]]; then +initdb +cat >> "$PGDATA/postgresql.conf" <<-EOF +listen_addresses = '' +unix_socket_directories = '$PGHOST' +EOF +echo "CREATE DATABASE $USER;" | postgres --single -E postgres +fi +} + +layout_symfony() { +PATH_add bin +} + +layout_python() { +PYTHONPATH_add src +} + +# vim: ft=bash diff --git a/configs/lf/colors b/configs/lf/colors new file mode 100644 index 0000000..b65d3f0 --- /dev/null +++ b/configs/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/lf/icons b/configs/lf/icons new file mode 100644 index 0000000..404f9e5 --- /dev/null +++ b/configs/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/zsh/zshrc.zsh b/configs/zsh/zshrc.zsh new file mode 100644 index 0000000..3203dc3 --- /dev/null +++ b/configs/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..d0c3c6a --- /dev/null +++ b/flake.lock @@ -0,0 +1,589 @@ +{ + "nodes": { + "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": { + "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": [ + "neovim", + "neovim-nightly-overlay", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1704982712, + "narHash": "sha256-2Ptt+9h8dczgle2Oo6z5ni5rt/uLMG47UFTR1ry/wgg=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "07f6395285469419cf9d078f59b5b49993198c00", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, + "flake-parts_2": { + "inputs": { + "nixpkgs-lib": [ + "neovim", + "neovim-nightly-overlay", + "hercules-ci-effects", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1701473968, + "narHash": "sha256-YcVE5emp1qQ8ieHUnxt1wCZCC3ZfAS+SRRWZ2TMda7E=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "34fed993f1674c8d06d58b37ce1e0fe5eebcb9f5", + "type": "github" + }, + "original": { + "id": "flake-parts", + "type": "indirect" + } + }, + "flake-parts_3": { + "inputs": { + "nixpkgs-lib": [ + "neovim-nightly-overlay", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1704982712, + "narHash": "sha256-2Ptt+9h8dczgle2Oo6z5ni5rt/uLMG47UFTR1ry/wgg=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "07f6395285469419cf9d078f59b5b49993198c00", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, + "flake-parts_4": { + "inputs": { + "nixpkgs-lib": [ + "neovim-nightly-overlay", + "hercules-ci-effects", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1701473968, + "narHash": "sha256-YcVE5emp1qQ8ieHUnxt1wCZCC3ZfAS+SRRWZ2TMda7E=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "34fed993f1674c8d06d58b37ce1e0fe5eebcb9f5", + "type": "github" + }, + "original": { + "id": "flake-parts", + "type": "indirect" + } + }, + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1705309234, + "narHash": "sha256-uNRRNRKmJyCRC/8y1RqBkqWBLM034y4qN7EprSdmgyA=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "1ef2e671c3b0c19053962c07dbda38332dcebf26", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "flake-utils_2": { + "inputs": { + "systems": "systems_2" + }, + "locked": { + "lastModified": 1705309234, + "narHash": "sha256-uNRRNRKmJyCRC/8y1RqBkqWBLM034y4qN7EprSdmgyA=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "1ef2e671c3b0c19053962c07dbda38332dcebf26", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "flake-utils_3": { + "inputs": { + "systems": "systems_3" + }, + "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_4": { + "inputs": { + "systems": "systems_4" + }, + "locked": { + "lastModified": 1701680307, + "narHash": "sha256-kAuep2h5ajznlPMD9rnQyffWG8EM/C73lejGofXvdM8=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "4022d587cbbfd70fe950c1e2083a02621806a725", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "gopher-nvim": { + "flake": false, + "locked": { + "lastModified": 1696856053, + "narHash": "sha256-8arSYelWObRnzNQ1F4wh/U44USy5aQFIGA9Aa7p9XXM=", + "owner": "olexsmir", + "repo": "gopher.nvim", + "rev": "ac27f4b6794c872140fb205313d79ab166892fe9", + "type": "github" + }, + "original": { + "owner": "olexsmir", + "repo": "gopher.nvim", + "type": "github" + } + }, + "hercules-ci-effects": { + "inputs": { + "flake-parts": "flake-parts_2", + "nixpkgs": [ + "neovim", + "neovim-nightly-overlay", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1704029560, + "narHash": "sha256-a4Iu7x1OP+uSYpqadOu8VCPY+MPF3+f6KIi+MAxlgyw=", + "owner": "hercules-ci", + "repo": "hercules-ci-effects", + "rev": "d5cbf433a6ae9cae05400189a8dbc6412a03ba16", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "hercules-ci-effects", + "type": "github" + } + }, + "hercules-ci-effects_2": { + "inputs": { + "flake-parts": "flake-parts_4", + "nixpkgs": [ + "neovim-nightly-overlay", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1704029560, + "narHash": "sha256-a4Iu7x1OP+uSYpqadOu8VCPY+MPF3+f6KIi+MAxlgyw=", + "owner": "hercules-ci", + "repo": "hercules-ci-effects", + "rev": "d5cbf433a6ae9cae05400189a8dbc6412a03ba16", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "hercules-ci-effects", + "type": "github" + } + }, + "home-manager": { + "inputs": { + "nixpkgs": "nixpkgs" + }, + "locked": { + "lastModified": 1706134977, + "narHash": "sha256-KwNb1Li3K6vuVwZ77tFjZ89AWBo7AiCs9t0Cens4BsM=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "6359d40f6ec0b72a38e02b333f343c3d4929ec10", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "home-manager", + "type": "github" + } + }, + "home-manager_2": { + "inputs": { + "nixpkgs": "nixpkgs_2" + }, + "locked": { + "lastModified": 1706134977, + "narHash": "sha256-KwNb1Li3K6vuVwZ77tFjZ89AWBo7AiCs9t0Cens4BsM=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "6359d40f6ec0b72a38e02b333f343c3d4929ec10", + "type": "github" + }, + "original": { + "id": "home-manager", + "type": "indirect" + } + }, + "neovim": { + "inputs": { + "flake-utils": "flake-utils_2", + "gopher-nvim": "gopher-nvim", + "home-manager": "home-manager_2", + "neovim-nightly-overlay": "neovim-nightly-overlay", + "nixpkgs": "nixpkgs_4" + }, + "locked": { + "lastModified": 1706451507, + "narHash": "sha256-TfrqIL5laTLh4g1AhcB1u2xVdIwKhZe9s2JbN1XTQK4=", + "ref": "refs/heads/master", + "rev": "a5dab140d0f3837ed4f70fdf1bb30fec72e7800e", + "revCount": 1, + "type": "git", + "url": "file:///home/odie/Code/nix/neovim-config" + }, + "original": { + "type": "git", + "url": "file:///home/odie/Code/nix/neovim-config" + } + }, + "neovim-flake": { + "inputs": { + "flake-utils": "flake-utils_3", + "nixpkgs": [ + "neovim", + "neovim-nightly-overlay", + "nixpkgs" + ] + }, + "locked": { + "dir": "contrib", + "lastModified": 1706140641, + "narHash": "sha256-H1qHhkf7sF7yrG2rb9Ks1Y4EtLY3cXGp16KCGveJWY4=", + "owner": "neovim", + "repo": "neovim", + "rev": "4e59422e1d4950a3042bad41a7b81c8db4f8b648", + "type": "github" + }, + "original": { + "dir": "contrib", + "owner": "neovim", + "repo": "neovim", + "type": "github" + } + }, + "neovim-flake_2": { + "inputs": { + "flake-utils": "flake-utils_4", + "nixpkgs": [ + "neovim-nightly-overlay", + "nixpkgs" + ] + }, + "locked": { + "dir": "contrib", + "lastModified": 1706140641, + "narHash": "sha256-H1qHhkf7sF7yrG2rb9Ks1Y4EtLY3cXGp16KCGveJWY4=", + "owner": "neovim", + "repo": "neovim", + "rev": "4e59422e1d4950a3042bad41a7b81c8db4f8b648", + "type": "github" + }, + "original": { + "dir": "contrib", + "owner": "neovim", + "repo": "neovim", + "type": "github" + } + }, + "neovim-nightly-overlay": { + "inputs": { + "flake-compat": "flake-compat", + "flake-parts": "flake-parts", + "hercules-ci-effects": "hercules-ci-effects", + "neovim-flake": "neovim-flake", + "nixpkgs": "nixpkgs_3" + }, + "locked": { + "lastModified": 1706141075, + "narHash": "sha256-o66/XFTXmcJSpEcO508V5r765HtgT8qtr+H4LRIB9BY=", + "owner": "nix-community", + "repo": "neovim-nightly-overlay", + "rev": "1da2e054a16309d7d7f7669438c8b9a5ef1b4642", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "neovim-nightly-overlay", + "type": "github" + } + }, + "neovim-nightly-overlay_2": { + "inputs": { + "flake-compat": "flake-compat_2", + "flake-parts": "flake-parts_3", + "hercules-ci-effects": "hercules-ci-effects_2", + "neovim-flake": "neovim-flake_2", + "nixpkgs": "nixpkgs_5" + }, + "locked": { + "lastModified": 1706141075, + "narHash": "sha256-o66/XFTXmcJSpEcO508V5r765HtgT8qtr+H4LRIB9BY=", + "owner": "nix-community", + "repo": "neovim-nightly-overlay", + "rev": "1da2e054a16309d7d7f7669438c8b9a5ef1b4642", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "neovim-nightly-overlay", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1705856552, + "narHash": "sha256-JXfnuEf5Yd6bhMs/uvM67/joxYKoysyE3M2k6T3eWbg=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "612f97239e2cc474c13c9dafa0df378058c5ad8d", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-unstable": { + "locked": { + "lastModified": 1705856552, + "narHash": "sha256-JXfnuEf5Yd6bhMs/uvM67/joxYKoysyE3M2k6T3eWbg=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "612f97239e2cc474c13c9dafa0df378058c5ad8d", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_2": { + "locked": { + "lastModified": 1705677747, + "narHash": "sha256-eyM3okYtMgYDgmYukoUzrmuoY4xl4FUujnsv/P6I/zI=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "bbe7d8f876fbbe7c959c90ba2ae2852220573261", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_3": { + "locked": { + "lastModified": 1706006310, + "narHash": "sha256-nDPz0fj0IFcDhSTlXBU2aixcnGs2Jm4Zcuoj0QtmiXQ=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "b43bb235efeab5324c5e486882ef46749188eee2", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_4": { + "locked": { + "lastModified": 1705856552, + "narHash": "sha256-JXfnuEf5Yd6bhMs/uvM67/joxYKoysyE3M2k6T3eWbg=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "612f97239e2cc474c13c9dafa0df378058c5ad8d", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_5": { + "locked": { + "lastModified": 1706006310, + "narHash": "sha256-nDPz0fj0IFcDhSTlXBU2aixcnGs2Jm4Zcuoj0QtmiXQ=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "b43bb235efeab5324c5e486882ef46749188eee2", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_6": { + "locked": { + "lastModified": 1705916986, + "narHash": "sha256-iBpfltu6QvN4xMpen6jGGEb6jOqmmVQKUrXdOJ32u8w=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "d7f206b723e42edb09d9d753020a84b3061a79d8", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-23.11", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "home-manager": "home-manager", + "neovim": "neovim", + "neovim-nightly-overlay": "neovim-nightly-overlay_2", + "nixpkgs": "nixpkgs_6", + "nixpkgs-unstable": "nixpkgs-unstable" + } + }, + "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..4d29627 --- /dev/null +++ b/flake.nix @@ -0,0 +1,81 @@ +{ + description = "A very basic flake"; + + inputs = { + nixpkgs.url = "github:nixos/nixpkgs/nixos-23.11"; + nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable"; + flake-utils.url = "github:numtide/flake-utils"; + home-manager = { + url = "github:nix-community/home-manager"; + }; + neovim = { + url = "/home/odie/Code/nix/neovim-config"; + }; + neovim-nightly-overlay = { + url = "github:nix-community/neovim-nightly-overlay"; + }; + }; + + outputs = inputs@{ self, nixpkgs, flake-utils, home-manager, ... }: + let + inherit (self) outputs; + inputOverlays = [ + inputs.neovim-nightly-overlay.overlays.default + inputs.neovim.overlays.default + ]; + overlays = [ + (final: _prev: { + unstable = import inputs.nixpkgs-unstable { + inherit (final) system; + config.allowUnfree = true; + overlays = inputOverlays; + }; + }) + ] ++ inputOverlays; + localLib = { + mkPkgs = system: + import nixpkgs { + inherit system overlays; + }; + mkHomeManagerConfiguration = user: modules: system: + { + ${user} = home-manager.lib.homeManagerConfiguration { + pkgs = (localLib.mkPkgs system).unstable; # Home-manager requires 'pkgs' instance + extraSpecialArgs = { inherit inputs outputs; }; + inherit modules; + }; + }; + }; + in + { + homeConfigurations = localLib.mkHomeManagerConfiguration "odie" [ + (import ./modules) + ] "x86_64-linux"; + packages = flake-utils.lib.eachDefaultSystem + (system: + let + pkgs = localLib.mkPkgs system; + in + with pkgs; { + inherit (unstable) hello; + } + ); + } // flake-utils.lib.eachDefaultSystem (system: + let + pkgs = localLib.mkPkgs system; + in + { + formatter = pkgs.alejandra; + packages = with pkgs; { + inherit (unstable) hello; + }; + devShells = { + default = pkgs.mkShell { + name = "home-manager"; + buildInputs = with pkgs; [ + inputs.home-manager.packages.${system}.default + ]; + }; + }; + }); +} diff --git a/lib/default.nix b/lib/default.nix new file mode 100644 index 0000000..1143248 --- /dev/null +++ b/lib/default.nix @@ -0,0 +1,3 @@ +{ pkgs, ... }: { + tmux = pkgs.callPackage ./tmux.nix { }; +} diff --git a/lib/tmux.nix b/lib/tmux.nix new file mode 100644 index 0000000..31cc4c5 --- /dev/null +++ b/lib/tmux.nix @@ -0,0 +1,48 @@ +{ pkgs, ... }: +let + rtpPath = "share/tmux-plugins"; + + addRtp = path: rtpFilePath: attrs: derivation: + derivation // { rtp = "${derivation}/${path}/${rtpFilePath}"; } // { + overrideAttrs = f: mkTmuxPlugin (attrs // f attrs); + }; + + mkTmuxPlugin = + a@{ pluginName + , rtpFilePath ? (builtins.replaceStrings [ "-" ] [ "_" ] pluginName) + ".tmux" + , namePrefix ? "tmuxplugin-" + , src + , unpackPhase ? "" + , configurePhase ? ":" + , buildPhase ? ":" + , addonInfo ? null + , preInstall ? "" + , postInstall ? "" + , path ? pkgs.lib.getName pluginName + , ... + }: + if pkgs.lib.hasAttr "dependencies" a then + throw "dependencies attribute is obselete. see NixOS/nixpkgs#118034" # added 2021-04-01 + else + addRtp "${rtpPath}/${path}" rtpFilePath a (pkgs.stdenv.mkDerivation (a // { + pname = namePrefix + pluginName; + + inherit pluginName unpackPhase configurePhase buildPhase addonInfo preInstall postInstall; + + installPhase = '' + runHook preInstall + + target=$out/${rtpPath}/${path} + mkdir -p $out/${rtpPath} + cp -r . $target + if [ -n "$addonInfo" ]; then + echo "$addonInfo" > $target/addon-info.json + fi + + runHook postInstall + ''; + })); +in +{ + inherit mkTmuxPlugin; +} diff --git a/modules/default.nix b/modules/default.nix new file mode 100644 index 0000000..c3b7a84 --- /dev/null +++ b/modules/default.nix @@ -0,0 +1,37 @@ +{ pkgs, ... }: { + home = { + username = "odie"; + homeDirectory = "/home/odie"; + language.base = "de_DE.UTF-8"; + packages = with pkgs; [ + home-manager + #neovim-ide + ]; + sessionVariables = { + MANPAGER = "sh -c 'col -bx | bat -l man -p'"; + MANROFFOPT = "-c"; + }; + shellAliases = { + cat = "bat"; + }; + }; + + imports = [ + ./shell + ./neovim.nix + ]; + + programs = { + bat.enable = true; + ssh.enable = true; + }; + + services = { + ssh-agent.enable = true; + }; + + home = { + }; + + home.stateVersion = "23.05"; +} diff --git a/modules/neovim.nix b/modules/neovim.nix new file mode 100644 index 0000000..d10c10e --- /dev/null +++ b/modules/neovim.nix @@ -0,0 +1,5 @@ +{ pkgs, ... }: { + home = { + packages = with pkgs; [ neovim-ide ]; + }; +} diff --git a/modules/shell/btop.nix b/modules/shell/btop.nix new file mode 100644 index 0000000..f5cc310 --- /dev/null +++ b/modules/shell/btop.nix @@ -0,0 +1,9 @@ +_: { + programs.btop = { + enable = true; + settings = { + color_theme = "Default"; + theme_background = false; + }; + }; +} diff --git a/modules/shell/default.nix b/modules/shell/default.nix new file mode 100644 index 0000000..00f0c2f --- /dev/null +++ b/modules/shell/default.nix @@ -0,0 +1,14 @@ +_: { + imports = [ + ./direnv.nix + ./fzf.nix + ./git.nix + ./lf.nix + ./lsd.nix + ./starship.nix + ./tmux.nix + ./zsh.nix + ./btop.nix + ./zoxide.nix + ]; +} diff --git a/modules/shell/direnv.nix b/modules/shell/direnv.nix new file mode 100644 index 0000000..99c1a1b --- /dev/null +++ b/modules/shell/direnv.nix @@ -0,0 +1,15 @@ +{ pkgs, ... }: { + programs.direnv = { + enable = true; + enableZshIntegration = true; + enableBashIntegration = true; + config = { + global = { + disable_stdin = true; + strict_env = true; + }; + }; + stdlib = builtins.readFile ../../configs/direnv/stdlib.sh; + }; +} + diff --git a/modules/shell/fzf.nix b/modules/shell/fzf.nix new file mode 100644 index 0000000..933e924 --- /dev/null +++ b/modules/shell/fzf.nix @@ -0,0 +1,16 @@ +_: { + programs = { + fzf = { + enable = true; + enableZshIntegration = true; + defaultCommand = "fd --type f"; + defaultOptions = [ + "--height 40%" + "--border" + ]; + tmux = { + enableShellIntegration = true; + }; + }; + }; +} diff --git a/modules/shell/git.nix b/modules/shell/git.nix new file mode 100644 index 0000000..97d2a2d --- /dev/null +++ b/modules/shell/git.nix @@ -0,0 +1,100 @@ +{ + config, + pkgs, + ... +}: { + home = { + packages = with pkgs; [pre-commit]; + }; + programs = { + git = { + enable = true; + userName = "Patrick Neff"; + userEmail = "odie86@gmail.com"; + 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/shell/lf.nix b/modules/shell/lf.nix new file mode 100644 index 0000000..2191160 --- /dev/null +++ b/modules/shell/lf.nix @@ -0,0 +1,57 @@ +{pkgs, ...}: { + home = { + packages = with pkgs; [ + chafa + ctpv + ]; + file = { + ".config/lf/icons" = { + source = ../../configs/lf/icons; + }; + ".config/lf/colors" = { + source = ../../configs/lf/colors; + }; + }; + }; + programs.lf = { + enable = true; + 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/shell/lsd.nix b/modules/shell/lsd.nix new file mode 100644 index 0000000..c893c23 --- /dev/null +++ b/modules/shell/lsd.nix @@ -0,0 +1,8 @@ +_: { + programs = { + lsd = { + enable = true; + enableAliases = true; + }; + }; +} diff --git a/modules/shell/starship.nix b/modules/shell/starship.nix new file mode 100644 index 0000000..3dae570 --- /dev/null +++ b/modules/shell/starship.nix @@ -0,0 +1,337 @@ +{ lib, ... }: +{ + programs = { + starship = { + enable = true; + 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/shell/tmux.nix b/modules/shell/tmux.nix new file mode 100644 index 0000000..965d5e5 --- /dev/null +++ b/modules/shell/tmux.nix @@ -0,0 +1,87 @@ +{ pkgs, ... }: +let + localLib = pkgs.callPackage ../../lib { }; + catppuccin = pkgs.callPackage ../../pkgs/tmuxPlugins/catppuccin.nix { + inherit localLib; + }; +in +{ + programs.tmux = { + enable = true; + newSession = true; + 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 + + # 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' { if -F '#{pane_at_left}' "" 'select-pane -L' } + bind-key -n 'C-j' if-shell "$is_vim" 'send-keys C-j' { if -F '#{pane_at_bottom}' "" 'select-pane -D' } + bind-key -n 'C-k' if-shell "$is_vim" 'send-keys C-k' { if -F '#{pane_at_top}' "" 'select-pane -U' } + bind-key -n 'C-l' if-shell "$is_vim" 'send-keys C-l' { if -F '#{pane_at_right}' "" 'select-pane -R' } + + bind-key -T copy-mode-vi 'C-h' if -F '#{pane_at_left}' "" 'select-pane -L' + bind-key -T copy-mode-vi 'C-j' if -F '#{pane_at_bottom}' "" 'select-pane -D' + bind-key -T copy-mode-vi 'C-k' if -F '#{pane_at_top}' "" 'select-pane -U' + bind-key -T copy-mode-vi 'C-l' if -F '#{pane_at_right}' "" '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/shell/zoxide.nix b/modules/shell/zoxide.nix new file mode 100644 index 0000000..ad82f9c --- /dev/null +++ b/modules/shell/zoxide.nix @@ -0,0 +1,8 @@ +_: { + programs = { + zoxide = { + enable = true; + enableZshIntegration = true; + }; + }; +} diff --git a/modules/shell/zsh.nix b/modules/shell/zsh.nix new file mode 100644 index 0000000..54c58c7 --- /dev/null +++ b/modules/shell/zsh.nix @@ -0,0 +1,46 @@ +{ config, ... }: { + programs = { + zsh = { + enable = true; + defaultKeymap = "emacs"; + dotDir = ".config/zsh"; + shellAliases = { + j = "z"; + ji = "zi"; + }; + initExtra = builtins.readFile ../../configs/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/pkgs/tmuxPlugins/catppuccin.nix b/pkgs/tmuxPlugins/catppuccin.nix new file mode 100644 index 0000000..2f0ac33 --- /dev/null +++ b/pkgs/tmuxPlugins/catppuccin.nix @@ -0,0 +1,11 @@ +{ pkgs, localLib, ... }: +localLib.tmux.mkTmuxPlugin { + pluginName = "catppuccin"; + version = "unstable-2024-01-25"; + src = pkgs.fetchFromGitHub { + owner = "catppuccin"; + repo = "tmux"; + rev = "2ff900dc7a1579085cc2362fe459a1ecff78eec4"; + hash = "sha256-78TRFzWUKLR4QuZeiXTa4SzWHxprWav93G21uUKzBfA="; + }; +}