Finalised Terminal Config

This commit is contained in:
2025-12-27 13:35:09 +01:00
parent f39de85d57
commit 9a777def2f
12 changed files with 165 additions and 212 deletions

View File

@@ -1,26 +1,15 @@
{ { pkgs, inputs, self, primaryUser, ... }: {
pkgs,
inputs,
self,
primaryUser,
...
}:
{
imports = [ imports = [
# ./homebrew.nix # ./homebrew.nix
./settings.nix ./settings.nix
inputs.home-manager.darwinModules.home-manager inputs.home-manager.darwinModules.home-manager
inputs.nix-homebrew.darwinModules.nix-homebrew inputs.nix-homebrew.darwinModules.nix-homebrew
# inputs.catppuccin.nixosModules.catppuccin
]; ];
# nix config # nix config
nix = { nix = {
settings = { settings = {
experimental-features = [ experimental-features = [ "nix-command" "flakes" ];
"nix-command"
"flakes"
];
# disabled due to https://github.com/NixOS/nix/issues/7273 # disabled due to https://github.com/NixOS/nix/issues/7273
# auto-optimise-store = true; # auto-optimise-store = true;
}; };
@@ -39,26 +28,19 @@
home-manager = { home-manager = {
useGlobalPkgs = true; useGlobalPkgs = true;
useUserPackages = true; useUserPackages = true;
users.${primaryUser} = { users.${primaryUser} = { imports = [ ../home ]; };
imports = [ extraSpecialArgs = { inherit inputs self primaryUser; };
../home
];
};
extraSpecialArgs = {
inherit inputs self primaryUser;
};
}; };
# macOS-specific settings # macOS-specific settings
programs.fish.enable = true;
system.primaryUser = primaryUser; system.primaryUser = primaryUser;
users.users.${primaryUser} = { users.users.${primaryUser} = {
home = "/Users/${primaryUser}"; home = "/Users/${primaryUser}";
shell = pkgs.zsh; shell = pkgs.fish;
}; };
environment = { environment = {
systemPath = [ systemPath = [ "/opt/homebrew/bin" ];
"/opt/homebrew/bin"
];
pathsToLink = [ "/Applications" ]; pathsToLink = [ "/Applications" ];
}; };
} }

41
flake.lock generated
View File

@@ -17,24 +17,6 @@
"type": "github" "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": { "darwin": {
"inputs": { "inputs": {
"nixpkgs": [ "nixpkgs": [
@@ -116,22 +98,6 @@
} }
}, },
"nixpkgs": { "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": { "locked": {
"lastModified": 1751949589, "lastModified": 1751949589,
"narHash": "sha256-mgFxAPLWw0Kq+C8P3dRrZrOYEQXOtKuYVlo9xvPntt8=", "narHash": "sha256-mgFxAPLWw0Kq+C8P3dRrZrOYEQXOtKuYVlo9xvPntt8=",
@@ -147,7 +113,7 @@
"type": "github" "type": "github"
} }
}, },
"nixpkgs_3": { "nixpkgs_2": {
"locked": { "locked": {
"lastModified": 1766653575, "lastModified": 1766653575,
"narHash": "sha256-TPgxCS7+hWc4kPhzkU5dD2M5UuPhLuuaMNZ/IpwKQvI=", "narHash": "sha256-TPgxCS7+hWc4kPhzkU5dD2M5UuPhLuuaMNZ/IpwKQvI=",
@@ -166,7 +132,7 @@
"nixvim": { "nixvim": {
"inputs": { "inputs": {
"flake-parts": "flake-parts", "flake-parts": "flake-parts",
"nixpkgs": "nixpkgs_3", "nixpkgs": "nixpkgs_2",
"systems": "systems" "systems": "systems"
}, },
"locked": { "locked": {
@@ -185,11 +151,10 @@
}, },
"root": { "root": {
"inputs": { "inputs": {
"catppuccin": "catppuccin",
"darwin": "darwin", "darwin": "darwin",
"home-manager": "home-manager", "home-manager": "home-manager",
"nix-homebrew": "nix-homebrew", "nix-homebrew": "nix-homebrew",
"nixpkgs": "nixpkgs_2", "nixpkgs": "nixpkgs",
"nixvim": "nixvim" "nixvim": "nixvim"
} }
}, },

View File

@@ -18,34 +18,19 @@
# declarative Neovim # declarative Neovim
nixvim.url = "github:nix-community/nixvim"; nixvim.url = "github:nix-community/nixvim";
# declarative Themeing
catppuccin.url = "github:catppuccin/nix";
}; };
outputs = outputs =
{ { self, darwin, nixpkgs, home-manager, nix-homebrew, nixvim, ... }@inputs:
self,
darwin,
nixpkgs,
home-manager,
nix-homebrew,
nixvim,
catppuccin,
...
}@inputs:
let let
# TODO: replace with your username # TODO: replace with your username
primaryUser = "phil"; primaryUser = "phil";
in in {
{
# build darwin flake using: # build darwin flake using:
# $ darwin-rebuild build --flake .#<name> # $ darwin-rebuild build --flake .#<name>
darwinConfigurations."cyper-mac" = darwin.lib.darwinSystem { darwinConfigurations."cyper-mac" = darwin.lib.darwinSystem {
system = "x86_64-darwin"; # aarch64-darwin system = "x86_64-darwin"; # aarch64-darwin
modules = [ modules = [ ./darwin ./hosts/cyper-mac/configuration.nix ];
./darwin
./hosts/cyper-mac/configuration.nix
];
specialArgs = { inherit inputs self primaryUser; }; specialArgs = { inherit inputs self primaryUser; };
}; };

View File

@@ -1,6 +0,0 @@
_: {
catppuccin = {
enable = false;
flavor = "mocha";
};
}

View File

@@ -1,13 +1,10 @@
{ primaryUser, inputs, ... }: { primaryUser, inputs, ... }: {
{
imports = [ imports = [
inputs.nixvim.homeModules.nixvim inputs.nixvim.homeModules.nixvim
# inputs.catppuccin.homeModules.catppuccin
./neovim ./neovim
./packages.nix ./packages.nix
./git.nix ./git.nix
./shell.nix ./shell.nix
# ./catppuccin.nix
]; ];
home = { home = {
@@ -16,8 +13,5 @@
sessionVariables = { sessionVariables = {
# shared environment variables # shared environment variables
}; };
# create .hushlogin file to suppress login messages
file.".hushlogin".text = "";
}; };
} }

View File

@@ -1,5 +1,4 @@
{ pkgs, ... }: { pkgs, ... }: {
{
# Alpha: Start screen/dashboard for Neovim # Alpha: Start screen/dashboard for Neovim
# Shows a custom ASCII art header and quick action buttons on startup. # Shows a custom ASCII art header and quick action buttons on startup.
programs.nixvim.plugins.alpha = { programs.nixvim.plugins.alpha = {
@@ -47,14 +46,10 @@
{ {
type = "button"; type = "button";
val = "[+] New file"; 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 = { opts = {
keymap = [ keymap = [ "n" "e" ":ene <BAR> startinsert <CR>" { } ];
"n"
"e"
":ene <BAR> startinsert <CR>"
{ }
];
shortcut = "e"; shortcut = "e";
position = "center"; position = "center";
cursor = 3; cursor = 3;
@@ -68,12 +63,7 @@
val = "[?] Find file"; val = "[?] Find file";
on_press.__raw = "function() vim.cmd[[Telescope find_files]] end"; on_press.__raw = "function() vim.cmd[[Telescope find_files]] end";
opts = { opts = {
keymap = [ keymap = [ "n" "f" ":Telescope find_files <CR>" { } ];
"n"
"f"
":Telescope find_files <CR>"
{ }
];
shortcut = "f"; shortcut = "f";
position = "center"; position = "center";
cursor = 3; cursor = 3;
@@ -87,12 +77,7 @@
val = "[~] Recent files"; val = "[~] Recent files";
on_press.__raw = "function() vim.cmd[[Telescope oldfiles]] end"; on_press.__raw = "function() vim.cmd[[Telescope oldfiles]] end";
opts = { opts = {
keymap = [ keymap = [ "n" "r" ":Telescope oldfiles <CR>" { } ];
"n"
"r"
":Telescope oldfiles <CR>"
{ }
];
shortcut = "r"; shortcut = "r";
position = "center"; position = "center";
cursor = 3; cursor = 3;
@@ -104,14 +89,9 @@
{ {
type = "button"; type = "button";
val = "[Y] Yazi"; val = "[Y] Yazi";
on_press.__raw = "function() vim.cmd[[Yazi]] end"; on_press.__raw = "function() require('yazi').yazi() end";
opts = { opts = {
keymap = [ keymap = [ "n" "y" ":Yazi<CR>" { } ];
"n"
"y"
":Yazi<CR>"
{ }
];
shortcut = "y"; shortcut = "y";
position = "center"; position = "center";
cursor = 3; cursor = 3;
@@ -125,12 +105,7 @@
val = "[X] Quit"; val = "[X] Quit";
on_press.__raw = "function() vim.cmd[[qa]] end"; on_press.__raw = "function() vim.cmd[[qa]] end";
opts = { opts = {
keymap = [ keymap = [ "n" "q" ":qa<CR>" { } ];
"n"
"q"
":qa<CR>"
{ }
];
shortcut = "q"; shortcut = "q";
position = "center"; position = "center";
cursor = 3; cursor = 3;

View File

@@ -1,5 +1,4 @@
{ pkgs, ... }: { pkgs, ... }: {
{
# Conform: Code formatter that runs external formatting tools # Conform: Code formatter that runs external formatting tools
# Automatically formats code on save for consistent style. # Automatically formats code on save for consistent style.
programs.nixvim = { programs.nixvim = {
@@ -16,7 +15,7 @@
}; };
format_on_save = { format_on_save = {
timeout_ms = 500; timeout_ms = 2000;
lsp_fallback = true; lsp_fallback = true;
}; };
}; };

View File

@@ -1,7 +1,5 @@
{ ... }: { ... }: {
{
imports = [ imports = [
./alpha.nix
./treesitter.nix ./treesitter.nix
./lint.nix ./lint.nix
./lsp.nix ./lsp.nix
@@ -11,6 +9,7 @@
./toggleterm.nix ./toggleterm.nix
./telescope.nix ./telescope.nix
./catppuccin.nix ./catppuccin.nix
./alpha.nix
]; ];
programs.nixvim = { programs.nixvim = {
@@ -38,51 +37,51 @@ termguicolors = true; # Enable 24-bit colormode
{ {
mode = "n"; mode = "n";
key = "y"; key = "y";
action = "\"+y"; action = ''"+y'';
options.desc = "Yank to clipboard"; options.desc = "Yank to clipboard";
} }
{ {
mode = "v"; mode = "v";
key = "y"; key = "y";
action = "\"+y"; action = ''"+y'';
options.desc = "Yank to clipboard"; options.desc = "Yank to clipboard";
} }
{ {
mode = "n"; mode = "n";
key = "Y"; key = "Y";
action = "\"+Y"; action = ''"+Y'';
options.desc = "Yank line to clipboard"; options.desc = "Yank line to clipboard";
} }
# Delete operations # Delete operations
{ {
mode = "n"; mode = "n";
key = "d"; key = "d";
action = "\"+d"; action = ''"+d'';
options.desc = "Delete to clipboard"; options.desc = "Delete to clipboard";
} }
{ {
mode = "v"; mode = "v";
key = "d"; key = "d";
action = "\"+d"; action = ''"+d'';
options.desc = "Delete to clipboard"; options.desc = "Delete to clipboard";
} }
{ {
mode = "n"; mode = "n";
key = "D"; key = "D";
action = "\"+D"; action = ''"+D'';
options.desc = "Delete line to clipboard"; options.desc = "Delete line to clipboard";
} }
# Paste operations # Paste operations
{ {
mode = "n"; mode = "n";
key = "p"; key = "p";
action = "\"+p"; action = ''"+p'';
options.desc = "Paste from clipboard"; options.desc = "Paste from clipboard";
} }
{ {
mode = "v"; mode = "v";
key = "p"; key = "p";
action = "\"+p"; action = ''"+p'';
options.desc = "Paste from clipboard"; options.desc = "Paste from clipboard";
} }
]; ];

View File

@@ -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 = { programs.nixvim = {
yazi = { # Use extraPlugins to manually load yazi.nvim
enable = true; extraPlugins = with pkgs.vimPlugins; [ yazi-nvim ];
settings = {
open_for_directories = true; # Configure yazi after it's loaded
}; extraConfigLua = ''
}; require('yazi').setup({
open_for_directories = true,
})
'';
keymaps = [ keymaps = [
{ {
@@ -31,7 +35,7 @@
} }
]; ];
# Install yazi terminal program
extraPackages = with pkgs; [ yazi ]; extraPackages = with pkgs; [ yazi ];
}; };
} }

View File

@@ -1,5 +1,4 @@
{ pkgs, ... }: { pkgs, ... }: {
{
home = { home = {
packages = with pkgs; [ packages = with pkgs; [
# dev tools # dev tools
@@ -26,6 +25,7 @@
# fonts # fonts
nerd-fonts.fira-code nerd-fonts.fira-code
nerd-fonts.fira-mono nerd-fonts.fira-mono
nerd-fonts.hack
]; ];
}; };
} }

View File

@@ -5,17 +5,22 @@
tdf # terminal pdf viewer tdf # terminal pdf viewer
jq # json parser jq # json parser
tree tree
fastfetch # system stats
# Fun stuff # Fun stuff
lolcat lolcat
cmatrix cmatrix
]; ];
programs.kitty = { programs.kitty = {
enable = true; enable = true;
themeFile = "Catppuccin-Mocha"; themeFile = "Catppuccin-Mocha";
font = {
name = "Fira Code Nerd Font";
size = 12;
};
settings = { settings = {
confirm_os_window_close = 0; confirm_os_window_close = 0;
dynamic_background_opacity = true; # ctrl+shift+a>m/l dynamic_background_opacity = true; # ctrl+shift+a>m/l
@@ -28,12 +33,11 @@
tab_bar_min_tabs = 1; tab_bar_min_tabs = 1;
tab_bar_edge = "bottom"; tab_bar_edge = "bottom";
tab_bar_style = "powerline"; # Should be changed to custom tab_bar_style = "custom"; # Should be changed to custom
tab_powerline_style = "slanted"; tab_title_template =
tab_title_template = "{title}{' :{}:'.format(num_windows) if num_windows > 1 else ''}"; "{fmt.fg.red}{bell_symbol}{activity_symbol}{fmt.fg.tab}{title}";
symbol_map = symbol_map = let
let
mappings = [ mappings = [
"U+23FB-U+23FE" "U+23FB-U+23FE"
"U+2B58" "U+2B58"
@@ -54,20 +58,19 @@
"U+F300-U+F313" "U+F300-U+F313"
"U+E5FA-U+E62B" "U+E5FA-U+E62B"
]; ];
in in (builtins.concatStringsSep "," mappings) + " Symbols Nerd Font Mono";
(builtins.concatStringsSep "," mappings) + " Symbols Nerd Font";
}; };
}; };
home.file.".config/kitty/tab_bar.py".source = ./tab_bar.py;
programs.yazi = { programs.yazi = {
enable = true; enable = true;
enableBashIntegration = true; enableBashIntegration = true;
enableZshIntegration = true; enableZshIntegration = true;
enableFishIntegration = true; enableFishIntegration = true;
settings = { settings = { ration = [ 1 3 4 ]; };
ration = [1 3 4];
};
}; };
programs.zsh = { programs.zsh = {
@@ -77,20 +80,34 @@
syntaxHighlighting.enable = true; syntaxHighlighting.enable = true;
shellAliases = { shellAliases = {
la = "ls -la"; ls = "eza";
".." = "cd .."; la = "eza -la";
f = "fzf";
i = "kitty +kitten icat";
"nix-switch" = "sudo darwin-rebuild switch --flake ~/.config/nix"; "nix-switch" = "sudo darwin-rebuild switch --flake ~/.config/nix";
}; };
initContent = "fastfetch";
}; };
programs.fish = { programs.fish = {
enable = true; enable = true;
shellAliases = { shellAliases = {
la = "ls -la"; ls = "eza";
".." = "cd .."; la = "eza -la";
f = "fzf";
i = "kitty +kitten icat";
"nix-switch" = "sudo darwin-rebuild switch --flake ~/.config/nix"; "nix-switch" = "sudo darwin-rebuild switch --flake ~/.config/nix";
}; };
interactiveShellInit = ''
starship init fish | source
fzf --fish | source
function fish_greeting
fastfetch
end
'';
}; };
programs.starship = { programs.starship = {
@@ -99,7 +116,9 @@
add_newline = true; add_newline = true;
command_timeout = 500; 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"; right_format = "$cmd_duration";
username = { username = {
@@ -129,7 +148,8 @@
# Git status module settings # Git status module settings
git_status = { 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"; style = "bold #a6e3a1";
conflicted = ""; conflicted = "";
untracked = ""; untracked = "";
@@ -153,7 +173,7 @@
}; };
nix_shell = { nix_shell = {
format = "[$symbol$state( \($name\))]($style)"; format = "[$symbol$state( ($name))]($style)";
symbol = "U+02744"; symbol = "U+02744";
style = "bold #89dceb"; style = "bold #89dceb";
}; };
@@ -161,4 +181,6 @@
}; };
home.file.".config/fastfetch/config.jsonc".source = ./fastfetch.jsonc; home.file.".config/fastfetch/config.jsonc".source = ./fastfetch.jsonc;
home.file.".hushlogin".text = ""; # Suppress login
} }

34
home/tab_bar.py Normal file
View File

@@ -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