diff --git a/flake.nix b/flake.nix index f8fccc4..0dcb0b5 100644 --- a/flake.nix +++ b/flake.nix @@ -113,7 +113,7 @@ }; homeManagerModules = { - devenv = ./modules/home-manager/devenv.nix; + devkit = ./modules/home-manager/devkit.nix; eww = ./modules/home-manager/eww.nix; }; diff --git a/modules/home-manager/devenv-zellij-config.kdl b/modules/home-manager/devenv-zellij-config.kdl deleted file mode 100644 index eccf378..0000000 --- a/modules/home-manager/devenv-zellij-config.kdl +++ /dev/null @@ -1,386 +0,0 @@ -// If you'd like to override the default keybindings completely, be sure to change "keybinds" to "keybinds clear-defaults=true" -default_mode "locked" -keybinds clear-defaults=true { - normal { - bind "1" { GoToTab 1; SwitchToMode "Locked"; } - bind "2" { GoToTab 2; SwitchToMode "Locked"; } - bind "3" { GoToTab 3; SwitchToMode "Locked"; } - bind "4" { GoToTab 4; SwitchToMode "Locked"; } - bind "5" { GoToTab 5; SwitchToMode "Locked"; } - bind "6" { GoToTab 6; SwitchToMode "Locked"; } - bind "7" { GoToTab 7; SwitchToMode "Locked"; } - bind "8" { GoToTab 8; SwitchToMode "Locked"; } - bind "9" { GoToTab 9; SwitchToMode "Locked"; } - bind "g" { - LaunchOrFocusPlugin "zellij-sessionizer" { - floating true - move_to_focused_tab true - cwd "/" - root_dirs "/home/guz/.projects;/home/guz/.job;/home/guz/.work" - session ":default" - } - SwitchToMode "Locked" - } - } - locked { - bind "Ctrl g" { SwitchToMode "Normal"; } - } - resize { - bind "r" { SwitchToMode "Normal"; } - bind "h" "Left" { Resize "Increase Left"; } - bind "j" "Down" { Resize "Increase Down"; } - bind "k" "Up" { Resize "Increase Up"; } - bind "l" "Right" { Resize "Increase Right"; } - bind "H" { Resize "Decrease Left"; } - bind "J" { Resize "Decrease Down"; } - bind "K" { Resize "Decrease Up"; } - bind "L" { Resize "Decrease Right"; } - bind "=" "+" { Resize "Increase"; } - bind "-" { Resize "Decrease"; } - } - pane { - bind "p" { SwitchToMode "Normal"; } - bind "h" "Left" { MoveFocus "Left"; } - bind "l" "Right" { MoveFocus "Right"; } - bind "j" "Down" { MoveFocus "Down"; } - bind "k" "Up" { MoveFocus "Up"; } - bind "Tab" { SwitchFocus; } - bind "n" { NewPane; SwitchToMode "Locked"; } - bind "d" { NewPane "Down"; SwitchToMode "Locked"; } - bind "r" { NewPane "Right"; SwitchToMode "Locked"; } - bind "x" { CloseFocus; SwitchToMode "Locked"; } - bind "f" { ToggleFocusFullscreen; SwitchToMode "Locked"; } - bind "z" { TogglePaneFrames; SwitchToMode "Locked"; } - bind "w" { ToggleFloatingPanes; SwitchToMode "Locked"; } - bind "e" { TogglePaneEmbedOrFloating; SwitchToMode "Locked"; } - bind "c" { SwitchToMode "RenamePane"; PaneNameInput 0; } - // bind "i" { TogglePanePinned; SwitchToMode "Locked"; } - } - move { - bind "m" { SwitchToMode "Normal"; } - bind "n" "Tab" { MovePane; } - bind "p" { MovePaneBackwards; } - bind "h" "Left" { MovePane "Left"; } - bind "j" "Down" { MovePane "Down"; } - bind "k" "Up" { MovePane "Up"; } - bind "l" "Right" { MovePane "Right"; } - } - tab { - bind "t" { SwitchToMode "Normal"; } - bind "r" { SwitchToMode "RenameTab"; TabNameInput 0; } - bind "h" "Left" "Up" "k" { GoToPreviousTab; } - bind "l" "Right" "Down" "j" { GoToNextTab; } - bind "n" { NewTab; SwitchToMode "Locked"; } - bind "x" { CloseTab; SwitchToMode "Locked"; } - bind "s" { ToggleActiveSyncTab; SwitchToMode "Locked"; } - bind "b" { BreakPane; SwitchToMode "Locked"; } - bind "]" { BreakPaneRight; SwitchToMode "Locked"; } - bind "[" { BreakPaneLeft; SwitchToMode "Locked"; } - bind "1" { GoToTab 1; SwitchToMode "Locked"; } - bind "2" { GoToTab 2; SwitchToMode "Locked"; } - bind "3" { GoToTab 3; SwitchToMode "Locked"; } - bind "4" { GoToTab 4; SwitchToMode "Locked"; } - bind "5" { GoToTab 5; SwitchToMode "Locked"; } - bind "6" { GoToTab 6; SwitchToMode "Locked"; } - bind "7" { GoToTab 7; SwitchToMode "Locked"; } - bind "8" { GoToTab 8; SwitchToMode "Locked"; } - bind "9" { GoToTab 9; SwitchToMode "Locked"; } - bind "Tab" { ToggleTab; } - } - scroll { - bind "s" { SwitchToMode "Normal"; } - bind "e" { EditScrollback; SwitchToMode "Locked"; } - bind "s" { SwitchToMode "EnterSearch"; SearchInput 0; } - bind "Ctrl c" { ScrollToBottom; SwitchToMode "Locked"; } - bind "j" "Down" { ScrollDown; } - bind "k" "Up" { ScrollUp; } - bind "Ctrl f" "PageDown" "Right" "l" { PageScrollDown; } - bind "Ctrl b" "PageUp" "Left" "h" { PageScrollUp; } - bind "d" { HalfPageScrollDown; } - bind "u" { HalfPageScrollUp; } - bind "Alt left" "Alt h" { MoveFocusOrTab "left"; SwitchToMode "Locked"; } - bind "Alt down" "Alt j" { MoveFocusOrTab "down"; SwitchToMode "Locked"; } - bind "Alt up" "Alt k" { MoveFocusOrTab "up"; SwitchToMode "Locked"; } - bind "Alt right" "Alt l" { MoveFocusOrTab "right"; SwitchToMode "Locked"; } - // uncomment this and adjust key if using copy_on_select=false - // bind "Alt c" { Copy; } - } - search { - bind "Ctrl s" { SwitchToMode "Locked"; } - bind "Ctrl c" { ScrollToBottom; SwitchToMode "Locked"; } - bind "j" "Down" { ScrollDown; } - bind "k" "Up" { ScrollUp; } - bind "Ctrl f" "PageDown" "Right" "l" { PageScrollDown; } - bind "Ctrl b" "PageUp" "Left" "h" { PageScrollUp; } - bind "d" { HalfPageScrollDown; } - bind "u" { HalfPageScrollUp; } - bind "n" { Search "down"; } - bind "p" { Search "up"; } - bind "c" { SearchToggleOption "CaseSensitivity"; } - bind "w" { SearchToggleOption "Wrap"; } - bind "o" { SearchToggleOption "WholeWord"; } - } - entersearch { - bind "Ctrl c" "Esc" { SwitchToMode "Scroll"; } - bind "Enter" { SwitchToMode "Search"; } - } - renametab { - bind "Ctrl c" { SwitchToMode "Locked"; } - bind "Esc" { UndoRenameTab; SwitchToMode "Tab"; } - } - renamepane { - bind "Ctrl c" { SwitchToMode "Locked"; } - bind "Esc" { UndoRenamePane; SwitchToMode "Pane"; } - } - session { - bind "o" { SwitchToMode "Locked"; } - bind "d" { Detach; } - bind "w" { - LaunchOrFocusPlugin "session-manager" { - floating true - move_to_focused_tab true - }; - SwitchToMode "Locked" - } - bind "c" { - LaunchOrFocusPlugin "configuration" { - floating true - move_to_focused_tab true - } - SwitchToMode "Locked" - } - bind "g" { - LaunchOrFocusPlugin "zellij-sessionizer" { - floating true - move_to_focused_tab true - cwd "/" - root_dirs "/home/guz/.projects;/home/guz/.job;/home/guz/.work" - session ":default" - } - SwitchToMode "Locked" - } - } - /* tmux { - bind "[" { SwitchToMode "Scroll"; } - bind "Ctrl b" { Write 2; SwitchToMode "Normal"; } - bind "\"" { NewPane "Down"; SwitchToMode "Normal"; } - bind "%" { NewPane "Right"; SwitchToMode "Normal"; } - bind "z" { ToggleFocusFullscreen; SwitchToMode "Normal"; } - bind "c" { NewTab; SwitchToMode "Normal"; } - bind "," { SwitchToMode "RenameTab"; } - bind "p" { GoToPreviousTab; SwitchToMode "Normal"; } - bind "n" { GoToNextTab; SwitchToMode "Normal"; } - bind "Left" { MoveFocus "Left"; SwitchToMode "Normal"; } - bind "Right" { MoveFocus "Right"; SwitchToMode "Normal"; } - bind "Down" { MoveFocus "Down"; SwitchToMode "Normal"; } - bind "Up" { MoveFocus "Up"; SwitchToMode "Normal"; } - bind "h" { MoveFocus "Left"; SwitchToMode "Normal"; } - bind "l" { MoveFocus "Right"; SwitchToMode "Normal"; } - bind "j" { MoveFocus "Down"; SwitchToMode "Normal"; } - bind "k" { MoveFocus "Up"; SwitchToMode "Normal"; } - bind "o" { FocusNextPane; } - bind "d" { Detach; } - bind "Space" { NextSwapLayout; } - bind "x" { CloseFocus; SwitchToMode "Normal"; } - } */ - shared_except "locked" "renametab" "renamepane" { - bind "Ctrl g" { SwitchToMode "Locked"; } - bind "Ctrl Q" { Quit; } - } - shared_except "renamepane" "renametab" "entersearch" "locked" { - bind "esc" { SwitchToMode "locked"; } - } - shared_among "normal" "locked" { - bind "Alt n" { NewPane; } - bind "Alt f" { ToggleFloatingPanes; } - bind "Alt i" { MoveTab "Left"; } - bind "Alt o" { MoveTab "Right"; } - bind "Alt h" "Alt Left" { MoveFocusOrTab "Left"; } - bind "Alt l" "Alt Right" { MoveFocusOrTab "Right"; } - bind "Alt j" "Alt Down" { MoveFocusOrTab "Down"; } - bind "Alt k" "Alt Up" { MoveFocusOrTab "Up"; } - bind "Alt =" "Alt +" { Resize "Increase"; } - bind "Alt -" { Resize "Decrease"; } - bind "Alt [" { PreviousSwapLayout; } - bind "Alt ]" { NextSwapLayout; } - } - shared_except "locked" "renametab" "renamepane" { - bind "Enter" { SwitchToMode "Locked"; } - } - shared_except "pane" "locked" "renametab" "renamepane" "renamepane" "entersearch" { - bind "p" { SwitchToMode "Pane"; } - } - shared_except "resize" "locked" "renametab" "renamepane" "renamepane" "entersearch" { - bind "r" { SwitchToMode "Resize"; } - } - shared_except "scroll" "locked" "renametab" "renamepane" "renamepane" "entersearch" { - bind "s" { SwitchToMode "Scroll"; } - } - shared_except "session" "locked" "renametab" "renamepane" "renamepane" "entersearch" { - bind "o" { SwitchToMode "Session"; } - } - shared_except "tab" "locked" "renametab" "renamepane" "renamepane" "entersearch" { - bind "t" { SwitchToMode "Tab"; } - } - shared_except "move" "locked" "renametab" "renamepane" "renamepane" "entersearch" { - bind "m" { SwitchToMode "Move"; } - } -} - -themes { - frappuccino { - bg "#181818" // Surface2 - fg "#cdd6f4" // Text - red "#f38ba8" - green "#a6e3a1" - blue "#89b4fa" - yellow "#f9e2af" - magenta "#f5c2e7" // Pink - orange "#fab387" // Peach - cyan "#89dceb" // Sky - black "#101010" // Mantle - white "#cdd6f4" // Text - } -} -theme "frappuccino" - -// Choose what to do when zellij receives SIGTERM, SIGINT, SIGQUIT or SIGHUP -// eg. when terminal window with an active zellij session is closed -// Options: -// - detach (Default) -// - quit -// -// on_force_close "quit" - -// Send a request for a simplified ui (without arrow fonts) to plugins -// Options: -// - true -// - false (Default) -// -simplified_ui true - -// Choose the path to the default shell that zellij will use for opening new panes -// Default: $SHELL -// -// default_shell "fish" - -// Choose the path to override cwd that zellij will use for opening new panes -// -// default_cwd "" - -// Toggle between having pane frames around the panes -// Options: -// - true (default) -// - false -// -pane_frames false - -// Toggle between having Zellij lay out panes according to a predefined set of layouts whenever possible -// Options: -// - true (default) -// - false -// -// auto_layout true - -// Whether sessions should be serialized to the cache folder (including their tabs/panes, cwds and running commands) so that they can later be resurrected -// Options: -// - true (default) -// - false -// -session_serialization true - -// Whether pane viewports are serialized along with the session, default is false -// Options: -// - true -// - false (default) -serialize_pane_viewport true - -// Scrollback lines to serialize along with the pane viewport when serializing sessions, 0 -// defaults to the scrollback size. If this number is higher than the scrollback size, it will -// also default to the scrollback size. This does nothing if `serialize_pane_viewport` is not true. -// -scrollback_lines_to_serialize 0 - -// The name of the default layout to load on startup -// Default: "default" -// -// default_layout "compact" - -// Choose the mode that zellij uses when starting up. -// Default: normal -// -// default_mode "locked" - -// Toggle enabling the mouse mode. -// On certain configurations, or terminals this could -// potentially interfere with copying text. -// Options: -// - true (default) -// - false -// -// mouse_mode false - -// Configure the scroll back buffer size -// This is the number of lines zellij stores for each pane in the scroll back -// buffer. Excess number of lines are discarded in a FIFO fashion. -// Valid values: positive integers -// Default value: 10000 -// -// scroll_buffer_size 10000 - -// Provide a command to execute when copying text. The text will be piped to -// the stdin of the program to perform the copy. This can be used with -// terminal emulators which do not support the OSC 52 ANSI control sequence -// that will be used by default if this option is not set. -// Examples: -// -// copy_command "xclip -selection clipboard" // x11 -// copy_command "wl-copy" // wayland -// copy_command "pbcopy" // osx - -// Choose the destination for copied text -// Allows using the primary selection buffer (on x11/wayland) instead of the system clipboard. -// Does not apply when using copy_command. -// Options: -// - system (default) -// - primary -// -copy_clipboard "system" - -// Enable or disable automatic copy (and clear) of selection when releasing mouse -// Default: true -// -// copy_on_select false - -// Path to the default editor to use to edit pane scrollbuffer -// Default: $EDITOR or $VISUAL -// -// scrollback_editor "/usr/bin/vim" - -// When attaching to an existing session with other users, -// should the session be mirrored (true) -// or should each user have their own cursor (false) -// Default: false -// -// mirror_session true - -// The folder in which Zellij will look for layouts -// -// layout_dir "/path/to/my/layout_dir" - -// The folder in which Zellij will look for themes -// -// theme_dir "/path/to/my/theme_dir" - -// Enable or disable the rendering of styled and colored underlines (undercurl). -// May need to be disabled for certain unsupported terminals -// Default: true -// -// styled_underlines false - -// Enable or disable writing of session metadata to disk (if disabled, other sessions might not know -// metadata info on this session) -// Default: false -// -// disable_session_metadata true - diff --git a/modules/home-manager/devenv.nix b/modules/home-manager/devenv.nix deleted file mode 100644 index 41e5215..0000000 --- a/modules/home-manager/devenv.nix +++ /dev/null @@ -1,162 +0,0 @@ -{ - config, - inputs, - lib, - pkgs, - ... -}: { - imports = [ - inputs.dot013-nvim.homeManagerModules.neovim - ]; - - home.packages = with pkgs; [ - ouch - ]; - - home.sessionVariables = rec { - # EDITOR = "nvim"; # Default editor, already defined by dot013-nvim - SHELL = "zsh"; - TERM = "ghostty"; - TERMINAL = TERM; - EXPLORER = "yazi"; - }; - - # Local development shells - programs.direnv.enable = true; - programs.direnv.enableZshIntegration = true; - programs.direnv.nix-direnv.enable = true; - - # Ghostty (Terminal) - programs.ghostty.enable = true; - programs.ghostty.enableZshIntegration = true; - - # Neovim (Editor) - # programs.neovim.enable = true; # Already enabled by dot013-nvim - - # Git - programs.git.enable = true; - programs.git.userEmail = "contact@guz.one"; - programs.git.userName = "Gustavo \"Guz\" L de Mello"; - programs.git.extraConfig = { - credential.helper = "store"; - http.proxy = ""; - https.proxy = ""; - signing.singByDefault = true; - }; - - # Better git diff - programs.git.delta.enable = true; - - # GPG Keyring - programs.gpg.enable = true; - programs.gpg.mutableKeys = true; - programs.gpg.mutableTrust = true; - - services.gpg-agent.enable = true; - services.gpg-agent.enableZshIntegration = true; - services.gpg-agent.defaultCacheTtl = 3600 * 24; - services.gpg-agent.pinentryPackage = pkgs.pinentry-gtk2; - - # Git TUI - programs.lazygit.enable = true; - programs.lazygit.settings = { - git.paging.colorArg = "always"; - git.paging.pager = "${lib.getExe config.programs.git.delta.package} --dark --paging=never"; - }; - - # Shell decoration - programs.starship.enable = true; - programs.starship.enableZshIntegration = true; - - # SSH - programs.ssh.enable = true; - programs.ssh.matchBlocks = { - "battleship" = { - hostname = "battleship"; - user = "${config.home.username}"; - identitiesOnly = true; - identityFile = "${config.home.homeDirectory}/home/battleship"; - extraOptions = {RequestTTY = "yes";}; - }; - "fithter" = { - hostname = "fighter"; - user = "${config.home.username}"; - identitiesOnly = true; - identityFile = "${config.home.homeDirectory}/home/fighter"; - extraOptions = {RequestTTY = "yes";}; - }; - }; - - # Yazi (File manager) - programs.yazi.enable = true; - programs.yazi.enableZshIntegration = true; - programs.yazi.settings = { - manager = { - show_hidden = true; - show_symlink = true; - - sort_by = "natural"; - sort_dir_first = true; - sort_sensitive = false; - sort_translit = true; - - linemode = "size"; - }; - }; - programs.yazi.initLua = '' - -- Add username and hostname in header - -- https://yazi-rs.github.io/docs/tips#username-hostname-in-header - Header:children_add(function() - if ya.target_family() ~= "unix" then - return "" - end - return ui.Span(ya.user_name() .. "@" .. ya.host_name() .. ":"):fg("blue") - end, 500, Header.LEFT) - - -- Add user and group owner of file in status line - -- https://yazi-rs.github.io/docs/tips#user-group-in-status - Status:children_add(function() - local h = cx.active.current.hovered - if h == nil or ya.target_family() ~= "unix" then - return "" - end - - return ui.Line({ - ui.Span(ya.user_name(h.cha.uid) or tostring(h.cha.uid)):fg("magenta"), - ":", - ui.Span(ya.user_name(h.cha.gid) or tostring(h.cha.gid)):fg("magenta"), - " ", - }) - end, 500, Status.RIGHT) - ''; - - # Zellij (Terminal multiplexer) - programs.zellij.enable = true; - programs.zellij.enableZshIntegration = true; - home.file."${config.xdg.configHome}/zellij/config.kdl".text = let - zellij-sessionizer = builtins.fetchurl { - url = "https://github.com/laperlej/zellij-sessionizer/releases/download/v0.4.3/zellij-sessionizer.wasm"; - sha256 = "0d43jhlhm7p8pvd8kcylfbfy3dahr8q4yngpnjyqivapwip9csq0"; - }; - in '' - plugins { - zellij-sessionizer location="file:${zellij-sessionizer}" - - tab-bar location="zellij:tab-bar" - status-bar location="zellij:status-bar" - compact-bar location="zellij:compact-bar" - session-manager location="zellij:session-manager" - } - ${builtins.readFile ./devenv-zellij-config.kdl} - ''; - - # Default shell - programs.zsh.enable = true; - programs.zsh.autosuggestion.enable = true; - programs.zsh.enableCompletion = true; - programs.zsh.syntaxHighlighting.enable = true; - programs.zsh.shellAliases = { - "lg" = "${lib.getExe config.programs.lazygit.package}"; - "x" = "${config.home.sessionVariables.EXPLORER}"; - }; -} diff --git a/modules/home-manager/devkit.nix b/modules/home-manager/devkit.nix new file mode 100644 index 0000000..b473de3 --- /dev/null +++ b/modules/home-manager/devkit.nix @@ -0,0 +1,141 @@ +{ + config, + inputs, + lib, + pkgs, + self, + ... +}: let + cfg = config.devkit; + + devkitPkgs = self.packages.${pkgs.system}.devkit; +in { + imports = [ + inputs.dot013-nvim.homeManagerModules.neovim + ]; + options.devkit = with lib; { + enable = mkEnableOption "Enable devkit configuration and packages"; + + ghostty.enable = mkOption { + type = with types; bool; + default = cfg.enable; + }; + git.enable = mkOption { + type = with types; bool; + default = cfg.enable; + }; + lazygit.enable = mkOption { + type = with types; bool; + default = cfg.enable; + }; + starship.enable = mkOption { + type = with types; bool; + default = cfg.enable; + }; + yazi.enable = mkOption { + type = with types; bool; + default = cfg.enable; + }; + zellij.enable = mkOption { + type = with types; bool; + default = cfg.enable; + }; + zsh.enable = mkOption { + type = with types; bool; + default = cfg.enable; + }; + }; + config = { + home.packages = with pkgs; [ + ouch + ]; + + home.sessionVariables = rec { + # EDITOR = "nvim"; # Default editor, already defined by dot013-nvim + SHELL = lib.mkIf cfg.zsh "${config.programs.zsh.package}"; + TERM = lib.mkIf cfg.ghostty "${config.programs.ghostty.package}"; + TERMINAL = lib.mkIf cfg.ghostty TERM; + EXPLORER = lib.mkIf cfg.yazi "${config.programs.yazi.package}"; + }; + + # Local development shells + programs.direnv.enable = true; + programs.direnv.nix-direnv.enable = true; + + # SSH + programs.ssh.enable = true; + programs.ssh.matchBlocks = { + "battleship" = { + hostname = "battleship"; + user = "${config.home.username}"; + identitiesOnly = true; + identityFile = "${config.home.homeDirectory}/home/battleship"; + extraOptions = {RequestTTY = "yes";}; + }; + "fithter" = { + hostname = "fighter"; + user = "${config.home.username}"; + identitiesOnly = true; + identityFile = "${config.home.homeDirectory}/home/fighter"; + extraOptions = {RequestTTY = "yes";}; + }; + }; + + # GPG Keyring + programs.gpg.enable = true; + programs.gpg.mutableKeys = true; + programs.gpg.mutableTrust = true; + + services.gpg-agent.enable = true; + services.gpg-agent.defaultCacheTtl = 3600 * 24; + services.gpg-agent.pinentryPackage = pkgs.pinentry-gtk2; + + # Devkit packages + + ## Ghostty (Terminal) + programs.ghostty = lib.mkIf cfg.ghostty { + enable = true; + package = devkitPkgs.ghostty; + }; + + ## Git + programs.git = lib.mkIf cfg.git { + enable = true; + userEmail = "contact@guz.one"; + userName = "Gustavo \"Guz\" L de Mello"; + }; + + ## Lazygit (Git TUI) + programs.lazygit = lib.mkIf cfg.lazygit { + enable = true; + package = devkitPkgs.lazygit; + }; + + ## Neovim (Editor) + ## programs.neovim.enable = true; # Already enabled by dot013-nvim + + ## Starship (Shell decoration) + programs.starship = lib.mkIf cfg.starship { + enable = true; + package = devkitPkgs.starship; + }; + + ## Yazi (File manager) + programs.yazi = lib.mkIf cfg.yazi { + enable = true; + package = devkitPkgs.yazi; + }; + + ## Zellij (Terminal multiplexer) + programs.zellij = lib.mkIf cfg.zellij { + enable = true; + package = devkitPkgs.zellij; + }; + + ## ZSH (Default shell) + programs.zsh = lib.mkIf cfg.zsh { + enable = true; + package = devkitPkgs.zsh; + }; + }; +}