From 9a777def2f5907ae9e7c892c14af6a1173cdcc61 Mon Sep 17 00:00:00 2001 From: DerGrumpf Date: Sat, 27 Dec 2025 13:35:09 +0100 Subject: [PATCH] Finalised Terminal Config --- darwin/default.nix | 32 +++------- flake.lock | 41 +------------ flake.nix | 21 +------ home/catppuccin.nix | 6 -- home/default.nix | 8 +-- home/neovim/alpha.nix | 43 +++----------- home/neovim/conform.nix | 5 +- home/neovim/default.nix | 35 ++++++----- home/neovim/yazi.nix | 22 ++++--- home/packages.nix | 4 +- home/shell.nix | 126 +++++++++++++++++++++++----------------- home/tab_bar.py | 34 +++++++++++ 12 files changed, 165 insertions(+), 212 deletions(-) delete mode 100644 home/catppuccin.nix create mode 100644 home/tab_bar.py diff --git a/darwin/default.nix b/darwin/default.nix index fd08254..7db20be 100644 --- a/darwin/default.nix +++ b/darwin/default.nix @@ -1,26 +1,15 @@ -{ - pkgs, - inputs, - self, - primaryUser, - ... -}: -{ +{ pkgs, inputs, self, primaryUser, ... }: { imports = [ # ./homebrew.nix ./settings.nix inputs.home-manager.darwinModules.home-manager inputs.nix-homebrew.darwinModules.nix-homebrew - # inputs.catppuccin.nixosModules.catppuccin ]; # nix config nix = { settings = { - experimental-features = [ - "nix-command" - "flakes" - ]; + experimental-features = [ "nix-command" "flakes" ]; # disabled due to https://github.com/NixOS/nix/issues/7273 # auto-optimise-store = true; }; @@ -39,26 +28,19 @@ home-manager = { useGlobalPkgs = true; useUserPackages = true; - users.${primaryUser} = { - imports = [ - ../home - ]; - }; - extraSpecialArgs = { - inherit inputs self primaryUser; - }; + users.${primaryUser} = { imports = [ ../home ]; }; + extraSpecialArgs = { inherit inputs self primaryUser; }; }; # macOS-specific settings + programs.fish.enable = true; system.primaryUser = primaryUser; users.users.${primaryUser} = { home = "/Users/${primaryUser}"; - shell = pkgs.zsh; + shell = pkgs.fish; }; environment = { - systemPath = [ - "/opt/homebrew/bin" - ]; + systemPath = [ "/opt/homebrew/bin" ]; pathsToLink = [ "/Applications" ]; }; } diff --git a/flake.lock b/flake.lock index 639784f..c970d17 100644 --- a/flake.lock +++ b/flake.lock @@ -17,24 +17,6 @@ "type": "github" } }, - "catppuccin": { - "inputs": { - "nixpkgs": "nixpkgs" - }, - "locked": { - "lastModified": 1765990358, - "narHash": "sha256-l8x0gU8mnYaGMl+gWrsSHKBJlZWD8KXJfHTkRlFiPI0=", - "owner": "catppuccin", - "repo": "nix", - "rev": "de1b60ca45a578f59f7d84c8d338b346017b2161", - "type": "github" - }, - "original": { - "owner": "catppuccin", - "repo": "nix", - "type": "github" - } - }, "darwin": { "inputs": { "nixpkgs": [ @@ -116,22 +98,6 @@ } }, "nixpkgs": { - "locked": { - "lastModified": 1763966396, - "narHash": "sha256-6eeL1YPcY1MV3DDStIDIdy/zZCDKgHdkCmsrLJFiZf0=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "5ae3b07d8d6527c42f17c876e404993199144b6a", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "nixos-unstable", - "repo": "nixpkgs", - "type": "github" - } - }, - "nixpkgs_2": { "locked": { "lastModified": 1751949589, "narHash": "sha256-mgFxAPLWw0Kq+C8P3dRrZrOYEQXOtKuYVlo9xvPntt8=", @@ -147,7 +113,7 @@ "type": "github" } }, - "nixpkgs_3": { + "nixpkgs_2": { "locked": { "lastModified": 1766653575, "narHash": "sha256-TPgxCS7+hWc4kPhzkU5dD2M5UuPhLuuaMNZ/IpwKQvI=", @@ -166,7 +132,7 @@ "nixvim": { "inputs": { "flake-parts": "flake-parts", - "nixpkgs": "nixpkgs_3", + "nixpkgs": "nixpkgs_2", "systems": "systems" }, "locked": { @@ -185,11 +151,10 @@ }, "root": { "inputs": { - "catppuccin": "catppuccin", "darwin": "darwin", "home-manager": "home-manager", "nix-homebrew": "nix-homebrew", - "nixpkgs": "nixpkgs_2", + "nixpkgs": "nixpkgs", "nixvim": "nixvim" } }, diff --git a/flake.nix b/flake.nix index d8da914..85dc2a6 100644 --- a/flake.nix +++ b/flake.nix @@ -18,34 +18,19 @@ # declarative Neovim nixvim.url = "github:nix-community/nixvim"; - # declarative Themeing - catppuccin.url = "github:catppuccin/nix"; }; outputs = - { - self, - darwin, - nixpkgs, - home-manager, - nix-homebrew, - nixvim, - catppuccin, - ... - }@inputs: + { self, darwin, nixpkgs, home-manager, nix-homebrew, nixvim, ... }@inputs: let # TODO: replace with your username primaryUser = "phil"; - in - { + in { # build darwin flake using: # $ darwin-rebuild build --flake .# darwinConfigurations."cyper-mac" = darwin.lib.darwinSystem { system = "x86_64-darwin"; # aarch64-darwin - modules = [ - ./darwin - ./hosts/cyper-mac/configuration.nix - ]; + modules = [ ./darwin ./hosts/cyper-mac/configuration.nix ]; specialArgs = { inherit inputs self primaryUser; }; }; diff --git a/home/catppuccin.nix b/home/catppuccin.nix deleted file mode 100644 index 5c0c6c4..0000000 --- a/home/catppuccin.nix +++ /dev/null @@ -1,6 +0,0 @@ -_: { - catppuccin = { - enable = false; - flavor = "mocha"; - }; -} diff --git a/home/default.nix b/home/default.nix index 7157fc2..583cff5 100644 --- a/home/default.nix +++ b/home/default.nix @@ -1,13 +1,10 @@ -{ primaryUser, inputs, ... }: -{ +{ primaryUser, inputs, ... }: { imports = [ inputs.nixvim.homeModules.nixvim - # inputs.catppuccin.homeModules.catppuccin ./neovim ./packages.nix ./git.nix ./shell.nix - # ./catppuccin.nix ]; home = { @@ -16,8 +13,5 @@ sessionVariables = { # shared environment variables }; - - # create .hushlogin file to suppress login messages - file.".hushlogin".text = ""; }; } diff --git a/home/neovim/alpha.nix b/home/neovim/alpha.nix index bfdf179..440a1ed 100644 --- a/home/neovim/alpha.nix +++ b/home/neovim/alpha.nix @@ -1,5 +1,4 @@ -{ pkgs, ... }: -{ +{ pkgs, ... }: { # Alpha: Start screen/dashboard for Neovim # Shows a custom ASCII art header and quick action buttons on startup. programs.nixvim.plugins.alpha = { @@ -47,14 +46,10 @@ { type = "button"; val = "[+] New file"; - on_press.__raw = "function() vim.cmd[[ene]] vim.cmd[[startinsert]] end"; + on_press.__raw = + "function() vim.cmd[[ene]] vim.cmd[[startinsert]] end"; opts = { - keymap = [ - "n" - "e" - ":ene startinsert " - { } - ]; + keymap = [ "n" "e" ":ene startinsert " { } ]; shortcut = "e"; position = "center"; cursor = 3; @@ -68,12 +63,7 @@ val = "[?] Find file"; on_press.__raw = "function() vim.cmd[[Telescope find_files]] end"; opts = { - keymap = [ - "n" - "f" - ":Telescope find_files " - { } - ]; + keymap = [ "n" "f" ":Telescope find_files " { } ]; shortcut = "f"; position = "center"; cursor = 3; @@ -87,12 +77,7 @@ val = "[~] Recent files"; on_press.__raw = "function() vim.cmd[[Telescope oldfiles]] end"; opts = { - keymap = [ - "n" - "r" - ":Telescope oldfiles " - { } - ]; + keymap = [ "n" "r" ":Telescope oldfiles " { } ]; shortcut = "r"; position = "center"; cursor = 3; @@ -104,14 +89,9 @@ { type = "button"; val = "[Y] Yazi"; - on_press.__raw = "function() vim.cmd[[Yazi]] end"; + on_press.__raw = "function() require('yazi').yazi() end"; opts = { - keymap = [ - "n" - "y" - ":Yazi" - { } - ]; + keymap = [ "n" "y" ":Yazi" { } ]; shortcut = "y"; position = "center"; cursor = 3; @@ -125,12 +105,7 @@ val = "[X] Quit"; on_press.__raw = "function() vim.cmd[[qa]] end"; opts = { - keymap = [ - "n" - "q" - ":qa" - { } - ]; + keymap = [ "n" "q" ":qa" { } ]; shortcut = "q"; position = "center"; cursor = 3; diff --git a/home/neovim/conform.nix b/home/neovim/conform.nix index d1c4368..54186a5 100644 --- a/home/neovim/conform.nix +++ b/home/neovim/conform.nix @@ -1,5 +1,4 @@ -{ pkgs, ... }: -{ +{ pkgs, ... }: { # Conform: Code formatter that runs external formatting tools # Automatically formats code on save for consistent style. programs.nixvim = { @@ -16,7 +15,7 @@ }; format_on_save = { - timeout_ms = 500; + timeout_ms = 2000; lsp_fallback = true; }; }; diff --git a/home/neovim/default.nix b/home/neovim/default.nix index cf7df19..d928a9e 100644 --- a/home/neovim/default.nix +++ b/home/neovim/default.nix @@ -1,7 +1,5 @@ -{ ... }: -{ +{ ... }: { imports = [ - ./alpha.nix ./treesitter.nix ./lint.nix ./lsp.nix @@ -11,6 +9,7 @@ ./toggleterm.nix ./telescope.nix ./catppuccin.nix + ./alpha.nix ]; programs.nixvim = { @@ -23,13 +22,13 @@ plugins.web-devicons.enable = true; opts = { -number = true; # Show line numbers -cursorline = true; # Highlight current line -showmode = true; # already in statusline -hlsearch = true; # Highlight search result -incsearch = true; # Incremental Search -tabstop = 4; -termguicolors = true; # Enable 24-bit colormode + number = true; # Show line numbers + cursorline = true; # Highlight current line + showmode = true; # already in statusline + hlsearch = true; # Highlight search result + incsearch = true; # Incremental Search + tabstop = 4; + termguicolors = true; # Enable 24-bit colormode }; # Clipboard keymaps - yank to system clipboard @@ -38,51 +37,51 @@ termguicolors = true; # Enable 24-bit colormode { mode = "n"; key = "y"; - action = "\"+y"; + action = ''"+y''; options.desc = "Yank to clipboard"; } { mode = "v"; key = "y"; - action = "\"+y"; + action = ''"+y''; options.desc = "Yank to clipboard"; } { mode = "n"; key = "Y"; - action = "\"+Y"; + action = ''"+Y''; options.desc = "Yank line to clipboard"; } # Delete operations { mode = "n"; key = "d"; - action = "\"+d"; + action = ''"+d''; options.desc = "Delete to clipboard"; } { mode = "v"; key = "d"; - action = "\"+d"; + action = ''"+d''; options.desc = "Delete to clipboard"; } { mode = "n"; key = "D"; - action = "\"+D"; + action = ''"+D''; options.desc = "Delete line to clipboard"; } # Paste operations { mode = "n"; key = "p"; - action = "\"+p"; + action = ''"+p''; options.desc = "Paste from clipboard"; } { mode = "v"; key = "p"; - action = "\"+p"; + action = ''"+p''; options.desc = "Paste from clipboard"; } ]; diff --git a/home/neovim/yazi.nix b/home/neovim/yazi.nix index bd00bd6..06d6e0a 100644 --- a/home/neovim/yazi.nix +++ b/home/neovim/yazi.nix @@ -1,12 +1,16 @@ -{ pkgs, ... }: -{ +{ pkgs, ... }: { + # Yazi: Terminal file manager integration for Neovim + # Provides a fast, visual way to browse and manage files. programs.nixvim = { - yazi = { - enable = true; - settings = { - open_for_directories = true; - }; - }; + # Use extraPlugins to manually load yazi.nvim + extraPlugins = with pkgs.vimPlugins; [ yazi-nvim ]; + + # Configure yazi after it's loaded + extraConfigLua = '' + require('yazi').setup({ + open_for_directories = true, + }) + ''; keymaps = [ { @@ -31,7 +35,7 @@ } ]; + # Install yazi terminal program extraPackages = with pkgs; [ yazi ]; }; - } diff --git a/home/packages.nix b/home/packages.nix index 37c3c6e..ebebeb2 100644 --- a/home/packages.nix +++ b/home/packages.nix @@ -1,5 +1,4 @@ -{ pkgs, ... }: -{ +{ pkgs, ... }: { home = { packages = with pkgs; [ # dev tools @@ -26,6 +25,7 @@ # fonts nerd-fonts.fira-code nerd-fonts.fira-mono + nerd-fonts.hack ]; }; } diff --git a/home/shell.nix b/home/shell.nix index 5f13447..c90bd02 100644 --- a/home/shell.nix +++ b/home/shell.nix @@ -1,21 +1,26 @@ -{pkgs, ...}: { +{ pkgs, ... }: { home.packages = with pkgs; [ - eza # ls replacement - fzf # FuzzyFinder - tdf # terminal pdf viewer - jq # json parser - tree + eza # ls replacement + fzf # FuzzyFinder + tdf # terminal pdf viewer + jq # json parser + tree + fastfetch # system stats - # Fun stuff - lolcat - cmatrix + # Fun stuff + lolcat + cmatrix ]; - programs.kitty = { enable = true; themeFile = "Catppuccin-Mocha"; + font = { + name = "Fira Code Nerd Font"; + size = 12; + }; + settings = { confirm_os_window_close = 0; dynamic_background_opacity = true; # ctrl+shift+a>m/l @@ -28,46 +33,44 @@ tab_bar_min_tabs = 1; tab_bar_edge = "bottom"; - tab_bar_style = "powerline"; # Should be changed to custom - tab_powerline_style = "slanted"; - tab_title_template = "{title}{' :{}:'.format(num_windows) if num_windows > 1 else ''}"; + tab_bar_style = "custom"; # Should be changed to custom + tab_title_template = + "{fmt.fg.red}{bell_symbol}{activity_symbol}{fmt.fg.tab}{title}"; - symbol_map = - let - mappings = [ - "U+23FB-U+23FE" - "U+2B58" - "U+E200-U+E2A9" - "U+E0A0-U+E0A3" - "U+E0B0-U+E0BF" - "U+E0C0-U+E0C8" - "U+E0CC-U+E0CF" - "U+E0D0-U+E0D2" - "U+E0D4" - "U+E700-U+E7C5" - "U+F000-U+F2E0" - "U+2665" - "U+26A1" - "U+F400-U+F4A8" - "U+F67C" - "U+E000-U+E00A" - "U+F300-U+F313" - "U+E5FA-U+E62B" - ]; - in - (builtins.concatStringsSep "," mappings) + " Symbols Nerd Font"; + symbol_map = let + mappings = [ + "U+23FB-U+23FE" + "U+2B58" + "U+E200-U+E2A9" + "U+E0A0-U+E0A3" + "U+E0B0-U+E0BF" + "U+E0C0-U+E0C8" + "U+E0CC-U+E0CF" + "U+E0D0-U+E0D2" + "U+E0D4" + "U+E700-U+E7C5" + "U+F000-U+F2E0" + "U+2665" + "U+26A1" + "U+F400-U+F4A8" + "U+F67C" + "U+E000-U+E00A" + "U+F300-U+F313" + "U+E5FA-U+E62B" + ]; + in (builtins.concatStringsSep "," mappings) + " Symbols Nerd Font Mono"; }; }; - programs.yazi = { - enable = true; - enableBashIntegration = true; - enableZshIntegration = true; - enableFishIntegration = true; + home.file.".config/kitty/tab_bar.py".source = ./tab_bar.py; - settings = { - ration = [1 3 4]; - }; + programs.yazi = { + enable = true; + enableBashIntegration = true; + enableZshIntegration = true; + enableFishIntegration = true; + + settings = { ration = [ 1 3 4 ]; }; }; programs.zsh = { @@ -77,20 +80,34 @@ syntaxHighlighting.enable = true; shellAliases = { - la = "ls -la"; - ".." = "cd .."; + ls = "eza"; + la = "eza -la"; + f = "fzf"; + i = "kitty +kitten icat"; "nix-switch" = "sudo darwin-rebuild switch --flake ~/.config/nix"; }; + + initContent = "fastfetch"; }; programs.fish = { enable = true; shellAliases = { - la = "ls -la"; - ".." = "cd .."; + ls = "eza"; + la = "eza -la"; + f = "fzf"; + i = "kitty +kitten icat"; "nix-switch" = "sudo darwin-rebuild switch --flake ~/.config/nix"; }; + + interactiveShellInit = '' + starship init fish | source + fzf --fish | source + function fish_greeting + fastfetch + end + ''; }; programs.starship = { @@ -99,7 +116,9 @@ add_newline = true; command_timeout = 500; - format = "$username$hostname $directory $git_branch$git_status\n$character "; + format = '' + $username$hostname $directory $git_branch$git_status + $character ''; right_format = "$cmd_duration"; username = { @@ -129,7 +148,8 @@ # Git status module settings git_status = { - format = "[[(*$conflicted$untracked$modified$staged$renamed$deleted)](red) ($ahead_behind$stashed)]($style)"; + format = + "[[(*$conflicted$untracked$modified$staged$renamed$deleted)](red) ($ahead_behind$stashed)]($style)"; style = "bold #a6e3a1"; conflicted = ""; untracked = ""; @@ -153,7 +173,7 @@ }; nix_shell = { - format = "[$symbol$state( \($name\))]($style)"; + format = "[$symbol$state( ($name))]($style)"; symbol = "U+02744"; style = "bold #89dceb"; }; @@ -161,4 +181,6 @@ }; home.file.".config/fastfetch/config.jsonc".source = ./fastfetch.jsonc; + + home.file.".hushlogin".text = ""; # Suppress login } diff --git a/home/tab_bar.py b/home/tab_bar.py new file mode 100644 index 0000000..e1bad95 --- /dev/null +++ b/home/tab_bar.py @@ -0,0 +1,34 @@ +from datetime import datetime +from kitty.tab_bar import DrawData, ExtraData, TabBarData, as_rgb +from kitty.fast_data_types import Screen + + +def draw_tab( + draw_data: DrawData, + screen: Screen, + tab: TabBarData, + before: int, + max_title_length: int, + index: int, + is_last: bool, + extra_data: ExtraData, +) -> int: + + # Left side: Current directory or command + screen.cursor.fg = as_rgb(int("a6e3a1", 16)) + screen.cursor.bg = as_rgb(int("1e1e2e", 16)) + + # Get the foreground process (command) or use title + title = tab.active_fg or tab.title or "shell" + screen.draw(f" {title} ") + + # Middle: Nix icon + screen.cursor.fg = as_rgb(int("89dceb", 16)) + screen.draw(" ❄ ") + + # Right: Current time + screen.cursor.fg = as_rgb(int("cdd6f4", 16)) + current_time = datetime.now().strftime("%H:%M") + screen.draw(f"{current_time} ") + + return screen.cursor.x