diff --git a/config/nixos.nix b/config/nixos.nix index 6efa0cf..745501e 100644 --- a/config/nixos.nix +++ b/config/nixos.nix @@ -40,6 +40,16 @@ experimental-features = "nix-command flakes"; # Deduplicate and optimize nix store auto-optimise-store = true; + # i'd say i trust myself tbh + trusted-users = ["ruben"]; + substituters = [ + "https://cache.nixos.org" + "https://nix-community.cachix.org" + ]; + trusted-public-keys = [ + "cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=" + "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" + ]; }; # use linux-zen @@ -48,6 +58,17 @@ # Bootloader. boot.loader.systemd-boot.enable = true; boot.loader.efi.canTouchEfiVariables = true; + # see https://nixos-and-flakes.thiscute.world/nixos-with-flakes/other-useful-tips#reducing-disk-usage + # for below: + # limit to 10 generations + boot.loader.systemd-boot.configurationLimit = 10; + + # Perform garbage collection weekly to maintain low disk usage + nix.gc = { + automatic = true; + dates = "weekly"; + options = "--delete-older-than 1w"; + }; # enable plymouth because it looks cool :))) boot.plymouth = { @@ -55,6 +76,18 @@ theme = "bgrt"; }; + # opengl and graphics settings + # https://nixos.wiki/wiki/Accelerated_Video_Playback + hardware.opengl = { + enable = true; + extraPackages = with pkgs; [ + intel-media-driver # LIBVA_DRIVER_NAME=iHD + intel-vaapi-driver # LIBVA_DRIVER_NAME=i965 (older but works better for Firefox/Chromium) + libvdpau-va-gl + ]; + }; + environment.sessionVariables = { LIBVA_DRIVER_NAME = "iHD"; }; # Force intel-media-driver + # Enable CUPS to print documents. services.printing = { enable = true; diff --git a/config/packages.nix b/config/packages.nix index 5ef68bc..e23f2ab 100644 --- a/config/packages.nix +++ b/config/packages.nix @@ -37,9 +37,6 @@ curl curlHTTP3 pinentry-curses - - kitty - wezterm distrobox virt-manager diff --git a/users/ruben/config/ncmpcpp/config b/users/ruben/config/ncmpcpp/config new file mode 100644 index 0000000..3866cf3 --- /dev/null +++ b/users/ruben/config/ncmpcpp/config @@ -0,0 +1,55 @@ +# _ __ ___ _ __ ___ _ __ ___ _ __ _ __ +# | '_ \ / __| '_ ` _ \| '_ \ / __| '_ \| '_ \ +# | | | | (__| | | | | | |_) | (__| |_) | |_) | +# |_| |_|\___|_| |_| |_| .__/ \___| .__/| .__/ +# |_| |_| |_| +# the REAL llama ass whipping +mpd_music_dir = "~/Music" +lyrics_directory = "~/.config/mpd/lyrics" + +# genderal +connected_message_on_startup = "yes" +cyclic_scrolling = "yes" +mouse_support = "yes" +mouse_list_scroll_whole_page = "yes" +lines_scrolled = "3" +message_delay_time = "1" +playlist_shorten_total_times = "yes" +playlist_display_mode = "columns" +browser_display_mode = "columns" +search_engine_display_mode = "columns" +playlist_editor_display_mode = "columns" +autocenter_mode = "yes" +centered_cursor = "yes" +user_interface = "classic" +locked_screen_width_part = "50" +ask_for_locked_screen_width_part = "yes" +external_editor = "nvim" +main_window_color = "default" +startup_screen = "playlist" + +# ui elements visbility +header_visibility = "yes" +statusbar_visibility = "yes" +titles_visibility = "yes" +enable_window_title = "yes" +display_volume_level = "yes" + +# ui theming +statusbar_color = "white" +color1 = "white" +color2 = "green" + +progressbar_look = "─󰮯󰧟" +progressbar_elapsed_color = "green" +progressbar_color = "black" + +now_playing_prefix = "$b$3$3 " +now_playing_suffix = " $/b$8" +current_item_prefix = "$b$7$/b$5 " +current_item_suffix = " $8" + +song_columns_list_format = "(50)[]{t|fr:Title} (0)[cyan]{a}" +song_list_format = " {%t $R  $8%a$8}|{%f $R  $8%l$8} $8" +song_status_format = "$6 {$3$b%t$/b} $1∙ $5󰀥 {$7$b%b$/b} $1∙ $4󰠃 {$8$b%a$/b}" +song_window_title_format = "{%a -}{ %t}" diff --git a/users/ruben/config/starship.toml b/users/ruben/config/starship.toml new file mode 100644 index 0000000..932a08a --- /dev/null +++ b/users/ruben/config/starship.toml @@ -0,0 +1,61 @@ +# Get editor completions based on the config schema +"$schema" = 'https://starship.rs/config-schema.json' + +# left side of the prompt +format = "$container$directory$character" + +# right side of the prompt +right_format = "$git_status$git_branch$memory_usage$cmd_duration$sudo" + +# adds a newline whenever a command is completed +add_newline = true + +[character] +success_symbol = "[ ](#a6e3a1)" +error_symbol = "[ ](#f38ba8)" +vicmd_symbol = "[ ](#f9e2af)" + +[container] +format = "[]($style)(bg:#89dceb fg:#11111b)[󰆧 ](bg:#89dceb fg:#11111b bold)[ ]($style)" +style = "bg:none fg:#89dceb" +disabled = false + +[directory] +format = "[]($style)[󰉋 ](bg:#11111b fg:#89b4fa)[$path](bg:#11111b fg:#74c7ec bold)[ ]($style)" +style = "bg:none fg:#11111b" + +[git_branch] +format = "[]($style)[[ ](bg:#11111b fg:#f5c2e7)$branch](bg:#11111b fg:#f5e0dc)[ ]($style)" +style = "bg:none fg:#11111b" + +[git_status] +format = "[]($style)[[ ](bg:#11111b fg:#cba6f7)$branch](bg:#11111b fg:#f2cdcd)[ ]($style)" +style = "bg:none fg:#11111b" +conflicted = "=" +ahead = "󰁝${count}" +behind = "󰁅${count}" +diverged = "󰹹󰁝${ahead_count}⇣${behind_count}" +up_to_date = "󰄬" +untracked = "?${count}" +stashed = "" +modified = "!${count}" +staged = "+${count}" +renamed = "»${count}" +deleted = "${count}" + +[cmd_duration] +min_time = 30000 +format = "[]($style)[[ ](bg:#11111b fg:#fab387)$duration](bg:#11111b fg:#fab387)[ ]($style)" +style = "bg:none fg:#11111b" + + +[memory_usage] +disabled = false +threshold = 55 +format = "[]($style)[[󰍛 ](bg:#11111b fg:#f2cdcd)$ram](bg:#11111b fg:#f2cdcd)[ ]($style)" +style = "bg:none fg:#11111b" + +[sudo] +format = "[]($style)[[ 󰌾 ](bg:#11111b fg:#f9e2af)](bg:#11111b fg:#f9e2af)[]($style)" +style = "bg:none fg:#11111b" +disabled = false diff --git a/users/ruben/config/zsh/plugins/editor/editor.plugin.zsh b/users/ruben/config/zsh/plugins/editor/editor.plugin.zsh new file mode 100644 index 0000000..672b9db --- /dev/null +++ b/users/ruben/config/zsh/plugins/editor/editor.plugin.zsh @@ -0,0 +1,207 @@ +# +# Requirements +# + +# Return if requirements are not found. +if [[ "$TERM" == 'dumb' ]]; then + return 1 +fi + +# +# Options +# + +setopt BEEP # Beep on error in line editor. +unsetopt FLOW_CONTROL # Allow the usage of ^Q/^S in the context of zsh. + +# +# Variables +# + +# Treat these characters as part of a word. +WORDCHARS='*?_-.[]~&;!#$%^(){}<>' + +# Use human-friendly identifiers. +zmodload zsh/terminfo +typeset -gA key_info + +# Modifiers +key_info=( + 'Control' '\C-' + 'Escape' '\e' + 'Meta' '\M-' +) + +# Basic keys +key_info+=( + 'Backspace' "^?" + 'Delete' "^[[3~" + 'F1' "$terminfo[kf1]" + 'F2' "$terminfo[kf2]" + 'F3' "$terminfo[kf3]" + 'F4' "$terminfo[kf4]" + 'F5' "$terminfo[kf5]" + 'F6' "$terminfo[kf6]" + 'F7' "$terminfo[kf7]" + 'F8' "$terminfo[kf8]" + 'F9' "$terminfo[kf9]" + 'F10' "$terminfo[kf10]" + 'F11' "$terminfo[kf11]" + 'F12' "$terminfo[kf12]" + 'Insert' "$terminfo[kich1]" + 'Home' "$terminfo[khome]" + 'PageUp' "$terminfo[kpp]" + 'End' "$terminfo[kend]" + 'PageDown' "$terminfo[knp]" + 'Up' "$terminfo[kcuu1]" + 'Left' "$terminfo[kcub1]" + 'Down' "$terminfo[kcud1]" + 'Right' "$terminfo[kcuf1]" + 'BackTab' "$terminfo[kcbt]" +) + +# Mod plus another key +key_info+=( + 'AltLeft' "${key_info[Escape]}${key_info[Left]} \e[1;3D" + 'AltRight' "${key_info[Escape]}${key_info[Right]} \e[1;3C" + 'ControlLeft' '\e[1;5D \e[5D \e\e[D \eOd' + 'ControlRight' '\e[1;5C \e[5C \e\e[C \eOc' + 'ControlPageUp' '\e[5;5~' + 'ControlPageDown' '\e[6;5~' +) + +# +# Functions +# + +function is-term-family { + if [[ $TERM = $1 || $TERM = $1-* ]]; then + return 0 + fi + + return 1 +} + +function is-tmux { + if is-term-family tmux; then + return 0 + fi + + if [[ -n "$TMUX" ]]; then + return 0 + fi + + return 1 +} + +function update-cursor-style { + # We currently only support the xterm family of terminals + if ! is-term-family xterm && ! is-term-family rxvt && ! is-tmux; then + return + fi + + if bindkey -lL main | grep viins > /dev/null; then + # For vi-mode we + case $KEYMAP in + vicmd) printf '\e[2 q';; + viins|main) printf '\e[6 q';; + esac + fi +} +zle -N update-cursor-style + +# Enables terminal application mode +function zle-line-init { + # The terminal must be in application mode when ZLE is active for $terminfo + # values to be valid. + if (( $+terminfo[smkx] )); then + # Enable terminal application mode. + echoti smkx + fi + + # Ensure we have the correct cursor. We could probably do this less + # frequently, but this does what we need and shouldn't incur that much + # overhead. + zle update-cursor-style +} +zle -N zle-line-init + +# Disables terminal application mode +function zle-line-finish { + # The terminal must be in application mode when ZLE is active for $terminfo + # values to be valid. + if (( $+terminfo[rmkx] )); then + # Disable terminal application mode. + echoti rmkx + fi +} +zle -N zle-line-finish + +# Resets the prompt when the keymap changes +function zle-keymap-select { + zle update-cursor-style + + zle reset-prompt + zle -R +} +zle -N zle-keymap-select + +# +# Init +# + +# Reset to default key bindings +bindkey -d + +# +# Keybinds +# + +# Global keybinds +local -A global_keybinds +global_keybinds=( + "$key_info[Home]" beginning-of-line + "$key_info[End]" end-of-line + "$key_info[Delete]" delete-char +) + +# emacs and vi insert mode keybinds +local -A viins_keybinds +viins_keybinds=( + "$key_info[Backspace]" backward-delete-char + "$key_info[Control]W" backward-kill-word +) + +# vi command mode keybinds +local -A vicmd_keybinds +vicmd_keybinds=( + "$key_info[Delete]" delete-char +) + +# Special case for ControlLeft and ControlRight because they have multiple +# possible binds. +for key in "${(s: :)key_info[ControlLeft]}" "${(s: :)key_info[AltLeft]}"; do + bindkey -M emacs "$key" emacs-backward-word + bindkey -M viins "$key" vi-backward-word + bindkey -M vicmd "$key" vi-backward-word +done +for key in "${(s: :)key_info[ControlRight]}" "${(s: :)key_info[AltRight]}"; do + bindkey -M emacs "$key" emacs-forward-word + bindkey -M viins "$key" vi-forward-word + bindkey -M vicmd "$key" vi-forward-word +done + +# Bind all global and viins keys to the emacs keymap +for key bind in ${(kv)global_keybinds} ${(kv)viins_keybinds}; do + bindkey -M emacs "$key" "$bind" +done + +# Bind all global, vi, and viins keys to the viins keymap +for key bind in ${(kv)global_keybinds} ${(kv)viins_keybinds}; do + bindkey -M viins "$key" "$bind" +done + +# Bind all global, vi, and vicmd keys to the vicmd keymap +for key bind in ${(kv)global_keybinds} ${(kv)vicmd_keybinds}; do + bindkey -M vicmd "$key" "$bind" +done diff --git a/users/ruben/home.nix b/users/ruben/home.nix index a7c4e9d..384dd6b 100644 --- a/users/ruben/home.nix +++ b/users/ruben/home.nix @@ -44,6 +44,18 @@ xdg.userDirs.enable = true; + # dotfiles + # ncmpcpp + home.file.".config/ncmpcpp" = { + source = ./config/ncmpcpp; + recursive = true; + }; + # modified zsh plugins + home.file.".config/zsh" = { + source = ./config/zsh; + recursive = true; + }; + # ╭───────────────────────────────────────────────╮ # │ _ __ _ │ # │ _ __ ___ __| |_ ___ __ ___ _ _ / _(_)__ _ │ diff --git a/users/ruben/packages.nix b/users/ruben/packages.nix index c3847d6..feee3e6 100644 --- a/users/ruben/packages.nix +++ b/users/ruben/packages.nix @@ -23,14 +23,15 @@ fastfetch fd delta - lsd + eza ripgrep sd - starship zoxide + krabby + cod + atuin alejandra - cargo usbutils jq ffmpeg_6-full @@ -73,6 +74,8 @@ protontricks mpv + mpdris2 + mpd-discord-rpc nextcloud-client watchmate obs-studio @@ -91,12 +94,89 @@ ]; # my preferred shell customized to my needs - # TODO: theres only oh-my-zsh support out of the box, figure out - # how to customize sheldon and starship + # thanks to https://github.com/Yumasi/nixos-home/blob/main/zsh.nix programs.zsh = { enable = true; + dotDir = ".config/zsh"; history.size = 50000; - syntaxHighlighting.enable = true; + + antidote.enable = true; + antidote.plugins = [ + # completions + "mattmc3/zephyr path:plugins/completion" + + # shell benchmarking + "romkatv/zsh-bench kind:path kind:defer" + + # oh my zsh + "ohmyzsh/ohmyzsh path:lib/key-bindings.zsh" + "ohmyzsh/ohmyzsh path:lib/clipboard.zsh" + #"ohmyzsh/ohmyzsh path:lib/completion.zsh" + "ohmyzsh/ohmyzsh path:plugins/copybuffer" + "ohmyzsh/ohmyzsh path:plugins/copyfile" + "ohmyzsh/ohmyzsh path:plugins/copypath" + "ohmyzsh/ohmyzsh path:plugins/extract kind:defer" + + # zsh-utils + "belak/zsh-utils path:history" + "belak/zsh-utils path:utility" + "${config.home.homeDirectory}/${config.programs.zsh.dotDir}/plugins/editor" + + # useful plugins + "atuinsh/atuin kind:defer" + "paulirish/git-open kind:defer" + "clavelm/yt-dlp-omz-plugin kind:defer" + "dim-an/cod kind:defer" + "jirutka/zsh-shift-select kind:defer" + "unixorn/fzf-zsh-plugin kind:defer" + + "zdharma-continuum/fast-syntax-highlighting kind:defer" + "zsh-users/zsh-autosuggestions kind:defer" + "zsh-users/zsh-history-substring-search kind:defer" + ]; + + shellAliases = { + # kitty + s = "kitten ssh"; + + # alias average commands to modern unix-util counterpartrs + cd = "z"; + grep = "rg"; + find = "fd"; + df = "duf"; + # different listing/ls styles + ls = "eza -lh --icons=always --hyperlink"; + l = "eza"; + la = "eza -1"; + lt = "eza -T"; + cat = "bat --paging=never"; + + # custom aliases + music = "ncmpcpp"; + wttr = "curl 'wttr.in/?0' && curl 'wttr.in/?0?m'"; + please = "sudo"; + fucking = "sudo"; + for-the-love-of-god = "sudo"; + }; + + initExtra = '' + # export some custom paths + # (required for some packages/scripts/applications and some things in here) + path+=("${config.home.homeDirectory}/.local/bin") + path+=("${config.home.homeDirectory}/.cargo/bin") + + # funny pokemon + krabby random + + # load zoxide + eval "$(zoxide init zsh)" + ''; + }; + + # starship prompt + programs.starship = { + enable = true; + settings = pkgs.lib.importTOML ./config/starship.toml; }; # fuzzy command finder, required by a decent amount of things @@ -121,6 +201,29 @@ }; }; + # KITTY !!!! + programs.kitty = { + enable = true; + + font.name = "JetBrainsMono NF"; + font.size = 11.8; + + theme = "Catppuccin-Mocha"; + + settings = { + cursor_shape = "beam"; + window_padding_width = 8; + + scrollback_lines = 2000; + scrollback_pager_history_size = 512; + + tab_bar_style = "powerline"; + tab_powerline_style = "round"; + }; + + shellIntegration.enableZshIntegration = true; + }; + programs.vscode = { enable = true; package = pkgs.vscodium; @@ -156,10 +259,10 @@ services.mpd = { enable = true; - dataDir = "/home/ruben/.config/mpd"; - musicDirectory = "/home/ruben/Music"; - playlistDirectory = "/home/ruben/.config/mpd/playlists"; - dbFile = "/home/ruben/.config/mpd/db"; + dataDir = "${config.home.homeDirectory}/.config/mpd"; + musicDirectory = "${config.home.homeDirectory}/Music"; + playlistDirectory = "${config.home.homeDirectory}/.config/mpd/playlists"; + dbFile = "${config.home.homeDirectory}/.config/mpd/db"; extraConfig = '' state_file_interval "120"